Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

How can we help?

BACK

What are the format requirements for setting notify_url?

Question:

Any tips for format of notify_url configuration?

Background:

If we configure notify_url as path+query format, it will lead to different target url for Alipay server to send asynchronous notification and inaccurate body content of asynchronous notification in the meanwhile. For instance: If we configure notify_url as 'notify_url=https://baid.shop.rdc.like.com/index.php?r=JwAlipay/notify_url', Alipay server will take only 'notify_url=https://baid.shop.rdc.like.com/index.php' as target url to send asynchronous notification. Besides, 'r=JwAlipay/notify_url' from original desired url would be considered as part of body content of asynchronous notification like below highlighted part:

POST[https://baid.shop.rdc.like.com/index.php|122.112.158.230|200|1014ms|utf-8]: https://baid.shop.rdc.like.com/index.php?r=JwAlipay/notify_url¬ify_id=2020042000222134746071970505373170¬ify_type=trade_status_sync&sign=f67d2631715c3b1b4cc63572fa9350a5&trade_no=2020042022001371970501224430&total_fee=62.02&out_trade_no=CB20200420006¬ify_time=2020-04-20 13:47:46¤cy=USD&trade_status=TRADE_FINISHED&sign_type=MD5

Suggested Solution:

Suggest to configure notify_url as path+ format only, i.e.'notify_url= https://baid.shop.rdc.like.com/notify_url.php', in this way. Alipay server will take 'https://baid.shop.rdc.like.com/notify_url.php' as target url to send asynchronous notification. And body content of asynchronous notification will be original asynchronous notification data from Alipay server like below highlighted part:

POST[https://baid.shop.rdc.like.com/notify_url.php|122.112.158.230|200|151ms|utf-8]: https://baid.shop.rdc.like.com/notify_url.php?notify_id=2020042000222143538071970505382098¬ify_type=trade_status_sync&sign=b6b3b9b9bc9028aa643f3c95842d63f2&trade_no=2020042022001371970501224673&total_fee=62.02&out_trade_no=CB20200420008¬ify_time=2020-04-20 14:38:48¤cy=USD&trade_status=TRADE_FINISHED&sign_type=MD5


问题:

配置支付宝异步通知地址时notify_url地址格式需要注意什么?

背景:

notify_url地址配置时地址如果带有path+query格式的形式,会对后续支付宝系统发送异步通知时接收通知的实际地址和接收到的通知内容有所影响。举例说明:

当notify_url=https://baid.shop.rdc.like.com/index.php?r=JwAlipay/notify_url为这种格式的话,

支付宝系统将只截取notify_url=https://baid.shop.rdc.like.com/index.php为异步通知接收目标发送异步通知,而原本地址中r=JwAlipay/notify_url则被系统读取到了异步通知的内容,如下方示例加粗字段所示异步通知接收到的内容:

POST[https://baid.shop.rdc.like.com/index.php|122.112.158.230|200|1014ms|utf-8]: https://baid.shop.rdc.like.com/index.php?r=JwAlipay/notify_url¬ify_id=2020042000222134746071970505373170¬ify_type=trade_status_sync&sign=f67d2631715c3b1b4cc63572fa9350a5&trade_no=2020042022001371970501224430&total_fee=62.02&out_trade_no=CB20200420006¬ify_time=2020-04-20 13:47:46¤cy=USD&trade_status=TRADE_FINISHED&sign_type=MD5

建议方案:

建议配置为只带有path形式的格式,如:https://baid.shop.rdc.like.com/notify_url.php,那么支付宝系统也认定https://baid.shop.rdc.like.com/notify_url.php为接收目标发送异步通知,且系统读取到的异步通知内容也是支付宝系统原文发出的通知内容,即如下方加粗字段所示:

POST[https://baid.shop.rdc.like.com/notify_url.php|122.112.158.230|200|151ms|utf-8]: https://baid.shop.rdc.like.com/notify_url.php?notify_id=2020042000222143538071970505382098¬ify_type=trade_status_sync&sign=b6b3b9b9bc9028aa643f3c95842d63f2&trade_no=2020042022001371970501224673&total_fee=62.02&out_trade_no=CB20200420008¬ify_time=2020-04-20 14:38:48¤cy=USD&trade_status=TRADE_FINISHED&sign_type=MD5

NEED HELP?

NEED HELP?