PHP code example of essam / laravel-tap-payment

1. Go to this page and download the library: Download essam/laravel-tap-payment 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/ */

    

essam / laravel-tap-payment example snippets


$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);

$redirect = false; // return response as json , you can use it form mobile web view application

return $TapPay->charge([
        'amount' => 200,
        'currency' => 'AED',
        'threeDSecure' => 'true',
        'description' => 'test description',
        'statement_descriptor' => 'sample',
        'customer' => [
           'first_name' => 'customer',
           'email' => '[email protected]',
        ],
        'source' => [
          'id' => 'src_card'
        ],
        'post' => [
           'url' => null
        ],
        'merchant' => [
           'id' => 'YOUR-MERCHANT-ID'  //Include this when you are going to live
        ],
        'redirect' => [
           'url' => url('check_payment.php')
        ]
   ],$redirect);

$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);
$Charge =  $TapPay->getCharge($charge_id);

$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);

$ChargesList = $TapPay->chargesList([
'period' => [
  'date' => [
      'from' => Date('Y-m-d H:i:s'),
      'to' => Date('Y-m-d H:i:s'),
     ]
  ],
  'status' => 'INITIATED',
  'limit' => 30
]);

$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);

$Refund = $TapPay->refund([
    'charge_id' => $charge_id,
     'amount' => 2,
     'currency' => 'AED',
     'reason' => 'type the refund reason',
     'post' => [
        'url' => 'http://post_after_refund_page.php'
   ]);

$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);

$Refund = $TapPay->getRefund($refund_id);

$TapPay = new Payment(['secret_api_Key'=> $secret_api_Key]);

$RefundList = $TapPay->refundList([
'period' => [
  'date' => [
      'from' => Date('Y-m-d H:i:s'),
      'to' => Date('Y-m-d H:i:s'),
     ]
  ],
  'limit' => 30
]);