GithubHelp home page GithubHelp logo

veritrans-php's Introduction


⚠️⚠️ ANNOUNCEMENT ⚠️⚠️

Please use the updated and composer compatible library: Midtrans PHP. For better more modern composer compatibility.

This repo still be here for archive and compatibility purpose. But it's always recommended to use the newer version Midtrans PHP.

🔈 END OF ANNOUNCEMENT 🔈


Veritrans-PHP

Build Status

Midtrans ❤️ PHP!

This is the Official PHP wrapper/library for Midtrans Payment API. Visit https://midtrans.com for more information about the product and see documentation at http://docs.midtrans.com for more technical details.

1. Installation

1.a Composer Installation

If you are using Composer, add this require line to your composer.json file:

{
	"require": {
		"veritrans/veritrans-php": "dev-master"
	}
}

and run composer install on your terminal.

1.b Manual Instalation

If you are not using Composer, you can clone or download this repository.

2. How to Use

2.1 General Settings

// Set your Merchant Server Key
Veritrans_Config::$serverKey = '<your server key>';
// Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction).
Veritrans_Config::$isProduction = false;
// Set sanitization on (default)
Veritrans_Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Veritrans_Config::$is3ds = true;

2.2 Choose Product/Method

We have 3 different products of payment that you can use:

  • Snap - Customizable payment popup will appear on your web/app (no redirection). doc ref
  • Snap Redirect - Customer need to be redirected to payment url hosted by midtrans. doc ref
  • Core API (VT-Direct) - Basic backend implementation, you can customize the frontend embedded on your web/app as you like (no redirection). doc ref

Choose one that you think best for your unique needs.

2.2.a Snap

You can see Snap example here.

Get Snap Token

$params = array(
    'transaction_details' => array(
      'order_id' => rand(),
      'gross_amount' => 10000,
    )
  );

$snapToken = Veritrans_Snap::getSnapToken($params);

Get Snap Token in Yii2

    
    //install library from composer
    //in your controller no need to include anything
    //make sure call class with \Class_name::method()

    public function actionSnapToken() {

        \Veritrans_Config::$serverKey = 'Secret Server Key Goes Here';
        // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction).
        \Veritrans_Config::$isProduction = false;
        // Set sanitization on (default)
        \Veritrans_Config::$isSanitized = true;
        // Set 3DS transaction for credit card to true
        \Veritrans_Config::$is3ds = true;

        $complete_request = [
            "transaction_details" => [
                "order_id" => "1234",
                "gross_amount" => 10000
            ]
        ];

        $snap_token = \Veritrans_Snap::getSnapToken($complete_request);
        return ['snap_token' => $snap_token];
  
    }

Initialize Snap JS when customer click pay button

<html>
  <body>
    <button id="pay-button">Pay!</button>
    <pre><div id="result-json">JSON result will appear here after payment:<br></div></pre> 

<!-- TODO: Remove ".sandbox" from script src URL for production environment. Also input your client key in "data-client-key" -->
    <script src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="<Set your ClientKey here>"></script>
    <script type="text/javascript">
      document.getElementById('pay-button').onclick = function(){
        // SnapToken acquired from previous step
        snap.pay('<?=$snapToken?>', {
          // Optional
          onSuccess: function(result){
            /* You may add your own js here, this is just example */ document.getElementById('result-json').innerHTML += JSON.stringify(result, null, 2);
          },
          // Optional
          onPending: function(result){
            /* You may add your own js here, this is just example */ document.getElementById('result-json').innerHTML += JSON.stringify(result, null, 2);
          },
          // Optional
          onError: function(result){
            /* You may add your own js here, this is just example */ document.getElementById('result-json').innerHTML += JSON.stringify(result, null, 2);
          }
        });
      };
    </script>
  </body>
</html>

Implement Notification Handler

Refer to this section

2.2.b VT-Web

!!! VT-Web is DEPRECATED !!!

Please use Snap Redirect, it has the same functionality, but better. Refer to this section

You can see some VT-Web examples here.

Get Redirection URL of a Charge

$params = array(
    'transaction_details' => array(
      'order_id' => rand(),
      'gross_amount' => 10000,
    ),
    'vtweb' => array()
  );

try {
  // Redirect to Veritrans VTWeb page
  header('Location: ' . Veritrans_Vtweb::getRedirectionUrl($params));
}
catch (Exception $e) {
  echo $e->getMessage();
}

2.2.b Snap Redirect

You can see some Snap Redirect examples here.

Get Redirection URL of a Payment Page

$params = array(
    'transaction_details' => array(
      'order_id' => rand(),
      'gross_amount' => 10000,
    ),
    'vtweb' => array()
  );

try {
  // Get Snap Payment Page URL
  $paymentUrl = Veritrans_Snap::createTransaction($params)->redirect_url;
  
  // Redirect to Snap Payment Page
  header('Location: ' . $paymentUrl);
}
catch (Exception $e) {
  echo $e->getMessage();
}

Implement Notification Handler

Refer to this section

2.2.c Core API (VT-Direct)

You can see some Core API examples here.

Set Client Key

