百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

alipay-global-sdk-php

> 编程语言
开源

支付宝全球版第三方 SDK,支持授权和自动扣款。支付宝国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单。

392 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

支付宝全球版第三方 SDK,支持授权和自动扣款。支付宝国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单。

Alipay Global SDK PHP

Alipay Global A+ SDK

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+

Attention!

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();

Demo

The use and functionality of the SDK have been shown with Examples in the project folder

Use

composer require mantoufan/alipay-global-sdk-php

How to use

Initialize

$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 *

Online payment - Payment - Pay (Cashier Payment)

API: ac/ams/payment_cashier
DEMO: pay/cashier

…

Online Payment - Authorization - Consult

API: ac/ams/authconsult
DEMO: auth/consult

…

Online Payment - Authorization - ApplyToken - Using AuthCode

API: ac/ams/accesstokenapp
DEMO: auth/apply_token/auth_code

…

Online Payment - Authorization - ApplyToken - Using RefreshToken

API: ac/ams/accesstokenapp
DEMO: auth/apply_token/refresh_token

…

Online payment - Payment - Pay (Auto Debit)

API: ac/ams/payment_agreement
DEMO: pay/agreement

…

Online payment - Payment - NotifyPayment

API: ac/ams/paymentrn_online
DEMO: notify

…

Online Payment - Authorization - NotifyAuthorization

API: ac/ams/notifyauth
DEMO: notify/auth/auth_code

…

Online Payment - Refund - Refund

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();
}

Return Url

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· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPalipaypaymentsdk

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言