laraditz / payex
适用于Payex支付网关的简单Laravel包。
1.1.0
2024-01-25 19:43 UTC
Requires
- php: ^8.0
- illuminate/http: ^8.0|^9.0|^10.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-25 21:12:58 UTC
README
适用于Payex支付网关的简单Laravel包。
安装
您可以通过composer安装此包
composer require laraditz/payex
开始之前
在您的.env
中配置变量(推荐)或您可以将配置文件发布并更改它。
PAYEX_EMAIL=<your_payex_email_here>
PAYEX_KEY=<your_payex_key_here>
PAYEX_SECRET=<your_payex_secret_here>
PAYEX_SANDBOX_MODE=true # true or false for sandbox mode
(可选)您可以通过以下命令发布配置文件
php artisan vendor:publish --provider="Laraditz\Payex\PayexServiceProvider" --tag="config"
运行迁移命令以创建所需的数据库表。
php artisan migrate
可用方法
以下是此包下所有可用方法。
createPayment(array $requestPayload)
- 创建支付意向。getTransactions(array $params)
- 获取所有交易。getTransaction(string $id)
- 通过txn_id
获取特定交易。
用法
创建支付
要创建支付并获取重定向到的支付URL,您可以使用服务容器或外观。
// Create a payment // Using service container $payex = app('payex')->createPayment([ 'amount' => '100', //in cents 'customer_name' => 'Farhan', 'description' => 'some description here', 'return_url' => 'https://yourreturn.url' ]); // Using facade $payment = \Payex::createPayment([ 'amount' => '100', //in cents 'customer_name' => 'Farhan', 'description' => 'some description here', 'return_url' => 'https://yourreturn.url' ]);
返回示例
[ "status" => true, "id" => "991f24s0-5470-41c5-9b3c-9841d72d32e5", "ref_no" => "Xvs9k43y", "currency_code" => "MYR", "key" => "f5e3168fef3b5ed7826c689a37dce58e", "payment_url" => "https://api.payex.io/Payment/Form/f5e3168fef3b5ed7826c689a37dce58e" ]
重定向到payment_url
以继续Payex支付页面。完成后,您将被重定向到return_url
。以下是一个示例响应。
{ "amount": "1", "currency": "MYR", "customer_name": "Farhan", "description": "some description here", "reference_number": "Xvs9k43y", "mandate_reference_number": null, "payment_intent": "f5e3168fef3b5ed7826c689a37dce58e", "collection_id": "zg3RcR5y", "invoice_id": null, "txn_id": "PX1068201c1315547307", "external_txn_id": "20230502211212840110171535215420691", "response": "SUCCESS", "auth_code": "00", "auth_number": null, "txn_date": "20230502075957", "fpx_mode": null, "fpx_buyer_name": null, "fpx_buyer_bank_id": null, "fpx_buyer_bank_name": null, "card_holder_name": null, "card_number": null, "card_expiry": null, "card_brand": "N.A.", "card_issuer": null, "card_on_file": null, "signature": "bcd39079a409751ebb4c64c1f8acc53cd0439896a731a513b6753e9f909d6a08a79a04cd5a9cf8d6d27d93206dfa35074ee607e790e242ee547407fa5af9f05a", "txn_type": "Touch 'n Go eWallet", "nonce": "eMygaAdk3cryXM5DSLoidNIQrwhW7b0wCmQ6CG0B6z5VNeBbm8yXhLjAPQcXL0WL", "metadata": "{}" }
事件
此包还提供一些事件,允许您的应用程序监听它。您可以在以下事件下创建您的监听器并注册它。
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全
如果您发现任何安全问题,请通过raditzfarhan@gmail.com发送电子邮件,而不是使用问题跟踪器。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。