Git Product home page Git Product logo

midtrans-php's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

midtrans-php's Issues

Override notification URL

Hi,

The snap docs state that we are able to override/append default notification url by modifying header in the charge request. Can we do that using this library?

Since from what I understand, the Http request is taken care of by the library using cURL.

Thanks!

404 Not Found Transaction

Hi, I have some issues with the status transactions. Here my response "Midtrans API is returning API error. HTTP status code: 404 API response: { "status_code": "404", "status_message": "Transaction doesn't exist.", "id": "4e64ffc3-f937-4345-a7d4-6638593d560a"}". I'm trying using sandbox API v2 and my order is HEND-1829. If I check back to redirect_url it's working as well but if I check status API the response is 404 not found. Thank You

Event ketika payment dibuat oleh midtrans

Adakah event sewaktu ketika payment dibuat oleh midtrans?

misal ketika tombol pay now atau see account number diclick ?

idenya saya ingin menginsert data pembelian ke database hanya ketika transaksi dibuat oleh midtrans

Sandbox GoPay Payment failure

Beberapa kali melakukan test dengan gopay, ada pilihan dropdown "success" > "pay" tapi habis itu selalu error seperti ini:

image

sebelumnya saya copy QR Code url dan saya pasti di inputbox, kira2 kenapa error ini ya ?

Menyeragamkan format response variable hasil snap.pay() dengan \Midtrans\Notification()

Ketika snap.pay() berhasil dijalankan dan berstatus onPending, browser menerima response object, salah satu key dalam object tersebut yaitu "pdf_url". Ketika transaksi berstatus pending, server juga menerima notifikasi. Dalam response object hasil dari Notification(), key "pdf_url" tersebut tidak ada, padahal nilai di dalamnya penting untuk disimpan ke dalam database karena bersifat unik.

Sebenarnya bisa menggunakan nilai pdf_url dari browser tadi yang dikirim lagi ke server lewat AJAX, namun itu berarti melakukan 2 kali query ke database untuk order ID yang sama.

Tidak bisa bayar dengan gopay karena dianggap belum install aplikasi gojek

Hallo, saya ingin bertanya mengenai Midtrans Pembayaran ini. Jadi aplikasi mobile android yang saya kembangkan, itu ketika user menekan tombol checkout, itu langsung saya munculkan SDK Midtransnya. Lalu pas saya coba menggunakan GoPay untuk membayar, ternyata tidak bisa. Tertulis "Whoops! Unfortunately, we couldn't find Gojek app installed on your phone". Padahal saya sudah install aplikasi gojek di hp saya. Bagaimana ya caranya?

[Error 413] Payload Format is not supported.

Hi, I have some issue with this error.

When I'm using the Midtrans sample-uikit for android to test the Midtrans in my local server. I followed the documentation for mobile SDK and setting up my PHP Laravel to accept the request from mobile SDK.

I'm using PHP 7.2 (Downgraded from 7.4) and below is the screenshots

Post Request from INSOMNIA

image

Charge Controller

image

How to set Dynamic payment notification ?

Bagimana untuk melakukan dynamic notification lewat code PHP, sebelumnya saya menggunakan kode ini:

 \Veritrans_Config::$curlOptions[CURLOPT_HTTPHEADER] = array(
             'X-Override-Notification: https:/www.test/notication'
        );

tapi sekarang ngak jalan

image

Midtrans snap token

Ketika menggunakan snap token, dengan metode pembayaran shopeepay dan gopay, Qris, bagai mana mendapatkan qr code seperti saat menggunakan coreapi.

     "transaction_time": "2019-10-08 12:41:36",
  "transaction_status": "pending",
  "fraud_status": "accept",
  "actions": [
      {
        "name": "generate-qr-code",
        "method": "GET",
        "url": "https://api.sandbox.veritrans.co.id/v2/gopay/231c79c5-e39e-4993-86da-cadcaee56c1d/qr-code"
      },
      {
        "name": "deeplink-redirect",
        "method": "GET",
        "url": "https://simulator.sandbox.midtrans.com/gopay/ui/checkout?referenceid=Y0xwjoQ9uy&callback_url=someapps%3A%2F%2Fcallback%3Forder_id%3Dorder-101h-1570513296"
      },
      {
        "name": "get-status",
        "method": "GET",
        "url": "https://api.sandbox.veritrans.co.id/v2/231c79c5-e39e-4993-86da-cadcaee56c1d/status"
      },
      {
        "name": "cancel",
        "method": "POST",
        "url": "https://api.sandbox.veritrans.co.id/v2/231c79c5-e39e-4993-86da-cadcaee56c1d/cancel"
      }
  ]

