PHP code example of ardcoras / netaxept

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

    

ardcoras / netaxept example snippets



stantiate the API with the rchantId', 'token');

// Get a response object from the API, in this example, get a transaction.
$response = $api->getTransaction('transactionId');

// Retrieve properties on the transaction.
$status = $response->getTransactionStatus();
print_r($response->getOrderInformation());

// Acme/Netaxept/Response/MyCustomQuery.php

use FDM\Netaxept\Response\Query;
class MyCustomQuery extends Query
{
    public function getQueryFinished()
    {
        return (string)$this->xml->QueryFinished;
    }
}

...

// In your file that instantiates the API object
$responseFactory = new Factory(Acme\Netaxept\Response\MyCustomQuery::class);
$api = new Api('merch', 'token', $responseFactory);
$response = $api->getTransaction('transactionid');
$finished = $response->getQueryFinished(); 

// In your file that instantiates the API object
use FDM\Netaxept\Exception\Factory;
$exceptionFactory = new Factory(Acme\Netaxept\Exception\MyCustomException::class ... [etc]);
$api = new Api('merch', 'token', null, $exceptionFactory);
try {
    $response = $api->getTransaction('transactionid');
} catch (MyCustomException $e) {
    $e->doSomethingCustom();
}