PHP code example of lowsprofile / midtrans

1. Go to this page and download the library: Download lowsprofile/midtrans library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lowsprofile / midtrans example snippets



Lowsprofile\Midtrans\Method\Midtrans;

Midtrans::$server_key = 'SERVER_KEY_HERE';

$order_id = 'example-1424936368';
$status = Midtrans::status($orderid);

echo json_encode($status);
/*
{
  "status_code" : "200",
  "status_message" : "Success, transaction found",
  "transaction_id" : "249fc620-6017-4540-af7c-5a1c25788f46",
  "masked_card" : "481111-1114",
  "order_id" : "example-1424936368",
  "payment_type" : "credit_card",
  "transaction_time" : "2015-02-26 14:39:33",
  "transaction_status" : "capture",
  "fraud_status" : "accept",
  "approval_code" : "1424936374393",
  "signature_key" : "2802a264cb978fbc59f631c68d120cbda8dc853f5dfdc52301c615cf4f14e7a0b09aa...",
  "bank" : "bni",
  "gross_amount" : "30000.00"
}
*/