Trying to get property 'status_code' of non-object

Ada yang bisa bantu masalah ini?
error ketika mengambil status transaksi, padahal id didalam "$request->id" sudah sesuai dengan data transaksi yang sudah ada di midtrans

public function paymentHistory(Request $request)
{
$status = \Midtrans\Transaction::status($request->id);
dd($status);
$status = json_decode(json_encode($status), true);
$va_number = $status['va_numbers'][0]['va_number'];
$gross_amount = $status['gross_amount'];
$bank = $status['va_numbers'][0]['bank'];
$transaction_status = $status['transaction_status'];
$transaction_time = $status['transaction_time'];
$deadline = date('Y-m-d H:i:s', strtotime('+1 day', strtotime($transaction_time)));
}

error nya seperti ini

ErrorException: Trying to get property 'status_code' of non-object in file /opt/lampp/htdocs/api-spp/vendor/midtrans/midtrans-php/Midtrans/ApiRequestor.php on line 102

Trying to get property 'status_code' of non-object

Saya sedang mengintegrasikan Midtrans di sandbox environment. Sejauh ini ketika membuat transaksi baru tidak ada masalah. Namun ketika ingin mengambil data suatu transaksi, misalnya mengambil status transaksi seperti yang ditunjukkan di sini: https://github.com/Midtrans/midtrans-php#get-transaction-status, muncul error seperti ini.

ErrorException
Trying to get property 'status_code' of non-object

vendor/midtrans/midtrans-php/Midtrans/ApiRequestor.php:102

Saya sudah memberikan parameter $orderId dengan benar, lalu di mana yang salah?

Saya menggunakan Snap API dan aplikasi saya menggunakan Laravel 7.

Unrelated: Merchant Account Specific Issue - No payment channels available

midtrans-screenshot
Payment channel tidak tersedia saat saya menggunakan snap. Hal ini juga terjadi pada saat saya ingin membuat payment link, saat ingin memilih metode pembayaran tertulis No payment method available. Saya sudah mencoba mendaftarkan akun baru namun sama saja, saya juga sudah menghubungi help center namun belum ada solusi.

Mohon bantuannya, terimakasih.

Uncaught Exception when notify url accessed directly.

When you do something like this in notify url script:

namespace Midtrans;
require_once dirname(__FILE__) . '/../Midtrans.php';
Config::$isProduction = false;
Config::$serverKey = '<your serverkey>';
$notif = new Notification();

Then this notify url accessed directly or not contained the correct format it will cause error:
"Uncaught Exception: Midtrans API is returning API error. HTTP status code: 404 API response: .... in /midtrans-php/Midtrans/ApiRequestor.php on line 167"

Isn't the correct way of handling this is returning false or returning null to $notif? So developer can easily check wheter the notification returned the correct data.

enable_payments tetep tampill semua payment channel

Halo, saya lagi coba fitur enable_payment untuk 1 pembayaran saja "gopay" snap, tapi ketika popup window teteap tampil semua, saya ikutin cara ini:

{
  "transaction_details": {
    "order_id": "ORDER-101",
    "gross_amount": 10000
  },
  "item_details": [{
    "id": "ITEM1",
    "price": 10000,
    "quantity": 1,
    "name": "Midtrans Bear",
    "brand": "Midtrans",
    "category": "Toys",
    "merchant_name": "Midtrans"
  }],
  "customer_details": {
    "first_name": "TEST",
    "last_name": "MIDTRANSER",
    "email": "[email protected]",
    "phone": "+628123456"
  },
  "enabled_payments": ["gopay"],
  "gopay": {
    "enable_callback": true,
    "callback_url": "http://gopay.com"
  }
}

mestinya dia hanya tampil GoPay saja

apa mungkin ada setting yang lain ?

Recurring response 400

Halo, saya sedang mencoba fitur recurring nya, saya test via api hasil response nya berhasil sesuai dokumentasi recurring tapi kenapa di history sandbox tidak ada ya ?

kemudian ketika di implementasikan dengan json yang sama, selalu mendapat error response 400

