paygateglobal/paygate-php

PaygateGlobal的PHP Sdk

1.0.5 2023-10-20 03:57 UTC

This package is auto-updated.

Last update: 2024-09-12 09:44:18 UTC


README

原始文件

    git clone https://github.com/Edouardsnipeur/paygate-php.git

安装

使用composer

    composer require paygateglobal/paygate-php

初始化

生产环境

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

安排付款请求

EXAMPLE API方法

    
    // 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重定向方法

    // 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
    );
        

TRANSACTION $response 对象

TRANSACTION可能状态列表

TRANSACTION验证示例

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;
}
        

检索交易请求

EXAMPLE

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

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

TRANSACTION $response 对象

支付可能状态列表

TRANSACTION验证示例

switch ($response->status) {
    case \Paygate\PaiementStatus::SUCCESS
        //...
        break;
    case \Paygate\PaiementStatus::PENDING:
        //...
        break;
    case \Paygate\PaiementStatus::EXPIRED:
        //...
        break;
    case \Paygate\PaiementStatus::CANCELED:
        //...
        break;
}