PHP code example of cave / omnipay-aps

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

    

cave / omnipay-aps example snippets


use Omnipay\Omnipay;

$gateway = Omnipay::create('APS');

$gateway->setTestMode(TRUE);
$gateway->setRequestPhrase('PASS');

//$gateway->setAccessCode('zx0IPmPy5jp1vAz8Kpg7')
//	->setAmount(10000) // amount * 100
//	->setMerchantIdentifier(123)
//	->setMerchantReference('random')
//	->setCustomerEmail('[email protected]')
//	->setOrderDescription('iPhone 6-S');
//	.... OR ....

$response = $gateway->purchase([
    'access_code' => 'zx0IPmPy5jp1vAz8Kpg7',
    'amount' => '10000', // amount * 100
    'merchant_identifier' => 'CycHZxVj',
    'merchant_reference' => 'XYZ9239-yu898',
    'currency' => 'AED', // default AED
    'language' => 'en', // default en
    'customer_email' => '[email protected]',
    'order_description' => 'iPhone 6-S',
])->send();

// Process response
if ($response->isSuccessful()) {
    // Let's party!!!
} else {
    // Payment failed: display message to customer
    echo $response->getMessage();
}