PHP code example of tarikhagustia / epayindo

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

    

tarikhagustia / epayindo example snippets


$auth = new Auth('MERCHANT_EMAIL', 'MERCHANT_API_KEY');
$payment = new Payment($auth);
$total_amount = 45000; 
$payment_data = $payment->createPayment('MERCHANT_USERNAME', 'CLIENT_EMAIL', $total_amount, [
  ['name', 45000,1,45000]
]);

print_r($payment_data);
// for third parameter using this scema
// ['product_name', 'product_price', 'qty', 'total_amount']
// $paymetn_data will return this following object
// stdClass Object
// (
//     [status] => 1
//     [url] => https://my.epayindo.com/payment/pay/B972E201809301024
//     [data] => stdClass Object
//         (
//             [transaction] => stdClass Object
//                 (
//                     [pin] => pgcometsnet12345
//                     [merchant_id] => pgcometsnet
//                     [transaction_id] => B972E201809301024
//                     [account_number] => 1
//                     [item_type] => MISC
//
//                     [basket] => name,45000,1,45000;Fee,6500,1,6500
//                     [actype] => pay
//                 )
//
//             [gross_amount] => 51500
//         )
//
// )


Epayindo\Auth;
use Epayindo\Transfer;
$auth = new Auth('MERCHANT_EMAIL', 'MERCHANT_API_KEY');

$transfer = new Transfer($auth);
$amount = 10;
$res = $transfer->to('MERCHANT_RECEIVER_USERNAME', $amount, 'Note Example')->send();

print_r($res);
// stdClass Object
// (
//     [message] => Maaf, tidak cukup dana untuk melakukan operasi
//     [success] =>
//     [code] => 401
// )