支付宝开放平台

  • Post author:
  • Post category:其他


开放平台:https://openhome.alipay.com

创建应用:

创建应用:

添加能力:批量签约,到商家中心-账号中心-APPID绑定-添加绑定APPID;

APP支付:

消息服务:


​​​​​​生成密钥


1,密钥工具:生成应用私钥-应用公钥;2,填写公钥字符-生成对应支付宝公钥

接口加签方式:设置

接口加签方式:查看-> 加签变更

上线:


=> 可以测试啦。。。。。。。。。。。。。。。。。。。。。。。。

——————————————————————

登录-支付宝:https://mrchportalweb.alipay.com/user/home 商家中心

https://business.alipay.com/user/home



立即购买-提交订单-支付:POST /api/order/add

Param:

‘user_id’ = ’56aa4b85bf5c25c58b07d8e96c04d5cb’

‘product_sn’ = ‘0c441e84213eb6fd7c3d7c4265b79b04’

‘attr_value_id’ = ‘15139’

‘address_id’ = ‘f70a8c18e2691b1d865a4ab932fb57b7’

‘buy_num’ = ‘1’

‘pay_type’ = ‘1’

‘token’ => ‘7a3cd895751dbdf4a095bc6c091c285a’

1,创建订单,业务处理

2,对接alipay_sdk

NotifyUrl: 
    http://host/api/notify/orderalipay
Bizcontent:
    {
        "body":"配送中心",
        "subject": "配送中心",
        "out_trade_no": "202111209cnm55",
        "timeout_express": "30m",
        "total_amount": "0.1",
        "product_code":"QUICK_MSECURITY_PAY"
    }
Return:
{
    "error_code": 0,
    "reason": "202111209cnm55",
    "result": "alipay_sdk=alipay-sdk-php-20161101&app_id=2021002146696679&biz_content=***out_trade_no*****total_amount%22%3A+%220.10%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fhost%2Fapi%2Fnotify%2Forderalipay&sign_type=RSA2&timestamp=2021-11-20+15%3A49%3A30&version=1.0&sign=QtLNMAMQgh4Dt6PqpdayYauQgK8MW304WXP%2F4kVjtjpykGirG4dh1ZTXs2nM1kNCNVa3FD7%2F%2BKOwAeLkeQKjZhpIks96sR7%2FGMdwpdUsH3PWGX%2Fq9vw8uzF2sCVo2c8ndQP6OlQ0vE2jAz3UBwGCDNaasch1C%2F2YTVSpstup2tSFmjhWTYJbehI3bnIXok9efN%2F68yWOgjtkoKnALQVDOELZPB%2F2oKg%2Fr7GYRGB6DP00lCsLDCtPhQ1ZPqVvoWVHwUdc8Z41wVGkBedEPWkThBGII%2FcvQkztMWo5KK%2FAhHUPJEdboXXYFdrg0Si8JSF1YsS8uB%2B3ioUGHwzxHXMQog%3D%3D"
}


【稍后支付】:POST /api/order/alipay

Param:

“shopname”=”配送中心”

“union_sn”=”202111209cnm55”

“payprice”=”0.10”

“token”=”7a3cd895751dbdf4a095bc6c091c285a”

{
    "error_code": 0,
    "reason": "202111209cnm55",
    "result": "alipay_sdk=alipay-sdk-php-20161101&app_id=2021002146696679&biz_content=***out_trade_no*****total_amount%22%3A+%220.10%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fhost%2Fapi%2Fnotify%2Forderalipay&sign_type=RSA2&timestamp=2021-11-20+15%3A49%3A30&version=1.0&sign=QtLNMAMQgh4Dt6PqpdayYauQgK8MW304WXP%2F4kVjtjpykGirG4dh1ZTXs2nM1kNCNVa3FD7%2F%2BKOwAeLkeQKjZhpIks96sR7%2FGMdwpdUsH3PWGX%2Fq9vw8uzF2sCVo2c8ndQP6OlQ0vE2jAz3UBwGCDNaasch1C%2F2YTVSpstup2tSFmjhWTYJbehI3bnIXok9efN%2F68yWOgjtkoKnALQVDOELZPB%2F2oKg%2Fr7GYRGB6DP00lCsLDCtPhQ1ZPqVvoWVHwUdc8Z41wVGkBedEPWkThBGII%2FcvQkztMWo5KK%2FAhHUPJEdboXXYFdrg0Si8JSF1YsS8uB%2B3ioUGHwzxHXMQog%3D%3D"
}


AliPay回调:POST /api/notify/orderalipay