$params = array( "name" => "SUBSCRIBE1", "amount" => "14000", "currency" => "IDR", "payment_type" => "credit_card", "token" => $request->token_id, "schedule"=> array( "interval"=> 1, "interval_unit"=> "month" ), ); $response = \Midtrans\CoreApi::charge($params);

Midtrans Error (400): One or more parameters in the payload is invalid.. Validation Messages (transaction_details is required, credit_card is required)

padahal di dokumentasi transaction_details & credit_card ini tidak ada https://api-docs.midtrans.com/#create-subscription

Blank Saat Create Token

saya ada permasalahan ketika membuat token di online menjadi blank, akan tetapi di localhost bisa berjalan dengan baik, beikut kode yang saya buat

use Midtrans\Snap;

// Buat transaksi ke midtrans kemudian save snap tokennya.
            $payload = [
                'transaction_details' => [
                    'order_id'      => $invoice,
                    'gross_amount'  => $transaction->price,
                ],
                'customer_details' => [
                    'first_name'    => auth()->user()->name,
                    'email'         => auth()->user()->email,
                ],
                'item_details' => [
                    [
                        'id'       => $transaction->id,
                        'price'    => $transaction->price,
                        'quantity' => 1,
                        'name'     => $tutorial_set_premium->title
                    ]
                ]
            ];

            //create snap token
            $snapToken = Snap::getSnapToken($payload);
            dd($snapToken);

Sample client and server key

Hello, I'm currently integrating Midrans payment for users in Indonesia using the core API but I can't get client and server keys because I'm not in that region and I could not get an indonesian phone number to register a Midrans account.

Are there sample client and server keys just for testing purpose? If there are, I would appreciate if they can be shared with me. Thanks.

Snap Issue: transaction_details.gross_amount replaced by the sum of item_details

Kenapa value dari transaction_details.gross_amount selalu ke-replace oleh total value dari item_details? Karna kasus saya perlu menambahkan shipping cost di gross_amount sehingga terdapat selisih value antara gross_amount dan item_details.. tetapi ketika request snap, amount nya selalu tergantikan oleh item_details tersebut, shipping costnya hilang..

Can snap token re-used to open payment page again, if it was closed by customer?

Hi guys, I have problem in Credit Card Transaction. The important part is in token page after user / buyer / customer input the CC number etc, the next part is should input the token (OTP), but I want to cancel this moment, and then I want to checkout for the twice, unfortunately the snap does not show anymore. How could I fix it? Please explain this problem guys,

The case :
https://drive.google.com/file/d/1_pDxVEzWzUdU1VJj8ByHj2gh95R2iOsF/view?usp=sharing

I already followed this guide, but still does not work.
Screen Shot 2021-07-08 at 17 22 24

Reference :
https://docs.midtrans.com/en/other/faq/technical?id=can-i-revoke-or-cancel-an-active-snap-token-to-prevent-the-customer-from-proceeding-with-the-transaction

please contact me on [email protected] or 081387019695 to reply this issue or ask the details.
thanks in advance.

Credit card token is no longer available

This is the error that I receive

Midtrans Error (411): Credit card token is no longer available. Please create a new one

Code

Sent data to back-end

address: 4
courier: "pos"
courierService: "Paket Kilat Khusus"
note: null
shippingPrice: 328000
token_id: "L40liCDOPCh8WY6Cns1QOd0kaoePOLi48RxwWLRL" // assume that "token_id" is CSRF Token from my page
totalPrice: 15918000
weight: 8

controller

        $token_id = $request->input('token_id');

        // Transaction data to be sent
        $transaction_data = array(
            'payment_type' => 'credit_card',
            'credit_card'  => array(
                'token_id'      => $token_id,
                'authentication'=> true,
                // 'bank'          => 'bni', // optional to set acquiring bank
                // 'save_token_id' => true   // optional for one/two clicks feature
            ),
            'transaction_details' => $transaction_details,
            'item_details'        => $items,
            'customer_details'    => $customer_details
        );

Phone and email fields should be allowed to be hidden on Snap's card payment page, to simplify customer inputs & improve conversion rate

Currently I'm testing SNAP redirect to process credit card payment. And Midtrans force to show phone and email field on credit card checkout field. Look this comparison of credit card checkout page between couple market leader of Indonesian payment gateway.

MIDTRANS:
Screenshot at 2022-02-14 12-59-04

