fruitcakestudio / omnipay-pesapal
Pesapal Omnipay网关
Requires
- php: >=5.3.0
- eher/oauth: ^1.0.6
- omnipay/common: ~2.4
Requires (Dev)
- omnipay/tests: ~2.0
- scrutinizer/ocular: ~1.1
This package is auto-updated.
Last update: 2024-09-11 09:15:34 UTC
README
Omnipay PHP支付处理库的骨架网关
Omnipay 是一个与框架无关的多网关支付处理库,适用于 PHP 5.3+。本软件包实现了 Omnipay 的 pesapal 支持。
请在这里添加您的描述。尽量限制在一到两段话内,并提及您支持的 PSR 以避免用户和贡献者的混淆。
安装
通过 Composer
$ composer require fruitcakestudio/omnipay-pesapal:"1.x@alpha"
用法
本软件包提供以下网关
- Pesapal
有关一般用法说明,请参阅主要的 Omnipay 仓库。
示例
bootstrap.php
require 'vendor/autoload.php'; $gateway = \Omnipay\Omnipay::create('Pesapal'); $gateway->initialize(array( 'key' => 'your-consumer-key', 'secret' => 'your-consumer-secret', 'testMode' => false, ));
purchase.php
require 'bootstrap.php'; // Make a purchase request $response = $gateway->purchase(array( 'amount' => "6.84", 'description' => "Testorder #1234", 'currency' => 'USD', 'card' => array( 'email' => 'barry@fruitcakestudio.nl', 'firstName' => 'Barry', 'lastName' => 'vd. Heuvel', 'phone' => '+1234567890', ), 'returnUrl' => 'http://my-domain.com/return.php', ))->send(); $transactionId = $response->getTransactionId(); if ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); } else { // payment failed: display message to customer echo "Error " .$response->getCode() . ': ' . $response->getMessage(); }
return.php
require 'bootstrap.php'; // Check the payment status $response = $gateway->completePurchase()->send(); // Show status to user if ($response->isSuccessful()) { echo "Transaction '" . $response->getTransactionId() . "' succeeded!"; } else { echo "Status: " .$response->getCode() . ': ' . $response->getMessage(); }
notify.php
require 'bootstrap.php'; // Check the payment status $response = $gateway->completePurchase()->send(); $reference = $response->getTransactionReference(); // TODO; Check the reference/id with your database $transactionId = $response->getTransactionId(); if($response->isSuccessful()){ // Save state } // Return message for the gateway echo $response->getNotificationMessage(); // Or ->getNotificationResponse() for Symfony Response
交易引用为 pesapal_transaction_tracking_id
,由 Pesapal 设置。交易ID是您的ID(pesapal_merchant_reference
),如果没有提供,则将生成。
请参阅 http://developer.pesapal.com/how-to-integrate/step-by-step 上的文档
沙盒/演示
当您将 testMode
设置为 true
时,将使用 Demo sandbox。
您需要不同的消费者密钥/密钥。按照以下步骤使用 testMode
- 在 http://demo.pesapal.com/ 上创建一个 business 账户
- 登录到您的演示账户,密钥/密钥在仪表板上。
- 开始交易,并 发送虚拟货币
- 使用相同的手机号码(例如
700123456
)和金额。提交后复制确认码。
支持
如果您在使用 Omnipay 时遇到一般问题,我们建议您在 Stack Overflow 上发帖。请确保添加 omnipay 标签,以便更容易找到。
如果您想了解发布公告,讨论项目的想法或提出更详细的问题,还有一个您可以订阅的 邮件列表。
如果您认为您发现了一个错误,请使用 GitHub 问题跟踪器 报告它,或者更好的是,分叉库并提交拉取请求。
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
测试
$ composer test
贡献
请参阅 CONTRIBUTING 以获取详细信息。
安全性
如果您发现任何安全相关的问题,请通过电子邮件 info@fruitcake.nl 而不是使用问题跟踪器。
鸣谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。