taghwo / glade-bank-transfer-task

这提供了API,用于通过Glade Pay网关进行银行转账

dev-main 2021-02-21 14:05 UTC

This package is auto-updated.

Last update: 2024-09-21 21:34:51 UTC


README

本包执行两个功能

1. Initialize bank tranfer flow, returns account details to make payment to.
2. Verifies bank transfer status, returns status of payment.
Status code returned include
1: 401 for unauthenticated response
2: 400 for wrong method or wrong data format supplied
3: 500 for for invalid integration
Successful request will return an stdClass Object

安装

composer require taghwo/glade-bank-transfer-task
Create a .env file in the root on your project and set fill in details
Glade_Test_Merchant_ID=GP****
Glade_Test_Merchant_Key=123****
Glade_Test_Base_Endpoint: https://demo.api.gladepay.com/

在您的项目中包含autoload(PHP文件)

 require_once "vendor/autoload.php";

 Run composer dump-autoload

用法

初始化银行转账支付

Call the InitPayment class
use Taghwo\Glade\BankTransfer\Core\InitPayment;

Make an instance of the class
$bankTransfer = new InitPayment();

Request example
$response = $bankTransfer
            ->amountPayable('1500')
            ->customUserData(['email' => "jacky@example.com","firstname"=>"John", "lastname"=>"Doe"])
            ->execute();
print_r($response);

初始化支付的可用方法

有几种方法可以连在一起使用。

amountPayable() this sets the amount to charge for the transaction
Required:true
Throws InvalidData Exception if amount is not supplied
customUserData() takes an array of user data, this add more detail to the transaction. You can add first_name, last_name, email, IP address and fingerprint
Required:false
country() country to use for this transaction. If not supplied it, will be set to "NG"
Required:false
currency() currency to use for this transaction. If not supplied it, will be set to "NGN"
Required:false
execute() this executes the initialization process
Required:true
Response Example
( [status] => 202 [txnRef] => GP83015561620210221D [auth_type] => device [accountNumber] => 9922554842 [accountName] => GladePay Demo [bankName] => Providus Bank [accountExpires] => 600 [message] => Make a transfer into the following account using your bank app or internet banking platfrom to complete the transaction )

验证银行转账支付

Call the VerifyPayment class
use Taghwo\Glade\BankTransfer\Core\VerifyPayment;

Request example, it takes the transaction reference as argument

$verifyPayment = new VerifyPayment('txnRef');

$response = $verifyPayment
              ->execute();

print_r($response);

验证支付状态的可用方法

execute() this executes the verification process
Required:true
Response Example
( [status] => 200 [txnStatus] => pending [txnRef] => GP83015561620210221D [message] => PENDING [chargedAmount] => 0 [currency] => NG [payment_method] => bank_transfer [fullname] => John Doe [email] => jacky@example.com [bank_message] => Awaiting Validation )