PHP code example of k3rnel / omnipay-easy-pay

1. Go to this page and download the library: Download k3rnel/omnipay-easy-pay 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/ */

    

k3rnel / omnipay-easy-pay example snippets



    use Omnipay\Omnipay;
    use Omnipay\EasyPay\EasyPayGateway;

    $gateway = Omnipay::create(EasyPayGateway::class);
    $gateway->setMerchantId('12345678'); // E-Merchant unique ID provided by EasyPay after being integrated
    $gateway->setMerchantToken('8f11efa4-4041-4e28-a191-0cc01c4ff66c'); // Merchant token (key) provided by EasyPay after being integrated



    $purchaseRequest = $gateway->purchase();
    $purchaseRequest->setTransactionId('123456'); // Order ID of the merchant system.
    $purchaseRequest->setAmount(5); // Transaction amount



    $gateway = Omnipay::create(EasyPayGateway::class);
    $gateway->setMerchantId('12345678');
    $gateway->setMerchantToken('8f11efa4-4041-4e28-a191-0cc01c4ff66c');
    
    $fetchTransactionRequest = $gateway->fetchTransaction();
    $fetchTransactionRequest->setTransactionId('123456');

    $fetchTransactionResponse = $fetchTransactionRequest->send();
    
    if ($fetchTransactionResponse->isSuccessful()) {
        // Your logic is to mark the order as paid.
    }