Veritrans.client_key = "<your client key>";

Checkout Page

Please refer to this file

Checkout Process

1. Create Transaction Details
$transaction_details = array(
  'order_id'    => time(),
  'gross_amount'  => 200000
);
2. Create Item Details, Billing Address, Shipping Address, and Customer Details (Optional)
// Populate items
$items = array(
    array(
      'id'       => 'item1',
      'price'    => 100000,
      'quantity' => 1,
      'name'     => 'Adidas f50'
    ),
    array(
      'id'       => 'item2',
      'price'    => 50000,
      'quantity' => 2,
      'name'     => 'Nike N90'
    ));

// Populate customer's billing address
$billing_address = array(
    'first_name'   => "Andri",
    'last_name'    => "Setiawan",
    'address'      => "Karet Belakang 15A, Setiabudi.",
    'city'         => "Jakarta",
    'postal_code'  => "51161",
    'phone'        => "081322311801",
    'country_code' => 'IDN'
  );

// Populate customer's shipping address
$shipping_address = array(
    'first_name'   => "John",
    'last_name'    => "Watson",
    'address'      => "Bakerstreet 221B.",
    'city'         => "Jakarta",
    'postal_code'  => "51162",
    'phone'        => "081322311801",
    'country_code' => 'IDN'
  );

// Populate customer's info
$customer_details = array(
    'first_name'       => "Andri",
    'last_name'        => "Setiawan",
    'email'            => "[email protected]",
    'phone'            => "081322311801",
    'billing_address'  => $billing_address,
    'shipping_address' => $shipping_address
  );
3. Get Token ID from Checkout Page
// Token ID from checkout page
$token_id = $_POST['token_id'];
4. Create Transaction Data
// Transaction data to be sent
$transaction_data = array(
    'payment_type' => 'credit_card',
    'credit_card'  => array(
      'token_id'      => $token_id,
      'bank'          => 'bni',
      'save_token_id' => isset($_POST['save_cc'])
    ),
    'transaction_details' => $transaction_details,
    'item_details'        => $items,
    'customer_details'    => $customer_details
  );
5. Charge
$response = Veritrans_VtDirect::charge($transaction_data);
6. Handle Transaction Status
// Success
if($response->transaction_status == 'capture') {
  echo "<p>Transaksi berhasil.</p>";
  echo "<p>Status transaksi untuk order id $response->order_id: " .
      "$response->transaction_status</p>";

  echo "<h3>Detail transaksi:</h3>";
  echo "<pre>";
  var_dump($response);
  echo "</pre>";
}
// Deny
else if($response->transaction_status == 'deny') {
  echo "<p>Transaksi ditolak.</p>";
  echo "<p>Status transaksi untuk order id .$response->order_id: " .
      "$response->transaction_status</p>";

  echo "<h3>Detail transaksi:</h3>";
  echo "<pre>";
  var_dump($response);
  echo "</pre>";
}
// Challenge
else if($response->transaction_status == 'challenge') {
  echo "<p>Transaksi challenge.</p>";
  echo "<p>Status transaksi untuk order id $response->order_id: " .
      "$response->transaction_status</p>";

  echo "<h3>Detail transaksi:</h3>";
  echo "<pre>";
  var_dump($response);
  echo "</pre>";
}
// Error
else {
  echo "<p>Terjadi kesalahan pada data transaksi yang dikirim.</p>";
  echo "<p>Status message: [$response->status_code] " .
      "$response->status_message</p>";

  echo "<pre>";
  var_dump($response);
  echo "</pre>";
}

7. Implement Notification Handler

Refer to this section

2.3 Handle HTTP Notification

Create separated web endpoint (notification url) to receive HTTP POST notification callback/webhook. HTTP notification will be sent whenever transaction status is changed. Example also available here

$notif = new Veritrans_Notification();

$transaction = $notif->transaction_status;
$fraud = $notif->fraud_status;

error_log("Order ID $notif->order_id: "."transaction status = $transaction, fraud staus = $fraud");

  if ($transaction == 'capture') {
    if ($fraud == 'challenge') {
      // TODO Set payment status in merchant's database to 'challenge'
    }
    else if ($fraud == 'accept') {
      // TODO Set payment status in merchant's database to 'success'
    }
  }
  else if ($transaction == 'cancel') {
    if ($fraud == 'challenge') {
      // TODO Set payment status in merchant's database to 'failure'
    }
    else if ($fraud == 'accept') {
      // TODO Set payment status in merchant's database to 'failure'
    }
  }
  else if ($transaction == 'deny') {
      // TODO Set payment status in merchant's database to 'failure'
  }
}

2.4 Process Transaction

Get Transaction Status

$status = Veritrans_Transaction::status($orderId);
var_dump($status);

Approve Transaction

If transaction fraud_status == CHALLENGE, you can approve the transaction from Merchant Dashboard, or API :

$approve = Veritrans_Transaction::approve($orderId);
var_dump($approve);

Cancel Transaction

You can Cancel transaction with fraud_status == CHALLENGE, or credit card transaction with transaction_status == CAPTURE (before it become SETTLEMENT)

