PHP code example of basgate / laravel-sdk

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

    

basgate / laravel-sdk example snippets


use BAS;

// ... in your controller or service ...

$transactionStatus = BAS::checkTransactionStatus($orderId);

// Send refund request

$trxToken="Yac4bNFV3Yi3CsnMO9mLR4WRcJPPTqjGUFkzMDc0MTU=";
$refund= BAS::refund($trxToken);

// initiate Transaction and generateBasPaymentJS
        try {
            $transaction = BAS::initiateTransaction($orderId, $amount, $currency);

            if (isset($transaction['status']) && $transaction['status'] == 1) {

              $paymentJS =  BAS::generateBasPaymentJS($transaction['body']['trxToken'], $transaction['body']['order']);

              return view('bas::payment', ['paymentJS' => $paymentJS]);
            }