payrightmy / payment-php
Payright API PHP客户端
v1.0.0
2022-02-28 15:10 UTC
Requires
- php: ^7.2 || ^8.0
- guzzlehttp/guzzle: ^6.5|^7.0.1
- laravie/codex: ^5.1
- laravie/codex-common: ^1.5
- laravie/parser: ^2.0
- php-http/guzzle7-adapter: ^0.1.1
- php-http/multipart-stream-builder: ^1.0
Requires (Dev)
- codexpertmy/tests: ^1.0
- mockery/mockery: ^1.3
- phpstan/phpstan: ^1.3
- phpunit/phpunit: ^7.5 || ^8.4 || ^9.0
This package is auto-updated.
Last update: 2024-09-28 21:18:15 UTC
README
此包用于使用PHP与Payright支付API进行交互。
安装
您可以通过composer安装此包
composer require payrightmy/payment-php
基本用法
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->collections('v1') ->create([ 'name' => 'Collection name', 'status' => 'active' ]); echo $response->getStatusCode(); echo $response->getBody();
1. 创建账单
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->bills('v1') ->create([ 'collection' => '2Rjzopem', 'biller_name' => 'Muhammad Imran', 'biller_email' => 'imran@example.com', 'biller_mobile' => '60121234567', 'description' => 'Example bill description', 'amount' => 100, 'callback_url' => 'https://webhook.site/4370e625-4197-4059-911c-f4e16d6489f6', 'redirect_url' => 'https://example.com/redirect/', 'due_at' => '2021-12-01' ]); echo $response->getStatusCode(); echo $response->getBody();
2. 获取账单
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->bills('v1') ->get('7BeQgzGP'); echo $response->getStatusCode(); echo $response->getBody();
可用方法
- collections
- bills
- paymentchannel
- transactions
有关更多信息,请参阅我们的官方API参考
https://payright.stoplight.io/docs/api-reference/
测试
composer test
变更日志
请参阅CHANGELOG以获取最近更改的更多信息。
安全
如果您发现任何安全相关的问题,请通过电子邮件dev@payright.my联系,而不是使用问题跟踪器。