itsfaqih / faspay
非官方Faspay SDK
0.5.0
2022-07-10 15:22 UTC
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.4
- myclabs/php-enum: ^1.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- pestphp/pest: ^1.20
- spatie/ray: ^1.28
This package is auto-updated.
Last update: 2024-09-09 03:07:17 UTC
README
安装
您可以通过composer安装此包
composer require itsfaqih/faspay
使用方法
配置凭据和客户端。
use ItsFaqih\Faspay\Client; use ItsFaqih\Faspay\Entities\User; use ItsFaqih\Faspay\Enums\Environment; $user = new User('bot98765', 'p@ssw0rd', '98765', 'FASPAY'); $faspayClient = new Client($user, Environment::DEVELOPMENT());
支付渠道查询
$faspayClient->paymentChannelInquiry();
提交数据交易
use ItsFaqih\Faspay\Entities\Bill; use ItsFaqih\Faspay\Entities\BillItem; use ItsFaqih\Faspay\Entities\Customer; use ItsFaqih\Faspay\Entities\Payment; use ItsFaqih\Faspay\Enums\PaymentChannel; use ItsFaqih\Faspay\Enums\PaymentType; $bill = new Bill('TRX-123', new \DateTime(), (new \DateTime())->modify('+1 day'), 'Red Shoes with special price', '250000'); $payment = new Payment(PaymentChannel::LINKAJA(), PaymentType::FULL_SETTLEMENT()); $customer = new Customer('001', 'John Smith', '08123456789', 'john.smith@example.com'); $item = new BillItem('Red Shoes', 1, '250000'); $faspayClient->postDataTransaction($bill, $payment, $customer, [$item]);
查询支付状态
$trxId = '9876530200004184'; $billNo = 'TRX-123'; $faspayClient->inquiryPaymentStatus($trxId, $billNo);
取消交易
$trxId = '9876530200004184'; $billNo = 'TRX-123'; $reason = 'Wrong order'; $faspayClient->cancelTransaction($trxId, $billNo, $reason);
测试
composer test
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。