search

Home  >  Q&A  >  body text

java - 支付系统的预发布环境如何搭建

支付系统涉及到很多回调通知,如何把第三方回调重定向到预发布环境上,特定的一些测试的url走预发布环境,其他的回调通知还是走生产环境(利用订单号区分?很多第三方回调的url很怪异)

例如:

腾讯退款

TenpayNotify?action=tenpayresp&bank_billno=20160803011500205322&bank_type=0&discount=0&fee_type=1&input_charset=UTF-8&notify_id=0nWEkl9GQh292zuCI_YLZLgR2Ssac_lVMSsrwGYIdhZ7VgyZnQQo5Lv_meAWZPoOnQBdsaoWNyf79rj19w1Yot_uIS23xaiw&out_trade_no=160803021511209902&partner=1215937301&product_fee=1&sign_type=MD5&time_end=20160803170601&total_fee=1&trade_mode=1&trade_state=0&transaction_id=1215937301201608031800471550&transport_fee=0&sign=7C4E4146C0C753A7B67B590EFC276F1F

阿里安全支付

aliwappayNotify?action=callback&out_trade_no=15071468688519260215&request_token=requestToken&result=success&trade_no=2015071421001004900020905555&sign=iEo0%2FjTi7wdfBH1ceMD1vfMsuR360%2FcNzvk2Gp751jdeHFs%2F%2Bn6KqlEJn5xgU3CF5rFIML4Pzhowi7Vj0WDHRqS8WDYRGqSzbHYXyjpC0tOza%2BNXOSbSTDiMjA6d8O8BwybAHt%2FmEbyq7UjTpmELrmhjB8P6t7ysWI76zqoNt7g%3D&sign_type=0001

支付宝回调

action=alipayresp&body=%E8%BF%85%E9%9B%B7%E7%99%BD%E9%87%91%E4%BC%9A%E5%91%98&buyer_email=yulinfeng007%40163.com&buyer_id=2088102231970203&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3InWf0XaGKI%252Bxji3mqOogfL8SaB4E%252BINCw%252Fs29ny5j5FhlLjhTSG&notify_time=2016-08-22+14%3A31%3A15&notify_type=trade_status_sync&out_trade_no=16082218455489530210&payment_type=1&seller_email=incomexl%40xunlei.com&seller_id=2088001933470180&subject=%E8%BF%85%E9%9B%B7%E7%99%BD%E9%87%91%E4%BC%9A%E5%91%98&total_fee=0.01&trade_no=2016082221001004200219501239&trade_status=TRADE_SUCCESS&sign=d03c9a26a9e68cfe8f0d0368dc993144&sign_type=MD5

回调地址的配置有一些是在第三方配置的,有一些是自己系统传给第三方的

问题难点在于切换回调通知到预发布环境和生产环境

有没大神做过类似支付系统的预发布环境,谢谢分享啦~~

PHP中文网PHP中文网2810 days ago1005

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 10:13:40

    The test and official environments use different order number generation rules. There should be some parameters submitted by the merchant during the third-party callback. For example, if you add a prefix to the order in the test environment, you can make routing rules based on the parameters. You can test it with the following example. testnginx

    location = /notify {
        if ($args ~ tradeNo=test) {
            rewrite ^ https://www.baidu.com redirect;
        }
        rewrite ^ https://www.taobao.com redirect;
    }

    Test request order number:

    http://[ip]/notify?tradeNo=test55555
    正式请求订单号:http://[ip]/notify?tradeNo=5555

    Nginx configuration organization

    Nginx official documentation

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:13:40

    The production environment is bound to the domain name url, and the pre-release environment is bound to the domain name url_pre

    URL is managed with configuration files

    In this way, the code reads the different url configurations of the two environments, which can ensure that the code is the same

    When submitting a payment request, you will be asked to pass the URL address of the notification, so just pass url_pre for pre-release and url for production environment

    reply
    0
  • Cancelreply