AllSecure eXchange Client for PHP

v3.1.1 2022-06-17 15:45 UTC

This package is not auto-updated.

Last update: 2023-12-02 21:19:05 UTC


Packagist PHP Version License

API Documentation:

Learn more about AllSecure Exchange platform by reading our documentation.

Installation via composer:

composer require doge-dev/all-secure-php-client

Refer to Composer Documentation if you are not familiar with composer).

Usage with test parameters:

PHP client is made having in mind the LIVE environment. If you are to test on a Sandbox environment, you should ammend the client as follows:

  • src/Client.php to comment-out line 46 and uncomment line 47
  • src/Client.php to comment-out line 70 and uncomment line 71
  • src/Xml/Generator.php to comment-out line 43 and uncomment line 44



use DogeDev\AllSecure\Client;
use DogeDev\AllSecure\Data\Customer;
use DogeDev\AllSecure\Transaction\Debit;
use DogeDev\AllSecure\Transaction\Result;

// Include the autoloader (if not already done via Composer autoloader)

// Instantiate the "Exchange\Client\Client" with your credentials
$client = new Client("username", "password", "apiKey", "sharedSecret");

$customer = new Customer();

$debit = new Debit();

// define your transaction ID: e.g. 'myId-'.date('Y-m-d').'-'.uniqid()
$merchantTransactionId = 'your_transaction_id'; // must be unique


// send the transaction
$result = $client->debit($debit);

// now handle the result
if ($result->isSuccess()) {
	//act depending on $result->getReturnType()
    $gatewayReferenceId = $result->getReferenceId(); //store it in your database
    if ($result->getReturnType() == Result::RETURN_TYPE_ERROR) {
        //error handling
        $errors = $result->getErrors();
    } elseif ($result->getReturnType() == Result::RETURN_TYPE_REDIRECT) {
        //redirect the user
        header('Location: '.$result->getRedirectUrl());
    } elseif ($result->getReturnType() == Result::RETURN_TYPE_PENDING) {
        //payment is pending, wait for callback to complete
    } elseif ($result->getReturnType() == Result::RETURN_TYPE_FINISHED) {
        //payment is finished, update your cart/payment transaction

Status Request:


use DogeDev\AllSecure\Client;
use DogeDev\AllSecure\StatusApi\StatusRequestData;

$username = 'Your Username';
$password = 'Your password';
$apiKey = 'Connector API Key';
$sharedSecret = 'Connector Shared Secret';

require_once __DIR__ . '/vendor/autoload.php';

$client = new Client($username, $password, $apiKey, $sharedSecret);

$statusRequestData = new StatusRequestData();

// use either the UUID or your merchantTransactionId but not both

$statusResult = $client->sendStatusRequest($statusRequestData);

// dump all data 

// dump card data
$cardData = $statusResult->getreturnData();

// dump & echo error data
$errorData = $statusResult->getFirstError();

echo $errorData->getMessage();
echo $errorData->getCode();
echo $errorData->getAdapterCode();
echo $errorData->getAdapterMessage();