$cancel = Veritrans_Transaction::cancel($orderId);
var_dump($cancel);

Expire Transaction

You can Expire transaction with transaction_status == PENDING (before it become SETTLEMENT or EXPIRE)

$cancel = Veritrans_Transaction::cancel($orderId);
var_dump($cancel);

Contributing

Developing e-commerce plug-ins

There are several guides that must be taken care of when you develop new plugins.

  1. Handling currency other than IDR. Veritrans v1 and v2 currently accepts payments in Indonesian Rupiah only. As a corrolary, there is a validation on the server to check whether the item prices are in integer or not. As much as you are tempted to round-off the price, DO NOT do that! Always prepare when your system uses currencies other than IDR, convert them to IDR accordingly, and only round the price AFTER that.

  2. Consider using the auto-sanitization feature.

veritrans-php's People

Contributors

adisetiawan avatar alvinlitani avatar danieljl avatar davidsuryaputra avatar hafizh-vt avatar harrypujianto avatar ismailfaruqi avatar jrean avatar mul14 avatar niteshpawar avatar pascalalfadian avatar paxa avatar rizdaprasetya avatar robeth avatar shaddiqa avatar wendy0402 avatar yocki-s avatar

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

Watchers

 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

veritrans-php's Issues

wrong Class Name on vt-web example file

Using your example with veritrans-php/examples/vt-web/checkout-process.php
my script get error with message Class Not Found.

found the error, turns out, the class name is not Veritrans_Vtweb. the correct one should be Veritrans_VtWeb. simple typo but give me a month of headache.

so i propose a fix on veritrans-php/examples/vt-web/checkout-process.php line 35
header('Location: ' . Veritrans_Vtweb::getRedirectionUrl($params));
change to
header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($params));

so no one would experience the same situation like i did.

Thank you

CDN version of veritrans js

Is there any cdn version of this:
https://api.sandbox.veritrans.co.id/v2/assets/js/veritrans.js ?

sometimes it's too slow, and sometimes is not loaded at all

notification always Trying to get property of non-object in ApiRequestor.php line 93

Hello, i have a problem when received notification handler. I hope anyone can help me, thank you :)

in my controller
$raw_notification = file_get_contents("php://input");
$notif = new \Veritrans_Notification()

json response
{ "transaction_time": "2019-03-17 01:04:42", "transaction_status": "settlement", "transaction_id": "69975065-9f30-4b35-b76b-8aa6548889f8", "store": "indomaret", "status_message": "midtrans payment notification", "status_code": "200", "signature_key": "a2d8b5139a698fef1f66651e34c1da6380dc36d400b66e04895a9e88d97bfd806de90f32847e8f82c1054954f10dd7ab9e81d5ad17752771786b9d5f86d0e19c", "settlement_time": "2019-03-17 01:05:00", "payment_type": "cstore", "payment_code": "1177855738009350", "order_id": "INVOICE20190316000013", "gross_amount": "70400.00", "approval_code": "73481903060935055266" }

getting error 500
after I check using postman I get an error in ApiRequestor line 93

"message": "Trying to get property of non-object", "exception": "ErrorException", "file": "/home/wahyuper/public_html/goyur/vendor/veritrans/veritrans-php/Veritrans/ApiRequestor.php", "line": 93,

Veritrans Error (400): Validation Error When Using 3DS and Saved CC

When I use 3DS and "Save Credit Card" with 3D Secure credit card number listed on this repo I get Veritrans Error (400): Validation Error after I entered "one-time token" 112233

