yzh52521 / omnipay-alipay
Omnipay支付处理库的支付宝网关
dev-master
2023-06-21 07:37 UTC
Requires
- ext-bcmath: *
- ext-json: *
- ext-openssl: *
- omnipay/common: ^3.0
- php-http/guzzle7-adapter: ^1.0
Requires (Dev)
- omnipay/tests: ^3.0
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-09-21 10:27:37 UTC
README
Omnipay PHP支付处理库的支付宝驱动程序
Omnipay 是一个针对PHP的多网关支付处理库,不依赖于任何框架。此包实现了Omnipay的支付宝支持。
跨境支付宝支付请使用
lokielse/omnipay-global-alipay
安装
composer require lokielse/omnipay-alipay
基本用法
此包提供了以下网关
用法
购买
/** * @var AopAppGateway $gateway */ $gateway = Omnipay::create('Alipay_AopPage'); $gateway->setSignType('RSA2'); // RSA/RSA2/MD5. Use certificate mode must set RSA2 $gateway->setAppId('the_app_id'); $gateway->setPrivateKey('the_app_private_key'); $gateway->setAlipayPublicKey('the_alipay_public_key'); // Need not set this when used certificate mode $gateway->setReturnUrl('https://www.example.com/return'); $gateway->setNotifyUrl('https://www.example.com/notify'); // Must set cert path if you used certificate mode //$gateway->setAlipayRootCert('the_alipay_root_cert'); // alipayRootCert.crt //$gateway->setAlipayPublicCert('the_alipay_public_cert'); // alipayCertPublicKey_RSA2.crt //$gateway->setAppCert('the_app_public_cert'); // appCertPublicKey.crt //$gateway->setCheckAlipayPublicCert(true); /** * @var AopTradePagePayResponse $response */ $response = $gateway->purchase()->setBizContent([ 'subject' => 'test', 'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999), 'total_amount' => '0.01', 'product_code' => 'FAST_INSTANT_TRADE_PAY', ])->send(); $url = $response->getRedirectUrl();
有关一般使用说明,请参阅
相关
支持
如果您遇到Omnipay的一般问题,我们建议在 Stack Overflow 上发布帖子。请确保添加 omnipay标签 以便于查找。
如果您想了解最新发布公告、讨论项目想法或提出更详细的问题,还可以订阅一个 邮件列表。
如果您认为发现了错误,请使用 GitHub问题跟踪器 报告,或者最好是分叉库并提交拉取请求。