支付宝全球版第三方 SDK,支持授权和自动扣款。支付宝国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单。
支付宝全球版第三方 SDK,支持授权和自动扣款。支付宝国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单。
This project is based on Alipay Global Offical PHP SDK
Since official SDK mainly shows how to access the alipay gateway and does not contain complete functions such as authorization and auto debit, I have added some logic and further realized the standard interface of Alipay Global A+
0.0.3+: sendNotifyResponse sendNotifyResponseWithRSA are methods of $notify, eg:
$notify = $alipayGlobal->getNotify();
$notify->sendNotifyResponse(); // $alipayGlobal->sendNotifyResponse() is desprecated
$notify->sendNotifyResponseWithRSA(); // $alipayGlobal->sendNotifyResponseWithRSA() is desprecated
/* getNotifyResponse and getNotifyResponseWithRSA are added,
so you can process it by yourself in memory frameworks like Webman */
$notifyResponseWithRSA = $notify->getNotifyResponse();
$notifyResponseWithRSA = $notify->getNotifyResponseWithRSA();
The use and functionality of the SDK have been shown with Examples in the project folder
composer require mantoufan/alipay-global-sdk-php
$alipayGlobal = new Mantoufan\AliPayGlobal(array(
'client_id' => 'SANDBOX_5Y3A2N2YEB3002022', // Client ID
'endpoint_area' => 'ASIA', // Optional: NORTH_AMERIA / ASIA / EUROPE
'merchantPrivateKey' => '', // Merchant Private Key
'alipayPublicKey' => '', // Alipay Public Key
'is_sandbox' => true, // Whether to use the Sandbox environment
));
Required fields will be mark with *
API: ac/ams/payment_cashier
DEMO: pay/cashier
…
API: ac/ams/authconsult
DEMO: auth/consult
…
API: ac/ams/accesstokenapp
DEMO: auth/apply_token/auth_code
…
API: ac/ams/accesstokenapp
DEMO: auth/apply_token/refresh_token
…
API: ac/ams/payment_agreement
DEMO: pay/agreement
…
API: ac/ams/paymentrn_online
DEMO: notify
…
API: ac/ams/notifyauth
DEMO: notify/auth/auth_code
…
API: ac/ams/refund_online
DEMO: refund/refund_online
try {
$result = $alipayGlobal->sendRefund(array(
'paymentId' => '20181129190741010007000000XXXX', // Unique ID assigned by Alipay for the original payment to be refunded.
'refundRequestId' => 'S7mMoYxQxWjJDWwm2NG4WxmNbM5z3GvSB6PEPvMeYP21PQUtrX9hXlgbQMajt2on', // Unique ID assigned by the merchant to identify a refund request.
'refundAmount' => array(
'currency' => 'USD', // Currency of refund
'value' => '100', // Amount of refund
)
));
var_dump($result);
} catch (Exception $e) {
echo $e->getMessage();
}
DEMO: return
/** Return immediately after payment or authorization
* After Payment, user will be redirected only
* After Authorization, user will be redirected with authCode
* Suggestion: The Return URL is only used as a reminder
* It's beter to process business in asynchronous payment notification and asynchronous authorization notification
**/
echo 'Payment Or Authorization completed';
暂无开放 Issues,或尚未同步最近议题。