PHP code example of agile-pay / sdk

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

    

agile-pay / sdk example snippets


$agilePay = new \AgilePay\Sdk\AgilePay([
    'api_key' => '',
    'api_secret' => ''
]);

$gateway = $agilePay->gateway()->create('stripe', [
    'secret_key' => ''
]);

$gateway->reference;

$paymentMethod = $agilePay->paymentMethod()->createGatewayToken($gateway->reference, [
    'number' => '',
    'holder_name' => '',
    'cvv' => '',
    'expiry_month' => '', //mm
    'expiry_year' => '',  //yy
]);

$paymentMethod->token;

$transaction = $agilePay->transaction()
                ->setPaymentMethod($paymentMethod->token;)
                ->auth(500, 'eur'); //Charging 5.00 euros

$transaction->reference;

$response = $agilePay->transaction($transaction->reference)->void();

$response = $agilePay->transaction($transaction->reference)->capture();

$response = $agilePay->transaction($transaction->reference)->credit();