PHP code example of armyan / omnipay-netcash

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

    

armyan / omnipay-netcash example snippets


    use Omnipay\Omnipay;


    $gateway = Omnipay::create('NetCash');
    $gateway->setVendorKey(env('VENDOR_KEY'));
    $gateway->setAccountId(env('ACCOUNT_ID'));
    $gateway->setServiceKey(env('SERVICE_KEY')); // Language
    $gateway->setAmount(10); // Amount to charge
    $gateway->setTransactionId(XXXX); // Transaction ID from your system



    $purchase = $gateway->purchase()->send();
    $purchase->redirect();



    $gateway = Omnipay::create('NetCash');
    $gateway->setAccountId(env('ACCOUNT_ID'));
    $gateway->setServiceKey(env('SERVICE_KEY'));
    
    $purchase = $gateway->completePurchase()->send();
    
    // Do the rest with $purchase and response with 'OK'
    if ($purchase->isSuccessful()) {
        
        // Your logic
        
    }
    
    return new Response('OK');