I want to simulate "one-click" in VT-Direct. According to Veritrans Documentation (http://docs.veritrans.co.id/en/vtdirect/other_features.html)

1. Initial Transaction
◦Customer fill the credit card number, CVV, expiry date
◦Customer perform 3D Secure authentication
◦Merchant receives token
◦Merchant uses token to charge transaction
◦When transaction successful, merchant saves customer’s token in the database. We name this token as saved_token.

2 .Following Transaction
◦Merchant retrieve customer saved_token from database
◦Merchant uses saved_token to charge transaction

Step to replicate this issue

  1. Clone this repo
  2. Upload to web server
  3. go to URL http://{{YOUR_URL}}/veritrans-php-master/examples/vt-direct/checkout.php
  4. Enter 4811 1111 1111 1114 or 5211 1111 1111 1117 (3D Secure) in Card Number field
  5. Check/choose 3D Secure and Save Credit Card
  6. Click submit payment
  7. 3D Secure dialog pops up
  8. Enter 112233
  9. Click OK
  10. I get Veritrans Error (400): Validation Error

Some Payment Methods Not Shown On VT-Web

Hello Sir,

I have a little problem, I want to show all payment methods like in this page http://docs.veritrans.co.id/en/vtweb/integration_php.html but some of payment method doesn't appear on my page, here is the screenshot:
screenshot-vtweb sandbox veritrans co id 2015-11-14 22-08-53

Here is my code:

$transaction = [
    'payment_type'        => 'vtweb',
    'vtweb'               => [
        //'enabled_payments'      => ['credit_card'],
        'credit_card_3d_secure' => true,
        //Set Redirection URL Manually
        'finish_redirect_url'   => route('thanks'),
        'unfinish_redirect_url' => route('thanks'),
        'error_redirect_url'    => route('thanks')
    ],
    'transaction_details' => $transaction_details,
    'customer_details'    => $customer_details,
    'item_details'        => $items_details,
];

$vtweb_url = Veritrans_VtWeb::getRedirectionUrl($transaction);

SHA 512 validation when handling notification

Based on docs, Veritrans provide addtional field named signature_key in notification JSON content.

signature_key is a proof that Veritrans is the sender of this notification. As signature_key use server_key in its calculation, only merchant and veritrans could validate this field.

PHP code that show how signature_key is calculated:

$order_id = "1111";
$status_code = "200";
$gross_amount = "100000";
$server_key = "askvnoibnosifnboseofinbofinfgbiufglnbfg";
$input = $order_id.$status_code.$gross_amount.$server_key;
$signature_key = openssl_digest($input, 'sha512');

Should we add this in Veritrans_Notifications.php? We'll only get_status if signature_key notifications is verified.

Benefit:

  1. Additional security layer
  2. Prevent merchant to do get_status if their notification end point is hit by attacker

Drawback:

  1. More development 😓
  2. Computation overhead when merchant's server receive notification content

Can't retrieve post from notification

Hello, I have some issues, I can't get the post from notification, but if I get all the data appear, but if I get specificly the key, the data not appear even getting error,

here is my code

public function store()
{
      $json_result = file_get_contents('php://input');
      $result = json_decode($json_result);
}

if I get variable $result, the data appear like this

{"masked_card":"411111-1111","approval_code":"000000","bank":"mandiri","eci":"02","transaction_time":"2014-04-07 16:22:36","gross_amount":"2700","order_id":"2014040745","payment_type":"credit_card","signature_key":"5d7df20ab2dfe91451c28f76f7dbdf3bcbb02555961f358cbe6a57f02e4c0ec72fa54f773bf3e196c2ae4df66f9b3fc71ed5167c49f7995d9efbda5e03d79f1d","status_code":"200","transaction_id":"826acc53-14e0-4ae7-95e2-845bf0311579","transaction_status":"capture","fraud_status":"accept","status_message":"Veritrans payment notification"}

but if I get by the key, become error

$result->order_id;

the error said
error, trying to property non object

then I try to change it become array

$result = json_decode($json_result, true);
$result['order_id'];

then, error again, the error said
illegal string offset order_id

is there something missing?

Sorry my English is bad, Thanks

Error Undefined index "email"

on class method
Veritrans_Snap::getSnapToken()

on object "customer_details" when 'email' data is not provided an error with message Undefined index: email occurred,

Expected to not have an error, because 'email' is optional

Notice: Trying to get property of non-object in

Bisa bantu untuk menyelesaikan masalah ini?
Fatal error: Uncaught exception 'Exception' with message 'Veritrans Error (): ' in C:....\Veritrans\ApiRequestor.php:96 Stack trace: #0 C:...\Veritrans\ApiRequestor.php(17): Veritrans_ApiRequestor::remoteCall('https://api.ver...', 'VT-server-......', false, false) #1 C:....\Veritrans\Transaction.php(17): Veritrans_ApiRequestor::get('https://api.ver...', 'VT-server-.....', false) #2 C:....\Veritrans\Notification.php(20): Veritrans_Transaction::status(NULL) #3 C:....\examples\index.php(7): Veritrans_Notification->__construct() #4 {main} thrown in

Some minor variable error in Vt-Web sample code

In PHP 5, this following code :
$_SERVER[REQUEST_URI] found in \examples\vt-web\index.php
will produce this error :
Notice: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI'

Explanation:

  • since PHP 5, REQUEST_URI (without quotation mark) would be considered as constant variable, when it's not defined, above error notice would occur.
  • Previously in PHP 4 and lower, REQUEST URI would be automatically converted into 'REQUEST_URI' string (with quotation mark), no error notice would occur.

Fix suggestion:

  • Simply change $_SERVER[REQUEST_URI] to $_SERVER['REQUEST_URI']

How to use one-click/recurring feature?

Please provide guide how to implement one-click feature on vt-direct. Start from get token, what parameters are needed, etc.

I already save token on first payment, but when I use it for next payment, I got validation error 'card_cvv is required'.

Regards,

snapToken response null

ketika pada di server dev semuanya baik-baik saja (dicoba dengan server key dan client eky mode prod), tetapi ketika berada di server prod ada masalah yaitu balikan snapToken menjadi null. Apakah ini disebebkan oleh cross domain ?.
karena domain dev peminta snap token berbentuk ss.com/tt dan pengirim snapToken untuk transaki adalah ss.com/rr sedangkan untuk server prod peminta snap token xx.yy.com sedangkan pengirim snapToken untuk melakukan transaksi adalah zz.yy.com

Expire API implementation

Based on docs, now Veritrans has expire API.
By using this API, we can prevent transaction to be paid by customer.

Should we implement this in veritrans-php?

Changes would be minimum iif we add expire function in Veritrans_Transaction.php 😄

wrong path, make sure it's `/charge`

Hi Selamat Malam,

Sya ingin mengimplementasi ke android dan mendapatkan masalah berikut

  1. saya sudah impementasi charge di sisi server (https://github.com/rizdaprasetya/midtrans-mobile-merchant-server--php-sample-)
    -folder berupa charge --> index.php
  2. saya setting MERCHANT_BASE_CHECKOUT_URL = https://serversaya.com/

ketika saya run mendapatkan Log berikut

05-08 01:24:52.591 24396-24396/com.tingtong.android I/MidtransSDK: Found 1 user addresses.
05-08 01:24:52.625 24396-24569/com.tingtong.android D/OkHttp: --> POST https://serversaya.com/charge
05-08 01:24:52.625 24396-24569/com.tingtong.android D/OkHttp: Content-Type: application/json
05-08 01:24:52.625 24396-24569/com.tingtong.android D/OkHttp: Content-Length: 637
05-08 01:24:52.625 24396-24569/com.tingtong.android D/OkHttp: Accept: application/json
05-08 01:24:52.626 24396-24569/com.tingtong.android D/OkHttp: {"customer_details":{"billing_address":{"address":"uvuvuv","city":"vyuv","country_code":"IDN","first_name":"uvuv","phone":"0606338","postal_code":"85086"},"email":"[email protected]","first_name":"uvuv","phone":"0606338","shipping_address":{"address":"uvuvuv","city":"vyuv","country_code":"IDN","first_name":"uvuv","phone":"0606338","postal_code":"85086"}},"credit_card":{"authentication":"3ds","bank":"bca","save_card":false,"secure":true},"item_details":[{"id":"1","name":"Trekking Shoes","price":20000,"quantity":1}],"transaction_details":{"gross_amount":20000,"order_id":"1588875892331"},"user_id":"cfe21a33-dc97-41db-8b1b-2af90707a560"}
05-08 01:24:52.626 24396-24569/com.tingtong.android D/OkHttp: --> END POST (637-byte body)
05-08 01:24:52.754 24396-24540/com.tingtong.android D/OpenGLRenderer: endAllStagingAnimators on 0x55c0097ba0 (RippleDrawable) with handle 0x55c079ad10
05-08 01:24:52.971 24396-24569/com.tingtong.android D/OkHttp: <-- 404 https://serversaya.com/charge/ (344ms)
05-08 01:24:52.971 24396-24569/com.tingtong.android D/OkHttp: date: Thu, 07 May 2020 18:24:52 GMT
05-08 01:24:52.971 24396-24569/com.tingtong.android D/OkHttp: content-type: text/html; charset=UTF-8
05-08 01:24:52.971 24396-24569/com.tingtong.android D/OkHttp: vary: Accept-Encoding
05-08 01:24:52.972 24396-24569/com.tingtong.android D/OkHttp: wrong path, make sure it's /charge
05-08 01:24:52.972 24396-24569/com.tingtong.android D/OkHttp: <-- END HTTP (36-byte body)

kenapa 404 not found ya?

error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Dear,

ada yang pernah mengalami ini?
localhost apache server menggunakan windows
sudah dicoba mengganti cacert.pem tapi masalahnya sama

[User Error] Uncaught Exception: CURL Error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Thx.

404 Resource not Found

When I Test Notification endpoint, why return exception 'Veritrans Error (404): The requested resource is not found' ?

transaction_time timezone

Hello team,
I just landed on Midtrans and tried to place some transaction in sandbox. When I made a status request as follow:

$objStatus = Veritrans_Transaction::status($order_id);

I receive a transaction_time without any timezone attached as follow:

[transaction_time] => 2019-04-24 09:37:38

Thanks..!

Getting status error on HttpRequest using java !

This is data json in body :

{"payment_type":"credit_card","credit_card":{"token_id":"481111-1114-a20971a7-1d82-4813-bd9c-561d8797177c","bank":"bni","save_token_id":"481111-1114-a20971a7-1d82-4813-bd9c-561d8797177c"},"transaction_details":{"order_id":1426147098232,"gross_amount":"200500"},"item_details":{"id":"item1","price":200500,"quantity":1,"name":"Adidas f50"},"customer_details":{"first_name":"Andri","last_name":"Setiawan","email":"[email protected]","phone":"081322311801","billing_address":{"first_name":"Andri","last_name":"Setiawan","address":"Karet Belakang 15A, Setiabudi.","city":"Jakarta","postal_code":"51161","phone":"081322311801","country_code":"IDN"},"shipping_address":{"first_name":"John","last_name":"Watson","address":"Bakerstreet 221B.","city":"Jakarta","postal_code":"51162","phone":"081322311801","country_code":"IDN"}}}

This is my code :

JSONObject jsonObject = JSONObject.fromObject(dataHash); // dataHash is Map<String, Object>
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);

    httpPost.setHeader("Accept", "application/json");
    httpPost.setHeader("Content-type", "application/json");
    httpPost.setHeader("Authorization: Basic", Base64.encodeBase64(url.getBytes()).toString());

StringEntity se = new StringEntity(jsonObject.toString());  
httpPost.setEntity(se);

HttpResponse httpResponse = httpClient.execute(httpPost);

This error what i've got ?
{
"status_code" : "413",
"status_message" : "The request cannot be processed due to malformed syntax in the request body"
}

Help me please ? If ure using java..

Error result data from veritans

Hello,

I want to test integrate veritrans with our website, but, while the transaction post to my site, error with this result below

Fatal error: Uncaught exception 'Exception' with message 'Veritrans Error (): ' in /home/roomnrate/public_html/veritrans/Veritrans/ApiRequestor.php:96 Stack trace: #0 /home/roomnrate/public_html/veritrans/Veritrans/ApiRequestor.php(17): Veritrans_ApiRequestor::remoteCall('https://api.san...', 'VT-server-kAuXE...', false, false) #1 /home/roomnrate/public_html/veritrans/Veritrans/Transaction.php(17): Veritrans_ApiRequestor::get('https://api.san...', 'VT-server-kAuXE...', false) #2 /home/roomnrate/public_html/veritrans/Veritrans/Notification.php(20): Veritrans_Transaction::status(NULL) #3 /home/roomnrate/public_html/veritrans/balik.php(6): Veritrans_Notification->__construct() #4 {main} thrown in /home/roomnrate/public_html/veritrans/Veritrans/ApiRequestor.php on line 96

I use source code example

transaction_status; $type = $notif->payment_type; $order_id = $notif->order_id; $fraud = $notif->fraud_status; if ($transaction == 'capture') { // For credit card transaction, we need to check whether transaction is challenge by FDS or not if ($type == 'credit_card'){ if($fraud == 'challenge'){ // TODO set payment status in merchant's database to 'Challenge by FDS' // TODO merchant should decide whether this transaction is authorized or not in MAP echo "Transaction order_id: " . $order_id ." is challenged by FDS"; } else { // TODO set payment status in merchant's database to 'Success' echo "Transaction order_id: " . $order_id ." successfully captured using " . $type; } } } else if ($transaction == 'settlement'){ // TODO set payment status in merchant's database to 'Settlement' echo "Transaction order_id: " . $order_id ." successfully transfered using " . $type; } else if($transaction == 'pending'){ // TODO set payment status in merchant's database to 'Pending' echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type; } else if ($transaction == 'deny') { // TODO set payment status in merchant's database to 'Denied' echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied."; } else if ($transaction == 'cancel') { // TODO set payment status in merchant's database to 'Denied' echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is canceled."; } ?>

What does it mean ?

Sandbox Snap is no payment channel

Hello,

I have try Snap, but result is no payment channel, please see my screenshot:
I have try to contact the support many times, 2 weeks now, still no solution.

2018-08-07_1-45-04

About item_details field and Validation Error

Starting about last month, I keep getting these 'Validation Error' emails:
sc_1

I indeed am not sending 'item_details' to the transaction request because I don't need them (already covered in 'transaction_details') and the Documentation stated that it's OPTIONAL
sc_2

  • In my opinion, it should be really optional because it's not applicable to all cases and I think shouldn't be getting those errors. I hope you can take a look at it.
  • Also, when this kind of Validation Error happens, what will happen exactly to the transaction?

Thank you!
(Sorry if I'm this is the wrong place to post this issue!)

PHP Error: illegal string offset foreach loop

Hi,

Iam using codeigniter and use it as library.

in VtDirect line: 18

if (array_key_exists('item_details', $params)) {
      $gross_amount = 0;
      foreach ($params['item_details'] as $item) {
        $gross_amount += $item['quantity'] * $item['price'];
      }
      $payloads['transaction_details']['gross_amount'] = $gross_amount;
    }

is getting error when single item.

  • Illegal string offset 'quantity'
  • Illegal string offset 'price'

And it work when I change code with:

if (array_key_exists('item_details', $params)) {
      $gross_amount = 0;
      foreach ($params['item_details'] as $item) {
        $gross_amount += $params['item_details']['quantity'] * $params['item_details']['price'];
      }
      $payloads['transaction_details']['gross_amount'] = $gross_amount;
    }

In basic programming PHP (Without CI) it run awesome without Error.
I don't know what mistake I do.

Thanks

Mohon bantuan order tidak berubah secara otomatis- woocommerce

> 2020-04-28T04:03:00+00:00 CRITICAL Uncaught Error: Call to a member function get_payment_method() on boolean in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php:76
> Stack trace:
> #0 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_Gateway_Midtrans_Notif_Handler->midtrans_response('')
> #1 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
> #2 /home/kasturia/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
> #3 /home/kasturia/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php(148): do_action('woocommerce_api...')
> #4 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
> #5 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
> #6 /home/kasturia/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
> #7 /home/kasturia/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_req in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php on line 76
> 
> 2020-04-28T04:04:11+00:00 CRITICAL Uncaught Error: Call to a member function get_payment_method() on boolean in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php:76
> Stack trace:
> #0 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_Gateway_Midtrans_Notif_Handler->midtrans_response('')
> #1 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
> #2 /home/kasturia/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
> #3 /home/kasturia/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php(148): do_action('woocommerce_api...')
> #4 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
> #5 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
> #6 /home/kasturia/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
> #7 /home/kasturia/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_req in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php on line 76
> 
> 2020-04-28T04:11:09+00:00 CRITICAL Uncaught Error: Call to a member function get_payment_method() on boolean in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php:76
> Stack trace:
> #0 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_Gateway_Midtrans_Notif_Handler->midtrans_response('')
> #1 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
> #2 /home/kasturia/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
> #3 /home/kasturia/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php(148): do_action('woocommerce_api...')
> #4 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
> #5 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
> #6 /home/kasturia/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
> #7 /home/kasturia/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_req in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php on line 76
> 
> 2020-04-28T04:29:14+00:00 CRITICAL Uncaught Error: Call to a member function get_payment_method() on boolean in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php:76
> Stack trace:
> #0 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_Gateway_Midtrans_Notif_Handler->midtrans_response('')
> #1 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
> #2 /home/kasturia/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
> #3 /home/kasturia/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php(148): do_action('woocommerce_api...')
> #4 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
> #5 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
> #6 /home/kasturia/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
> #7 /home/kasturia/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_req in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php on line 76
> 
> 2020-04-28T05:02:15+00:00 CRITICAL Uncaught Error: Call to a member function get_payment_method() on boolean in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php:76
> Stack trace:
> #0 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_Gateway_Midtrans_Notif_Handler->midtrans_response('')
> #1 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
> #2 /home/kasturia/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
> #3 /home/kasturia/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php(148): do_action('woocommerce_api...')
> #4 /home/kasturia/public_html/wp-includes/class-wp-hook.php(287): WC_API->handle_api_requests(Object(WP))
> #5 /home/kasturia/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
> #6 /home/kasturia/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
> #7 /home/kasturia/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_req in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php on line 76
> 
> 2020-04-28T07:05:52+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('22b16711-69c2-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php on line 111
> 
> 2020-04-28T07:10:31+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('22b16711-69c2-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php on line 111
> 
> 2020-04-28T09:02:14+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('057a72e6-493e-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T09:47:15+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('057a72e6-493e-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T09:50:03+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('3ecd0692-86ae-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T09:53:46+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('3ecd0692-86ae-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T10:01:24+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('057a72e6-493e-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T10:42:45+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('ec4fd00c-fdef-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T11:04:15+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('3ecd0692-86ae-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T11:25:45+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('3ecd0692-86ae-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111
> 
> 2020-04-28T11:42:21+00:00 CRITICAL Uncaught Exception: Midtrans Error (404): Transaction doesn't exist. in /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php:111
> Stack trace:
> #0 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php(22): Midtrans\ApiRequestor::remoteCall('https://api.mid...', 'Mid-server-jMGS...', false, false)
> #1 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Transaction.php(23): Midtrans\ApiRequestor::get('https://api.mid...', 'Mid-server-jMGS...', false)
> #2 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/Notification.php(26): Midtrans\Transaction::status('057a72e6-493e-4...')
> #3 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-api.php(140): Midtrans\Notification->__construct()
> #4 /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-notif-handler.php( di /home/kasturia/public_html/wp-content/plugins/midtrans-woocommerce/lib/midtrans/Midtrans/ApiRequestor.php pada baris 111


Mohon bantuannya, merchant id, serverkey, clientkey terisi dengan baik, di hari sebelumnya perubahan metode payment otomati di woocommerce berjalan lancar, namun beberapa hari kemudian tidak berjalan dengan baik. order tidak berubah otomatis menjadi complete, namun di dashboard midtrans payment masuk.

saya coba menggunakan sandbox, saya kembalikan thema ke awal dan menonaktifkan plugin yang ada tetap saja tidak ada perubahan. saya coba ulang method pembayarannya
image

sudah settlement
image

namun tidak terjadi apa apa
image

How to set Payment Notification URL programmaticaly

Hi,
can we set Payment Notification URL programmaticaly? like finish_redirect_url or unfinish_redirect_url
example: 'payment_notification_url' => 'some links'
Can't find this on docs website..
Thx before

$transaction = array(
        'payment_type' => 'vtweb',
        'vtweb' => array(
            'enabled_payments' => array($this->PaymentMethod),
            'credit_card_3d_secure' => true,
            'payment_notification_url' => 'some links',
            'finish_redirect_url' => 'some links',
            'unfinish_redirect_url' => 'some links',
            'error_redirect_url' => 'some links',
        ),
        'transaction_details' => $transaction_details,
        'customer_details' => $customer_details,  
        'item_details' => $item_details
    );

Veritrans Error (404): Transaction doesn't exist.

Saya sudah cari2 dan bertanya2 di beberapa tempat komunitas, dan sudah mengikuti semua instruksi di github issue midtrans juga #73 dan Exception: Veritrans Error (404): The requested resource is not found in #2 tapi tetap mengalami error yang sama, saya juga sudah mengikuti saran dari mas nurasto/veritrans-php@15fbdf3 sampai edit package midtransnya, tetap saja tidak terjadi apa2. mohon bantuannya. terima kasih.

Penyebab Eror ini status 404 adalah ini Veritrans_Transaction::status('{')

Saya mendapat error di log server semacam ini

PHP Fatal error: Uncaught exception 'Exception' with message 'Veritrans Error (404): The requested resource is not found' in /var/www/.../.../Veritrans/ApiRequestor.php:96

dan sebelumnya ada error ini :

PHP Warning: Illegal string offset 'transaction_id' in /var/www/.../.../Veritrans/Notification.php on line 20

Berikut stack tracenya

Stack trace: #0 /var/www/vhosts/.../.../Veritrans/ApiRequestor.php(17): Veritrans_ApiRequestor::remoteCall('https://api.san...', 'SB-Mid-server-O...', false, false)

#1 /var/www/vhosts/.../.../Veritrans/Transaction.php(17): Veritrans_ApiRequestor::get('https://api.san...', 'SB-Mid-server-O...', false)

#2 /var/www/vhosts/.../.../Veritrans/Notification.php(20): Veritrans_Transaction::status('{')

#3 /var/www/vhosts/.../.../gateway.php(92): Veritrans_Notification->__construct()

#4 /var/www/vhosts/.../.../Veritrans/ApiRequestor.php on line 96

penyebab erro menurut analisaku di #2
yang adalah masih olahan standar dari barisan code midtrans

json dikirim dari dashboard midtrans bagian konfigurasi --> test notification url --> send json menuju gateway.php yang merupakan notification handle di webku

Ada yang mengalami hal yang sama?

bagaimana penyelesaiinnya?

PSR-0?

Will there be any updates to make the library PSR-0 ready?

can't get token

Hello @robeth can you help me ?

php error 8: (Undefined index: token_id) in file '..../PaymentVeritrans.php' line 510

i got that error when i doing

 var_dump($_POST['token_id']);
 die();

in the page that i want to create item detail etc.

can you help ?

Fatal error: Uncaught exception 'Exception' with message 'CURL Error: Failed to connect to app.sandbox.veritrans.co.id port 443: Connection refused'

Fatal error: Uncaught exception 'Exception' with message 'CURL Error: Failed to connect to app.sandbox.veritrans.co.id port 443: Connection refused' in C:\xampp1\htdocs\veritrans\Veritrans\SnapApiRequestor.php:91 Stack trace: #0 C:\xampp1\htdocs\veritrans\Veritrans\SnapApiRequestor.php(28): Veritrans_SnapApiRequestor::remoteCall('https://app.san...', 'SB-Mid-server-3...', Array, true) #1 C:\xampp1\htdocs\veritrans\Veritrans\Snap.php(53): Veritrans_SnapApiRequestor::post('https://app.san...', 'SB-Mid-server-3...', Array) #2 C:\xampp1\htdocs\veritrans\examples\snap\checkout-process.php(84): Veritrans_Snap::getSnapToken(Array) #3 {main} thrown in C:\xampp1\htdocs\veritrans\Veritrans\SnapApiRequestor.php on line 91

Please bump the version

I don't really see the point of not bumping the 1.0.1 version and make people use your dev-master instead of bumping the version.

I want to make a Laravel port for your package, but to do that, I have to make sure that people will install your package first and then install mine:

composer require veritrans/veritrans-php:dev-master
composer require imam/midtrans-laravel:dev-master

Rather than:

composer require imam/midtrans-laravel:dev-master

Because well, dev-master isn't considered stable. Most Laravel user use stable package on their production. If I use your stable version, it's been 2years since the last bumping :( .

It's not how composer work, I shouldn't tell anyone to install your library first. There is a reason why composer.json exist.

Further more, it's not how semantic versioning work. I have to watch your repo for an update so I can update your package in my application, because you don't use the versioning system correctly.

Isn't it better that whenever you have a patch, like from 1.1 to 1.2, I'll just do composer update and the work is done for me, so I don't have to update the version myself?

You know I really want to use Midtrans for my application, because I want to waste some time to build a Laravel port for your package and make it public for others to use. But this:

image

Is something that you guys should consider fixing. Bump your version, and keep bumping whenever new update is exist, so I can just do composer update without having to watch your repo every single day. Because that is one of the main reason Composer exist.

Before that, well I'll wait, or should I make my own REST API port instead, I have time before I really need a payment gateway for Imam.tech 🚶 .

Peace, I'll open my door if you have some confusion about how to implement this issue to your package,
here or email me, we need you to make Indonesia a better country 😄

My two cents for veritrans

Hello,

I developed Commerce Veritrans Module(https://www.drupal.org/project/commerce_veritrans) for drupal. At the time of development I found there is minor bug in Veritrans-php. So I resolved it and sent you pull request for it( #13 ).
It will be great if you add client key also in config.php, right now I am fetching it directly from database and assigning it to tokens(#12).
Another thing I need to specify version number for veritrans-php library or veritrans(2.0). Right now I am fetching it from README.md line no. 6. But its will be nice if you add this library version or veritrans version in composer.json(#14).

Thanks in advance.

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.