DOKU
Screenshot at 2022-02-14 12-57-23

XENDIT
Screenshot at 2022-02-14 13-01-40

As you can see, our credit card checkout form is the most complicated to fill on the market today. Most of modern credit card processor is hiding the email and phone field. Only showing CC#, expiry, and CVV.

And there is not way to hide that phone and email field, midtrans only allow to make it optional (but still show the field). I ask the support team, which never ever helps when asking anything about technical problem. They suggest to remove the "email" and "phone" parameters from "customer_details".

Which is wrong suggestion. If I remove "email" and "phone"parameters from "customer_details" The 'phone' and 'email' field still exist just not filled.
Then If I add "email" and "phone"parameters to "customer_details" The 'phone' and 'email' field will still exist and autofilled with the value I send.

Please add additional parameter so we can hide this unnecessary field, because based on our test, this fields really hurt checkout conversion rate.

[Non Repo Related Question] MidtransNew3ds.getCardToken "onFailure" JS callback function not triggered properly, when card input is not in valid luhn-algo format

Payment_Test.mp4

Hi,

Not working callback onFailure function. when the user enters the wrong card details then will not call this function. So I can manage to fail cases and not display error msg on screens.

PFA

[
33333333333333333332021-12-30_16-52
22222222222222021-12-30_16-51

----------------------Code--------------------------------------

<title>Checkout</title> <script id="midtrans-script" type="text/javascript" src="https://api.midtrans.com/v2/assets/js/midtrans-new-3ds.min.js" data-environment="sandbox" data-client-key="SB-Mid-client-ai9O6FCDRwbMVy-b"></script> <script type="text/javascript"> // card data from customer input, for example var cardData = { "card_number": 4811111111111114, "card_exp_month": 02, "card_exp_year": 2021, "card_cvv": 123, }; // callback functions var options = { onSuccess: function(response){ // Success to get card token_id, implement as you wish here console.log('Success to get card token_id, response:', response); var token_id = response.token_id; console.log('This is the card token_id:', token_id); // Implement sending the token_id to backend to proceed to next step }, onFailure: function(response){ // Fail to get card token_id, implement as you wish here console.log('Fail to get card token_id, response:', response); // you may want to implement displaying failure message to customer. // Also record the error message to your log, so you can review // what causing failure on this transaction. } }; // trigger `getCardToken` function MidtransNew3ds.getCardToken(cardData, options); </script>

tidak bisa memuat ulang snap untuk memunculkan kode QR gopay

Setelah memilih metode pembayaran gopay dan status pembayaran menjadi PENDING, user tidak sengaja merefresh halaman. ketika halaman dimuat dan snap muncul kembali, user tidak bisa melihat QR code untuk menyelesaikan pembayaran. Metode seperti apa untuk menangani masalah ini? trims
gopay

In case anyone looking for alternative package, I made sawirricardo/midtrans-api or sawirricardo/laravel-midtrans

Hi everyone, I made a package as an alternative for anyone looking for better typed support.
It currently handles snap payment and get transaction status, since these are all I need for now.

If you develop on laravel, I also make a wrapper which you can use.

  1. https://github.com/sawirricardo/midtrans-api - composer require sawirricardo/midtrans-api
  2. https://github.com/sawirricardo/laravel-midtrans - composer require sawirricardo/laravel-midtrans

If you have any feedback, PRs and ideas are welcomed. Discussions are also open.
Thank you

Gopay deeplink fail to open in native Android webview `net::ERR_UNKNOWN_URL_SCHEME` (non PHP specific issue)

Hi,

We got this error in production mode:

E/onReceivedError: failingUrl=gojek://gopay/merchanttransfer?tref=0120201217034811O35QTUK1ElID&amount=20000&activity=GP:RR&callback_url=https%3A%2F%2Fxxx.com%3Forder_id%3D1-39-95927, errorCode=-10, description=net::ERR_UNKNOWN_URL_SCHEME

The error occurs on Android's webview, although this following code's already added:
if (url.contains("gojek://")) { Intent intent; intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); return true; }

Do you have any suggestion, what could be wrong here?

Thanks,
Cherry

Null response in production mode

Hi,

We change from sandbox into production using core API and connect to php, but it doesn't work.
We get null response from Midtrans server. We already set isProduction and change the server key.

Using Sandbox is absolutely no problem.

What could be the problem?

Many thanks.

Cheers,
Cherry

