PHP code example of dadandev / midtranspay

1. Go to this page and download the library: Download dadandev/midtranspay 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/ */

    

dadandev / midtranspay example snippets

 php


use DadanDev\MidtransPay\Configurasi;
use DadanDev\MidtransPay\Environment;
use DadanDev\MidtransPay\PayMent;

$config);


$response = $payment->pay([
    "payment_type" => "cstore",
    "transaction_details" => [
        "order_id" => "INV-".strtoupper(uniqid()),
        "gross_amount" => 44000,
    ],
    "cstore" => [
        'store' => 'alfamart',
    ],
  
    'customer_details' => [
        'first_name' => "Dadan Efendi",
        'last_name' => "Indrayan",
        "email" => '[email protected]',
    ]
   
]);

var_dump($response);