PHP code example of en1gm4a / fastpay-bundle

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

    

en1gm4a / fastpay-bundle example snippets


 $fastpay = new FastPayAPI("your store id","your store password","deploy mode");

    $InitiatePayment = new InitiatePayment();
    $InitiatePayment->setOrderId("24214565");
    $InitiatePayment->setCart("[{\"name\": \"Scarf\", \"qty\": 1, \"unit_price\": 5000, \"sub_total\": 5000}]");
    $InitiatePayment->setBillAmount("1000");
    $InitiatePayment->setCurrency("IQD");
    $fastpay->ExecuteInitiate($InitiatePayment);

$fastpay->ExecuteInitiate($InitiatePayment)->getRedirectUri(); //to get the payment link
$fastpay->ExecuteInitiate($InitiatePayment)->getData(); //response array data
$fastpay->ExecuteInitiate($InitiatePayment)->getCode(); //reponses code (200|422)
$fastpay->ExecuteInitiate($InitiatePayment)->getMessages(); //responses message

 $fastpay->ExecuteVPayment("order id");

 $fastpay->ExecuteVPayment("order id")->getMerchantOrderId(); //returns merchant_order_id

$fastpay->ExecuteRPayment("orderid","amount","refund secret key","msidn (phone num)")

 $fastpay->ExecuteRPayment("orderid","amount","refund secret key","msidn (phone num)")->getRecipientName(); //returns reciepient name

 $fastpay->ExecuteVRefund("order id");

$fastpay->ExecuteVRefund("order id")->isRefundStatusTrue; //returns true if refund was successful