支付宝
- 应用签名是不变的,只要密钥对没变
- https://opendocs.alipay.com/open/270/105898?pathHash=b3b2b667
支付状态¶
- https://opendocs.alipay.com/support/01raw9?pathHash=1185bf61
- TradeStatusClosed
type TradeStatus string const ( TradeStatusWaitBuyerPay TradeStatus = "WAIT_BUYER_PAY" //(交易创建,等待买家付款) TradeStatusClosed TradeStatus = "TRADE_CLOSED" //(未付款交易超时关闭,或支付完成后全额退款) TradeStatusSuccess TradeStatus = "TRADE_SUCCESS" //(交易支付成功) TradeStatusFinished TradeStatus = "TRADE_FINISHED" //(交易结束,不可退款) )
如¶
- notify可能比return先,比如早9s
- trade_no:支付平台订单号
- out_trade_no:商家订单号
return¶
支付服务重定向让浏览器发起的请求,参数在query里。
{
"app_id": "202111111111111111",
"auth_app_id": "2021111111111111111",
"charset": "utf-8",
"method": "alipay.trade.page.pay.return",
"out_trade_no": "387d6ffxxxxxxxxxxxxxx",
"seller_id": "208xxxxxxxxxxx",
"sign": "l7mWxLyV29SBSsNxr7zF2kgEwl7IKCibeHMk+S/xxxxxxxxxxxxx",
"sign_type": "RSA2",
"timestamp": "2026-03-20 10:48:51",
"total_amount": "0.01",
"trade_no": "2026032022001421591406846538",
"version": "1.0"
}
notify¶
-
application/x-www-form-urlencoded
{ "app_id": "202111111111111111", "auth_app_id": "2021111111111111111", "body": "OMIRead 会员 1个月", "buyer_id": "208xxxxxxwwwww", "buyer_pay_amount": "0.01", "charset": "utf-8", "fund_bill_list": "[{\"amount\":\"0.01\",\"fundChannel\":\"ALIPAYACCOUNT\"}]", "gmt_create": "2026-03-20 10:47:14", "gmt_payment": "2026-03-20 10:48:45", "invoice_amount": "0.01", "notify_id": "2026032001222104111111111111111111111", "notify_time": "2026-03-20 10:48:46", "notify_type": "trade_status_sync", "out_trade_no": "387d6ffxxxxxxxxxxxxxx", "point_amount": "0.00", "receipt_amount": "0.01", "seller_id": "208xxxxxxxxxxx", "sign": "l7mWxLyV29SBSsNxr7zF2kgEwl7IKCibeHMk+S/xxxxxxxxxxxxxwwwwwwwwww", "sign_type": "RSA2", "subject": "会员 1个月", "total_amount": "0.01", "trade_no": "2026032022001421591406846538", "trade_status": "TRADE_SUCCESS", "version": "1.0" } -
notify对象
{ "auth_app_id": "202111111111111111", "notify_time": "2026-03-20 11:09:20", "notify_type": "trade_status_sync", "notify_id": "2026032001222104111111111111111111111", "app_id": "202111111111111111", "charset": "utf-8", "version": "1.0", "sign_type": "RSA2", "sign": "l7mWxLyV29SBSsNxr7zF2kgEwl7IKCibeHMk+S/xxxxxxxxxxxxxwwwwwwwwww", "trade_no": "20260320220014111111111111111", "out_trade_no": "387d6ffxxxxxxxxxxxxxx", "out_request_no": "", "out_biz_no": "", "buyer_id": "208xxxxxxwwwww", "buyer_logon_id": "", "buyer_open_id": "", "seller_id": "208xxxxxxxxxxx", "seller_email": "", "trade_status": "TRADE_SUCCESS", "refund_status": "", "refund_reason": "", "refund_amount": "", "total_amount": "0.01", "receipt_amount": "0.01", "invoice_amount": "0.01", "buyer_pay_amount": "0.01", "point_amount": "0.00", "refund_fee": "", "subject": "会员 1个月", "body": "OMIRead 会员 1个月", "gmt_create": "2026-03-20 11:08:18", "gmt_payment": "2026-03-20 11:09:19", "gmt_refund": "", "gmt_close": "", "fund_bill_list": "[{\"amount\":\"0.01\",\"fundChannel\":\"ALIPAYACCOUNT\"}]", "passback_params": "", "voucher_detail_list": "", "agreement_no": "", "external_agreement_no": "", "dback_status": "", "dback_amount": "", "bank_ack_time": "", "send_back_fee": "" }