Installation issue

Hi there,

I wonder with your documentation specifically this part .

I am trying to use it in Laravel Framework, I'd installed this package by composer, now what?

  1. How should I access to Midtrans\Config in my controllers?
  2. Is there any package name of aliases that i should add to my configs or what?
  3. Is there any views/model that I should publish (artisan discover command)?
  4. Is there any config names that I should add to .env file or even config file (artisan share views)?

Please provide complete documentation if you try to make a package. Thank you

midtrans Error Notification

Order ID:
Shuttle-61a7aeb5647f7

Current endpoint:
https://shuttlein.online/api/midtrans/notification

Content-Type:
application/json

Notification data:
{
"va_numbers": [
{
"va_number": "69246547150",
"bank": "bca"
}
],
"transaction_time": "2021-12-02 00:19:54",
"transaction_status": "settlement",
"transaction_id": "d2480bac-9371-4bc1-a941-0b9af9c7a218",
"status_message": "midtrans payment notification",
"status_code": "200",
"signature_key": "6b9eefbe7f5f561672f5bd36d058da241db98e9adaf7a704856258fc36ff539d2d4f390b142c8ca823a8131e6e67cf90bda941e0ac2d9bd3dabc83d3dbd8fc62",
"settlement_time": "2021-12-02 00:20:04",
"payment_type": "bank_transfer",
"payment_amounts": [],
"order_id": "Shuttle-61a7aeb5647f7",
"merchant_id": "G064569246",
"gross_amount": "145000.00",
"fraud_status": "accept",
"currency": "IDR"
}
Error detail:
InternalServerError

Transaction Page:
https://dashboard.sandbox.midtrans.com/payments/d2480bac-9371-4bc1-a941-0b9af9c7a218

adakah solusi untuk error yang saya alami ?

Error Get Transaction Status

Hi, I get an error when request status
$status = \Midtrans\Transaction::status($order->no_order); var_dump($status);
Screenshot_1

array_key_exists is deprecated in PHP 7.4

array_key_exists() is deprecated in PHP 7.4

array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead {"exception":"[object] (ErrorException(code: 0): array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead at /app/vendor/midtrans/midtrans-php/Midtrans/Notification.php:32)

Apakah bisa menonaktifkan redirect ke Finish URL?

Saya sedang mengintegrasikan Snap Midtrans ke dalam aplikasi saya dengan Laravel sebagai backend, dan React sebagai frontend. Aplikasi tersebut berkonsep single page app (SPA) sehingga perpindahan antar halaman di-handle oleh react-router/react-router-dom tanpa proses reload/refresh/redirect halaman web.

Saat ini saya sedang menambahkan fitur Snap di aplikasi tersebut, namun sedang mengalami kesulitan karena tiap kali user selesai memilih metode pembayaran, Snap akan me-redirect aplikasi ke URL yang sudah ditentukan di Midtrans Dashboard. Proses redirect tersebut membuat state aplikasi saya menjadi terganggu. Padahal, saya sudah menggunakan JS callbacks, khususnya pada opsi onPending. Sebagaimana yang tertulis di dokumentasi,

If Merchant use snap.js JS callbacks (onPending, onSuccess, onError), those JS callbacks will be triggered instead of redirection.

Saya sudah mencoba menghapus Finish URL di dashboard maupun override Finish URL melalui backend, namun hasilnya Snap akan terus me-redirect (kali ini ke halaman utama frontend aplikasi saya). Saya juga sudah lihat dokumentasi, dan sepertinya tidak ada opsi untuk menonaktifkan fitur redirect ke Finish URL tersebut.

Mohon arahannya, terima kasih.

Transaction::approve return 404

Transaction::approve on testing return 404

<!DOCTYPE html>
<html class="no-js">
<head>
    <meta charset="utf-8">

    <!-- Responsive viewport declaration -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <!-- Cross compatibility -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Midtrans</title>
    <meta name="description" content=""/>

    <link rel="stylesheet" href="//v2/assets/css/all.css"/>

</head>
<body>
<div class="container">
    <div class="center desc"><p>404</p></div>
    <div class="center click"><h3>
        <a href="#">&#45; Ups &#45;</a>
    </h3></div>
</div>
<footer>
    <p class="center">&copy; <script>document.write(new Date().getFullYear())</script> PT Midtrans. All Rights Reserved</p>
</footer>

</body>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.