myfatoorah / omnipay
MyFatoorah支付处理库的驱动程序
v3.2.1
2021-06-05 11:34 UTC
Requires
- php: ^7.2|^8.0
- omnipay/common: ^3.1
- php-http/discovery: ^1.14
- php-http/guzzle7-adapter: ^1
Requires (Dev)
- omnipay/tests: ^3|^4
- dev-master
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v3.0-alpha.1
- 2.3.x-dev
- 2.3.2
- v2.3.1
- v2.3.0
- v2.1.0
- v2.0.0
- 1.1.x-dev
- v1.1.0
- 1.0.x-dev
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.1
- v0.6.0
- dev-feat-php8
- dev-feat/add-tests
- dev-barryvdh-travis-73_74
- dev-guzzle6-adapter-v2
- dev-judgej-patch-1
- dev-delatbabel-patch-1
This package is not auto-updated.
Last update: 2024-09-23 02:26:52 UTC
README
MyFatoorah网关集成,适用于Omnipay PHP支付处理库
简介
Omnipay是一个不依赖于框架、多网关的PHP 5.3+支付处理库。此包实现了Omnipay对acapture的支持。
安装
要安装,您可以使用composer添加此包;
$ composer require myfatoorah/omnipay
您也可以直接在composer.json
文件中包含此包
{
"require": {
"myfatoorah/omnipay": "dev-master"
}
}
用法
创建支付链接
use Omnipay\Omnipay; $data = array(); $data['Amount'] = '50'; $data['OrderRef'] = 'orderId-123'; $data['Currency'] = 'KWD'; $data['returnUrl'] = 'http://websiteurl.com/callback.php'; $data['Card']['firstName'] = 'fname'; $data['Card']['lastName'] = 'lname'; $data['Card']['email'] = 'test@test.com'; // // Do a purchase transaction on the gateway $transaction = $gateway->purchase($data)->send(); if ($transaction->isSuccessful()) { $invoiceId = $transaction->getTransactionReference(); echo "Invoice Id = " . $invoiceId . "<br>"; $redirectUrl = $transaction->getRedirectUrl(); echo "Redirect Url = <a href='$redirectUrl' target='_blank'>" . $redirectUrl . "</a><br>"; } else { echo $transaction->getMessage(); }
检查支付状态
在回调中,获取特定支付ID的支付状态
$callBackData = ['paymentId' => '100202113817903101']; // or $callBackData = ['invoiceid' => '75896']; $callback = $gateway->completePurchase($callBackData)->send(); if ($callback->isSuccessful()) { echo "<pre>"; print_r($callback->getPaymentStatus('orderId-123', '100202113817903101')); } else { echo $callback->getMessage(); }
进行退款
退款特定支付ID
$refundData = ['paymentId' => '100202113817903101', 'Amount'=>1]; $refund = $gateway->refund($refundData)->send(); if ($refund->isSuccessful()) { echo "<pre>"; print_r($refund->getRefundInfo()); } else { echo $refund->getMessage(); }