liushoukun/omnipay-alipay

Omnipay支付处理库的支付宝网关

此包的规范仓库似乎已丢失,因此该包已被冻结。


README

travis Latest Version on Packagist Total Downloads Code Coverage Software License

Omnipay PHP支付处理库的支付宝驱动程序

Omnipay 是一个与框架无关、多网关的PHP支付处理库。此包实现了Omnipay的支付宝支持。

跨境支付宝支付请使用 lokielse/omnipay-global-alipay

旧版请使用 "lokielse/omnipay-alipay": "dev-legacy"

安装

composer require lokielse/omnipay-alipay

基本用法

此包提供以下网关

网关 描述 说明   链接
Alipay_AopPage 支付宝页面网关 电脑网站支付 - new 使用 文档
Alipay_AopApp 支付宝APP网关 APP支付 - new 使用 文档
Alipay_AopF2F 支付宝面对面网关 当面付 - new 使用 文档
Alipay_AopWap 支付宝WAP网关 手机网站支付 - new 使用 文档
Alipay_AopJs 支付宝JS网关 JSAPI - new 使用 文档
Alipay_LegacyApp 支付宝旧版APP网关 APP支付 使用 文档
Alipay_LegacyExpress 支付宝旧版即时到账网关 即时到账 使用 文档
Alipay_LegacyWap 支付宝旧版WAP网关 手机网站支付 使用 文档

使用

购买 (购买)

/**
 * @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 标签,以便更容易被找到。

如果您想了解最新发布公告、讨论项目想法或提出更详细的问题,还可以订阅一个 邮件列表

如果您认为发现了bug,请使用 GitHub 问题跟踪器 报告它,或者更好的方法是fork该库并提交一个pull request。