'gmt_create' => '2021-11-20 15:11:33',
'charset' => 'UTF-8',
'seller_email' => 'footstep@163.com',
'subject' => '配送中心',
'sign' => 'KDWeGo5yMrjtj/xfBgi9JMensm5oEFgidxEQlEEEMUdqWsIyi/hXI6pE/pV9WCPRFWXPnHd/PewkTRTA6RVKAoQIfTIGThBKPL8woxKrODk7C1ioY02fgyMvwh+cANR1WjfWESK27JX/lnQMOo1cTLOs+IJazLbAhPH0IJZYeFSc4egZk/wwkVX2q9l7Kh9JnlvPpFkwzc1vG7WwbfW4zMivLJXqqBctdU/ypORivaq/mcXx63D6LcMcxN27u0+Yk00tnD4Z+6npOg66vlH3I6v5nDteHCWpKObnKISez85/zZgaPn/jvhoNpAhiPGxzsccFhhhEXzcyk1Btokcogw==',
'body' => '配送中心',
'buyer_id' => '2088212636652212',
'invoice_amount' => '0.10',
'notify_id' => '2021112000222141134052211407352722',
'fund_bill_list' => '[{"amount":"0.10","fundChannel":"PCREDIT"}]',
'notify_type' => 'trade_status_sync',
'trade_status' => 'TRADE_SUCCESS',
'receipt_amount' => '0.10',
'app_id' => '2021002146696978',
'buyer_pay_amount' => '0.10',
'sign_type' => 'RSA2',
'seller_id' => '2088141101549482',
'gmt_payment' => '2021-11-20 15:11:33',
'notify_time' => '2021-11-20 15:11:34',
'version' => '1.0',
'out_trade_no' => '202111209cnm55',
'total_amount' => '0.10',
'trade_no' => '2021112022001452211426590331',
'auth_app_id' => '2021002146696679',
'buyer_logon_id' => '188****6978',
'point_amount' => '0.00',

$flag = $aop->rsaCheckV1($_POST, NULL, $signType);
// 业务处理
return 'success';


退款:POST /api/order/refund

Param:

‘order_sn’ => ‘20211120173931’

‘token’ => ‘7a3cd895751dbdf4a095bc6c091c285a’

{
    "alipay_trade_refund_response":{
        "code":"10000",
        "msg":"Success",
        "buyer_logon_id":"188******78",
        "buyer_user_id":"2088212636652212",
        "fund_change":"Y",
        "gmt_refund_pay":"2021-11-20 15:26:02",
        "out_trade_no":"20211120IAxz22",
        "refund_fee":"0.10",
        "send_back_fee":"0.00",
        "trade_no":"2021112022001452211426590331"
    },
    "sign":"Acjge41g89fcoIxSoay9zaTj9gFKoXXEMOGBfJfy6OcroGxDXr59y2eNuMTyJZkdmpUSQa4LWofItgM04DKJXEcnY3m\/d3sHM4+s4T93nSEOJzaL6M0Yv+y4uipUeslIxiZarXleLbihoxsw4cvTyCDDx06CFNJkpGlBKiCgQvmHnKYZmMT0HZgtfwKEAcBozzjAEhhyORVIJGTHXIZeK\/MDzgBNWIR0LIxyWQtrkG9VY2jJ0CVGKmzycKy7rewd9HAr+bAEoj3fFA28eBT5bD3Jf09aPzpNeMRmEltsuDOInGGGvTq61h4T+BQpX9P43Ybzi503AMREtvXm\/9T3Gw=="
}
// 业务处理


AliPay回调:POST /api/notify/orderalipay


'gmt_create' => '2021-11-20 16:11:33',
'charset' => 'UTF-8',
'seller_email' => 'footstep@163.com',
'subject' => '配送中心',
'sign' => 'S8roOC2yl0QpUkIFrB0btWnOGCMsYiQ4IXvvHzLLrjwPnGGyENoxhSiazmaPvorvyYZ8c2wRqUk3d8vyixRYxABdRday/OleoqXXLLSCW2YtP71QLKXc3N5qcnqAEV1ZwgvU/r4SBajVppPHvvy5OMTNAiJLvMSpoz/OuzLwy+WVO++TjX+ZFXH0TJJ1dD9ck/W33P4AFSa9V1eEvNu5zVXOz9Zi6oy25WVxjsvZlVb7Dne3czRqnetQh3EbUawkhaM3/t6cfedRhJV65Ql4x4OGA/KreMeawMfjh7YFCB+tvPw6fxAxFRgerwhM+qWi3zw9jG9sIQlMSvB4KP80oQ==',
'body' => '配送中心',
'buyer_id' => '2088212636652212',
'notify_id' => '2021112000222142603052211407305666',
'notify_type' => 'trade_status_sync',
'trade_status' => 'TRADE_CLOSED',
'app_id' => '2021002146696978',
'sign_type' => 'RSA2',
'seller_id' => '2088141101549482',
'gmt_payment' => '2021-11-20 16:11:33',
'notify_time' => '2021-11-20 16:26:03',
'gmt_refund' => '2021-11-20 16:26:02.637',
'out_biz_no' => '202111209cnm55',
'version' => '1.0',
'out_trade_no' => '202111209cnm55',
'total_amount' => '0.10',
'refund_fee' => '0.10',
'trade_no' => '2021112022001452211426590331',
'auth_app_id' => '2021002146696978',
'gmt_close' => '2021-11-20 16:26:02',
'buyer_logon_id' => '188****6978',



版权声明:本文为m0_38027358原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。