支付寶退款接口(即時到帳無密退款)

refund_fastpay_by_platform_nopwd 官方參考文檔:

點擊下載:http://download.csdn.net/detail/ty_hf/9611096

步驟:

  • 1. 按照官方文檔,編寫此接口所需要的各個參數;
  • 2. 對各參數進行簽名處理,生成URL
  • 3.調用此URL,跳轉到對應請求頁面
  • 4.同步回調返回【受理結果】,注意是受理結果,就是此筆退款支付寶已經受理成功要去執行了,至於執行退款成功否,見5
  • 5.異步返回【退款結果】,詳細參數見下

 

  • 【注意,此功能接口,默認是不支持開放的,需要簽約纔可以。】

一.簽約步驟:

1.登錄 http://b.alipay.com

2.申請人工服務,提交此接口的開通申請。

3.等待幾個工作日,阿里會聯繫你,進行簽約

4.簽訂協議,開通接口,如下圖:

 

 

 

二.訪問參數:

 

 

請求參數舉例:

 

[php] view plain copy

  1. array (size=12)  
  2.   'service' => string 'refund_fastpay_by_platform_nopwd' (length=30)  
  3.   'partner' => string '222221624104006' (length=16)  
  4.   '_input_charset' => string 'UTF-8' (length=5)  
  5.   'sign_type' => string 'MD5' (length=3)  
  6.   'notify_url' => string 'http://www.test.com/admin/api/refund/alipay/notify_url.php' (length=60)  
  7.   'dback_notify_url' => string 'http://www.test.com/admin/api/refund/alipay/notify_url.php' (length=60)  
  8.   'batch_no' => string '2016081818103' (length=13)  
  9.   'refund_date' => string '2016-08-18 18:49:51' (length=19)  
  10.   'batch_num' => string '1' (length=1)  
  11.   'detail_data' => string '2016081821001004270231872174^0.01^協商退款' (length=46)  
  12.   'use_freeze_amount' => string 'N' (length=1)  
  13.   'return_type' => string 'xml' (length=3)  
  14.   
  15. https://mapi.alipay.com/gateway.do?_input_charset=UTF-8&batch_no=2016081818103&batch_num=1&dback_notify_url=http%3A%2F%2Fwww.test.com%2Fadmin%2Fapi%2Frefund%2Falipay%2Fnotify_url.php&detail_data=2016081821001004270231872174%5E0.01%5E%E5%8D%8F%E5%95%86%E9%80%80%E6%AC%BE¬ify_url=http%3A%2F%2Fwww.121mai.com%2Fadmin%2Fapi%2Frefund%2Falipay%2Fnotify_url.php&partner=2222221624104006&refund_date=2016-08-18+18%3A50%3A51&return_type=xml&service=refund_fastpay_by_platform_pwd&use_freeze_amount=N&sign=528ec9059f4bf1fb29d147632d737d73&sign_type=MD5  

 

 

 

 

 

 

三.回調參數:

1.同步受理回調參數:

 

[php] view plain copy

  1. string '<?xml version="1.0" encoding="GBK" ?>   
  2. <alipay>  
  3. <is_success>F</is_success>  
  4. <error>DUPLICATE_BATCH_NO</error>  
  5. </alipay>' (length=122)  


2.異步回調參數:

正常異步回調:

 

[php] view plain copy

  1. 成功舉例:  
  2. post:{"sign":"e18debab04898b7d5ce7d43823e21512","result_details":"2016082921001004270202288006^0.01^SUCCESS","notify_time":"2016-08-31 20:49:16","sign_type":"MD5","notify_type":"batch_refund_notify","notify_id":"86742cf72c3edb4f2818e67799d873cmva","batch_no":"2016083120318","success_num":"1"}  
  3.   
  4.   
  5. 失敗舉例:  
  6. post :{"sign":"85915ba45f3d14d5668e2387eadc8817","result_details":"2016082721001004640239968415^160.00^SELLER_BALANCE_NOT_ENOUGH","notify_time":"2016-09-01 10:00:52","sign_type":"MD5","notify_type":"batch_refund_notify","notify_id":"e5b820377bb685b3462419885e505denn2","batch_no":"2016090110120","success_num":"0"}  

 

 

 

充退回調:

 

 

 

 

四.碰到問題:

 

1.碰到問題,查看有密退款的問題描述,類似的

2.無密退款詳細細節,請參見文檔,一定要注意它的必填項與特殊參數的格式要求,比如 detail_data

3.在開發過程中,異步回調的不能再本地電腦調試,改host什麼的無效,請到外部可以訪問的頁面進行,或者使用【花生殼】等工具映射到本地也可

 

 

本文地址:http://blog.csdn.net/ty_hf/article/details/52483880

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章