PHP code example of createch / paycorp-sampath-vault

1. Go to this page and download the library: Download createch/paycorp-sampath-vault 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/ */

    

createch / paycorp-sampath-vault example snippets

sh
    $paymentInit = new PaycorpSampathVault();
    $data['clientRef'] = $request->user()->id;
    $data['comment'] = "Your comment";
    $data['total_amount'] = 1010;
    $data['service_fee_amount'] = 1010;
    $data['payment_amount'] = 1010;
    $res = $paymentInit->initRequest($data);
    
    return response()->json($res);
sh
    $data['reqid'] = $_GET['reqid'];
    $data['clientRef'] = $_GET['clientRef'];
    $paymentComplete = new PaycorpSampathVault();
    $response = $paymentComplete->completeRequest($data);
    
    return response()->json($res);
sh
    $payment = new PaycorpSampathVault();

    $data = [];
    $data['clientRef'] = "Clent Ref";
    $data['token'] = "token";
    $data['comment'] = "Your Comment";
    $data['amount'] = 1010; // in cents
    $data['expire_at'] = "Expiry Date of Card"; //1223
    $data['payment_amount'] = 1010;
    $response = $payment->realTimePayment($data);
    
    return $response;