PHP code example of shawnley / altapay-php-api

1. Go to this page and download the library: Download shawnley/altapay-php-api 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/ */

    

shawnley / altapay-php-api example snippets


$auth = new \Altapay\Authentication('username', 'password' , 'myshop.gateway.com');
$api = new \Altapay\Api\CaptureReservation($auth);
$api->setTransactionId('transaction id');
// Or you can use a transaction object you got from a previous API call
// $api->setTransaction($transactionObject);
try {
    $response = $api->call();
    // If everything went perfect, you will get a \Altapay\Api\Document\Capture in the response
} catch (\Altapay\Api\Exceptions\ClientException $e) {
    // If anything went wrong, you will get a exception where you can see the raw request and the raw response
}