1.5 2020-07-29 09:54 UTC

This package is auto-updated.

Last update: 2024-09-29 05:28:57 UTC


README

Remita 间银行转账服务的 Laravel 包

先决条件

  • 在 Remita 平台上注册为商户/发票人。
  • 从 Remita 获取您的凭证,例如商户 ID、API 密钥等。

安装

打开您的终端或命令提示符,转到您的 Laravel 项目的根目录,然后运行以下命令

composer require mojoblanco/rits

用法

设置凭证

要使用任何可用的服务,您首先需要设置您的凭证

use Mojoblanco\RITS\Models\Credential;

$credentials = Credential();
$credentials->merchantId = $merchantId;
$credentials->apiKey = $apiKey;
$credentials->apiToken = $apiToken;
$credentials->key = $key;
$credentials->iv = $iv;
$credentials->environment = 'DEMO'; //Can either be LIVE or DEMO

可用服务

批量支付

use Mojoblanco\RITS\RITSService;
use Mojoblanco\RITS\Models\BulkBeneficiary;

// Build the list of your beneficiaries
$beneficiaries = [];

for ($i = 0; $i < 10; $i++) {
    $bb = new BulkBeneficiary($iv, $key);
    $bb->amount = 100;
    $bb->accountNumber = '0582915208015';
    $bb->bankCode = '058';
    $bb->email = 'test@mail.com';
    $bb->narration = 'Test payment';
    $bb->transRef = rand(); // Make sure it is something you can track.

    array_push($beneficiaries, $bb);
}

// Call the bulk payment service
$bp = new BulkPayment($iv, $key);
$bp->batchRef = '12345678987654321';
$bp->debitAccount = '1234565678'
$bp->bankCode = '044'
$bp->narration = 'Test bulk payment'
$bp->beneficiaries = $beneficiaries;

$service = new RITSService($credentials);
$response = $service->makeBulkPayment($bp);

批量支付状态

use Mojoblanco\RITS\RITSService;
use Mojoblanco\RITS\Models\PaymentStatus;

$ps = new PaymentStatus($iv, $key);
$ps->reference = $reference;

$service = new RITSService($credentials);
$response = $service->getBulkPaymentStatus($ps);

如何感谢我?

您可以通过点赞此仓库,在 github 上关注我,以及在 twitter 上关注我

谢谢。 🙂