PHP code example of globalpayments / php-sdk

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

    

globalpayments / php-sdk example snippets


try {
    $response = $card->charge(129.99)
        ->withCurrency("EUR")
        ->execute();
} catch (BuilderException $e) {
    // handle builder errors
} catch (ConfigurationException $e) {
    // handle errors related to your services configuration
} catch (GatewayException $e) {
    // handle gateway errors/exceptions
} catch (UnsupportedTransactionException $e) {
    // handle errors when the configured gateway doesn't support
    // desired transaction
} catch (ApiException $e) {
    // handle all other errors
}

composer 

git clone https://github.com/globalpayments/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 == Success
    $message = $response->responseMessage; // [ test system ] AUTHORISED
} catch (ApiException $e) {
    // handle errors
}