PHP code example of addonpayments / php-sdk

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

    

addonpayments / php-sdk example snippets


try {
    $response = $card->charge(129.99)
        ->withCurrency("EUR")
        ->execute();
} catch (BuilderException $e) {
    // Errores del constructor
} catch (ConfigurationException $e) {
    // Errores referentes a la configuración de los servicios
} catch (GatewayException $e) {
    // Errores/excepciones de la pasarela de pagos
} catch (UnsupportedTransactionException $e) {
    // Manejar errores cuando la pasarela de pagos no soporta el tipo de transacción
} catch (ApiException $e) {
    // Manejar otros errores
}

composer 

git clone https://github.com/addonpayments/php-sdk
csharp
$card = new CreditCardData();
$card->number = "4111111111111111";
$card->expMonth = "12";
$card->expYear = "2025";
$card->cvn = "123";

try {
    $response = $card->charge(129.99)
        ->withCurrency("EUR")
        ->execute();

    $result = $response->responseCode; // 00 == Autorizado
    $message = $response->responseMessage; // [ sistema de pruebas ] AUTHORISED
} catch (ApiException $e) {
    // Manejar errores
}