PHP code example of paygateglobal / paygate-php

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

    

paygateglobal / paygate-php example snippets


    $paygate = new \Paygate\Paygate($auth_token);

    
    // Example to schedule payout API Method
    $response = $paygate->payNow(
        phone_number : "99000000",
        amount : 1000,
        identifier : "993",
        network : \Paygate\Network::FLOOZ,
        description : "My description", //Optionnal
    );
        

    // Example to schedule payout redirect Method
    $paygate->redirectPayNow(
        phone_number : "99000000", //Optionnal
        amount : 1000,
        identifier : "993",
        url : "http://exemple.com", //Optionnal
        description : "My description", //Optionnal
    );
        

switch ($response->status) {
    case \Paygate\TransactionStatus::SUCCESS
        //...
        break;
    case \Paygate\TransactionStatus::INVALID_TOKEN:
        //...
        break;
    case \Paygate\TransactionStatus::INVALID_PARAMS:
        //...
        break;
    case \Paygate\TransactionStatus::DOUBLONS:
        //...
        break;
    case \Paygate\TransactionStatus::INTERNAL_ERROR:
        //...
        break;
}
        

    // Verification with Paygate reference code
    $reponse = $paygate->verifyTransactionWithPaygateReference($tx_reference);

    // Verification with Ecommerce identifier
    $reponse = $paygate->verifyTransactionWithEcommerceId($identifier);

switch ($response->status) {
    case \Paygate\PaiementStatus::SUCCESS
        //...
        break;
    case \Paygate\PaiementStatus::PENDING:
        //...
        break;
    case \Paygate\PaiementStatus::EXPIRED:
        //...
        break;
    case \Paygate\PaiementStatus::CANCELED:
        //...
        break;
}
bash
    git clone https://github.com/Edouardsnipeur/paygate-php.git
bash

    composer