- 行業(yè)新聞
-
上海翻譯公司完成電子系統(tǒng)“即時(shí)到賬接口 ”中文翻譯
發(fā)布時(shí)間:2019-08-28 16:08 點(diǎn)擊:
上海翻譯公司完成電子系統(tǒng)“即時(shí)到賬接口 ”中文翻譯手機(jī)網(wǎng)頁即時(shí)到賬接口服務(wù)名稱: alipay.wap.trade.create.direct alipay.wap.auth.authAndExecute版本號(hào):1.2支付寶(中國)網(wǎng)絡(luò)技術(shù)有限公司 版權(quán)所有1 Document description1.1 Function Description“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”和“手機(jī)網(wǎng)頁即時(shí)到賬交易接口(alipay.wap.auth.authAndExecute)”配套使用,共同完成即時(shí)到賬交易。授權(quán)接口用于存儲(chǔ)商戶創(chuàng)建交易所需信息,并返回一個(gè)授權(quán)令牌(request_token);交易接口使用授權(quán)接口返回的授權(quán)令牌(request_token)值,將頁面重定向到支付寶支付頁面,使得付款者可以直接匯款給另一個(gè)擁有支付寶賬號(hào)的收款者。授權(quán)接口并未實(shí)際創(chuàng)建即時(shí)到賬交易,創(chuàng)建即時(shí)到賬交易并且完成支付的過程由交易接口完成。1.2 ReadersThe document is prepared for the personnel who have the website development capability, learn about one of ASP, PHP, JAVA, ASP.NET development language and the website development, maintenance and management of SQL database language.1.3 Business termsTable 1-1 Business termsTerms ExplanationDemand The process of transmitting the data requiring for delivery to the receiverNotification Server aynchronous notice. After Alipay completes the data processing, Alipay will issue notice to the website of commercial user and give feedback to the commercial user website on the completed message after processing.Returning Page Skipping synchronous notice. After Alipay completes the data processing, Alipay will skip from the current Alipay page to the website of commercial user and give feedback to the commercial user website on the completed message after processing.支付失敗 余額不足、超額、交易被凍結(jié)、賬號(hào)被凍結(jié)、訂單已支付、訂單金額和支付金額不一致等都會(huì)導(dǎo)致支付失敗。2 Function demonstration圖2-1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)流程圖步驟1: 獲取token授權(quán)令牌商戶調(diào)用“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”,向支付寶發(fā)送訂單信息,以獲取token授權(quán)令牌。步驟2: 即時(shí)到賬交易付款商戶調(diào)用“手機(jī)網(wǎng)頁即時(shí)到賬交易接口(alipay.wap.auth.authAndExecute)”,驗(yàn)證token值,并創(chuàng)建支付寶交易后完成支付,通知商戶并跳轉(zhuǎn)回商戶指定頁面鏈接。3 Data interactionFigure 3-1 Commercial user system requirement-Payment affects interactional mode合作商戶系統(tǒng) System of commercial user in cooperation支付寶系統(tǒng) Alipay system構(gòu)造請(qǐng)求數(shù)據(jù) Structure request data發(fā)送請(qǐng)求數(shù)據(jù) Issuing requirement data請(qǐng)求的交易 Requested transaction返回相應(yīng)數(shù)據(jù) Return he corresponding data對(duì)相應(yīng)的數(shù)據(jù)進(jìn)行處理 Process the corresponding data(1) Structure request dataCommercial users obtain the data set with signature results transmitted to Alipay through the program according to the interface rule provided by Alipay.(2) Issuing requirement dataTransmit the dataset in completed structure to Alipay through page link skipping or form list submitting.(3) Process the corresponding dataAfter obtaining this set, at fist, adopt the safety verification. After a series of verification, the data request sent will be processed.(4) Return the processed result data 授權(quán)接口支付寶會(huì)把處理完成的結(jié)果數(shù)據(jù)以html的形式返回給商戶。 交易接口As for the transaction after completing processing, Alipay will give feedback to commercial user website in the following ways.– 程序上自動(dòng)進(jìn)行重新構(gòu)造URL地址鏈接,在用戶當(dāng)前頁面上通過自動(dòng)跳轉(zhuǎn)的方式跳回商戶在請(qǐng)求時(shí)設(shè)定好的頁面路徑地址(參數(shù)call_back_url,在“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”中指定);– Alipay server gives a notice actively to invoke the page path address designated in request (Parameter “return_url”, if the commercial user fails to set up, the operation will not be adopted.(5) Process the obtained returned result data專業(yè)翻譯公司 授權(quán)接口專業(yè)翻譯公司商戶利用編程方法來模擬http請(qǐng)求遠(yuǎn)程解析html,獲取支付寶返回的結(jié)果數(shù)據(jù)后,可以結(jié)合自身網(wǎng)站的業(yè)務(wù)邏輯進(jìn)行數(shù)據(jù)處理。 交易接口商戶在同步通知處理頁面(參數(shù)call_back_url指定頁面文件)或服務(wù)器異步通知頁面(參數(shù)notify_url指定頁面文件)獲取支付寶返回的結(jié)果數(shù)據(jù)后,可以結(jié)合自身網(wǎng)站的業(yè)務(wù)邏輯進(jìn)行數(shù)據(jù)處理(如:訂單更新、自動(dòng)充值到會(huì)員賬號(hào)中等)。4 Request parameters4.1 授權(quán)接口請(qǐng)求參數(shù)說明4.1.1 MeaningsRequest parameters are the request data provided for Alipay when commercial users have data interaction with Alipay, so as to benefit for Alipay to make further processing these data.4.1.2 ListTable 4-1 Description request parameterParameters Parameter name Type (field length) Parameter description Null or not SamplesBasic parametersservice Interface name String Interface name Not Full alipay.wap.trade.create.directformat 請(qǐng)求參數(shù)格式 String 請(qǐng)求參數(shù)格式。固定取值xml。 Not Full xmlv 接口版本號(hào) String 接口版本號(hào)。固定取值2.0。 Not Full 2.0partner Cooperator ID String(16) Only user name of corresponding Alipay of signed Alipay account, composed of 16-bit pure number headed with 2088 Not Full 2088101000137799req_id 請(qǐng)求號(hào) String(32) 用于關(guān)聯(lián)請(qǐng)求與響應(yīng),防止請(qǐng)求重播。支付寶限制來自同一個(gè)partner的請(qǐng)求號(hào)必須唯一。 Not Full 1282889689836sec_id 簽名方式 對(duì)參數(shù)簽名的方式。取值范圍:0001:RSA簽名算法MD5:MD5簽名算法Not Full 0001sign 簽名 String 對(duì)請(qǐng)求或響應(yīng)中參數(shù)簽名后的值。 Not Full VRVr7adPfsHblFjiBkGWryhKIKt+CaI4Cq2MA2wG1ENVuBAyFDlp3FbttndmID0USlfn22a9/6fQ+X+KPDE09hcTNz3gJ1edUiDWxHXY/ahTexCP79SDtoHx29uepXsHBe32DP0k9jZbfhpT8Ly0+ksuo5VJO0iymxQ87hQPjJw=Business parametersParameters Parameter name Type (field length) Parameter description Null or not Samplesreq_data 請(qǐng)求業(yè)務(wù)參數(shù) String 請(qǐng)求業(yè)務(wù)參數(shù)請(qǐng)參考“表4-2 req_data請(qǐng)求業(yè)務(wù)參數(shù)列表”。<direct_trade_create_req>:根節(jié)點(diǎn)<subject>:商品名稱<out_trade_no>:商戶網(wǎng)站唯一訂單號(hào)<total_fee>:交易金額<seller_account_name>:賣家支付寶賬號(hào)<call_back_url>:支付成功跳轉(zhuǎn)頁面路徑<notify_url>:服務(wù)器異步通知頁面路徑<out_user>:商戶系統(tǒng)用戶唯一標(biāo)識(shí)<merchant_url>:操作中斷返回地址<pay_expire>:交易自動(dòng)關(guān)閉時(shí)間 Not Full <direct_trade_create_req><subject>彩票</subject><out_trade_no>1282889603601</out_trade_no><total_fee>10.01</total_fee><seller_account_name>[email protected]</seller_account_name><call_back_url>http://www.yoursite.com/waptest0504/servlet/CallBack</call_back_url><notify_url>http://www.yoursite.com/waptest0504/servlet/NotifyReceiver</notify_url><out_user>123456789</out_user><merchant_url>http://www.yoursite.com</merchant_url><pay_expire>3600</pay_expire></direct_trade_create_req>表4-2 req_data請(qǐng)求業(yè)務(wù)參數(shù)列表Parameters Parameter name Type ( field length) Parameter description Null or not Samplessubject Commodity name String(256) 用戶購買的商品名稱。 Not Full 彩票out_trade_no Sole order number of commercial website String(64) Sole order number of Alipay cooperator commercial website. Not Full 1282889603601total_fee Transaction amount String(15) 該筆訂單的資金總額,單位為RMB-Yuan。取值范圍為[0.01,100000000.00],精確到小數(shù)點(diǎn)后兩位。 Not Full 10.01seller_account_name Seller Alipay account String(100) 賣家的支付寶賬號(hào)。交易成功后,買家資金會(huì)轉(zhuǎn)移到該賬戶中。 Not Full [email protected]call_back_url 支付成功跳轉(zhuǎn)頁面路徑 String(200) 支付成功后的跳轉(zhuǎn)頁面鏈接。支付成功才會(huì)跳轉(zhuǎn)。 Not Full http://www.yoursite.com/waptest0504/servlet/CallBacknotify_url 服務(wù)器異步通知頁面路徑 String(200) 支付寶服務(wù)器主動(dòng)通知商戶網(wǎng)站里指定的頁面http路徑。 Full http://www.yoursite.com/waptest0504/servlet/NotifyReceiverout_user 商戶系統(tǒng)用戶唯一標(biāo)識(shí) String(32) 買家在商戶系統(tǒng)的唯一標(biāo)識(shí)。當(dāng)該買家支付成功一次后,再次支付金額在30元內(nèi)時(shí),不需要再次輸入密碼。 Full 123456789merchant_url 操作中斷返回地址 String 用戶付款中途退出返回商戶的地址。 Full http://www.yoursite.compay_expire 交易自動(dòng)關(guān)閉時(shí)間 String 交易自動(dòng)關(guān)閉時(shí)間,單位為分鐘。默認(rèn)值21600(即15天)。 Full 3600說明: req_data參數(shù)的值不能包含半角或全角的“&”符號(hào); 部分參數(shù)類型為String,未指明長度范圍,表明系統(tǒng)不校驗(yàn)該參數(shù)的長度。4.1.3 Samples說明: 本樣例僅供參考,支付寶網(wǎng)關(guān)為http://wappaygw.alipay.com/service/rest.htm。 藍(lán)色為必填參數(shù),綠色為固定值參數(shù),紅色為選填參數(shù)。http://wappaygw.alipay.com/service/rest.htm?req_data=<direct_trade_create_req><subject>彩票</subject><out_trade_no>1282889603601</out_trade_no><total_fee>10.01</total_fee><seller_account_name>[email protected]</seller_account_name><call_back_url>http://www.yoursite.com/waptest0504/servlet/CallBack</call_back_url><notify_url>http://www.yoursite.com/waptest0504/servlet/NotifyReceiver</notify_url><out_user>123456789</out_user><merchant_url>http://www.yoursite.com</merchant_url><pay_expire>3600</pay_expire></direct_trade_create_req>&service=alipay.wap.trade.create.direct&sec_id=0001&partner=2088101000137799&req_id=1282889689836&sign=VRVr7adPfsHblFjiBkGWryhKIKt+CaI4Cq2MA2wG1ENVuBAyFDlp3FbttndmID0USlfn22a9/6fQ+X+KPDE09hcTNz3gJ1edUiDWxHXY/ahTexCP79SDtoHx29uepXsHBe32DP0k9jZbfhpT8Ly0+ksuo5VJO0iymxQ87hQPjJw=&format=xml&v=2.04.2 交易接口請(qǐng)求參數(shù)說明4.2.1 Meaning請(qǐng)求參數(shù)是商戶在與支付寶進(jìn)行數(shù)據(jù)交互時(shí),提供給支付寶的請(qǐng)求數(shù)據(jù),以便支付寶根據(jù)這些數(shù)據(jù)進(jìn)一步處理。4.2.2 列表表4-3 請(qǐng)求參數(shù)說明Parameters Parameter name Type (field length) Parameter description Null or not SamplesBasic parametersservice Interface name String Interface name Not Full alipay.wap.auth.authAndExecuteformat 請(qǐng)求參數(shù)格式 String 請(qǐng)求參數(shù)格式。固定取值xml。 Not Full xmlv 接口版本號(hào) String 接口版本號(hào)。固定取值2.0。 Not Full 2.0partner 合作者身份ID String(16) 商戶簽約的支付寶賬號(hào)對(duì)應(yīng)的支付寶唯一用戶號(hào)。以2088開頭的16位純數(shù)字組成。 Not Full 2088101000137799sec_id 簽名方式 String 對(duì)參數(shù)簽名的方式。取值范圍:0001:RSA簽名算法MD5:MD5簽名算法 Not Full 0001sign 簽名 String 對(duì)請(qǐng)求或響應(yīng)中參數(shù)簽名后的值。 Not Full LdXbwMLug8E4UjfJMuYv2KoD5X5F3vHGQsQbZ/rdEQ3eaN4FPal7rhsbZZ/+ZUL1kAKzTQSDdMk87MEWtWO1Yq6rhnt2Tv8Hh6Hb16211VXKgbBCpq861+LopRwegPbGStcwBuAyE4pi6fYlJ6gxzL4tMyeLe+T5XZ0RKRUk00U=Business parametersreq_data 請(qǐng)求業(yè)務(wù)參數(shù) String 請(qǐng)求業(yè)務(wù)參數(shù)請(qǐng)參考“表4-4 req_data請(qǐng)求業(yè)務(wù)參數(shù)列表”。<auth_and_execute_req>:根節(jié)點(diǎn)<request_token>:授權(quán)令牌 Not Full <auth_and_execute_req><request_token>201008309e298cf01c58146274208eda1e4cdf2b</request_token></auth_and_execute_req>Parameters Parameter name Type (field length) Parameter description Null or not Samplesrequest_token 授權(quán)令牌 String(40) 授權(quán)令牌,調(diào)用“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”成功后返回該值。此參數(shù)值不能更改。 Not Full 201008309e298cf01c58146274208eda1e4cdf2b說明: 只有支付成功時(shí)才會(huì)跳轉(zhuǎn)到call_back_url,支付失敗時(shí)跳轉(zhuǎn)到merchant_url(不返回任何參數(shù)),跳轉(zhuǎn)地址都在“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”中設(shè)置。 部分參數(shù)類型為String,未指明長度范圍,表明系統(tǒng)不校驗(yàn)該參數(shù)的長度。4.2.3 Samples說明: 本樣例僅供參考,支付寶網(wǎng)關(guān)為http://wappaygw.alipay.com/service/rest.htm。 所有參數(shù)都必傳,藍(lán)色為可變值參數(shù),綠色為固定值參數(shù)。http://wappaygw.alipay.com/service/rest.htm?req_data=<auth_and_execute_req><request_token>201008309e298cf01c58146274208eda1e4cdf2b</request_token></auth_and_execute_req>&service=alipay.wap.auth.authAndExecute&sec_id=0001&partner=2088101000137799&sign=LdXbwMLug8E4UjfJMuYv2KoD5X5F3vHGQsQbZ/rdEQ3eaN4FPal7rhsbZZ/+ZUL1kAKzTQSDdMk87MEWtWO1Yq6rhnt2Tv8Hh6Hb16211VXKgbBCpq861+LopRwegPbGStcwBuAyE4pi6fYlJ6gxzL4tMyeLe+T5XZ0RKRUk00U=&format=xml&v=2.05 返回參數(shù)5.1 授權(quán)接口html同步返回參數(shù)說明5.1.1 Meaning支付寶對(duì)商戶提供的請(qǐng)求數(shù)據(jù)進(jìn)行處理后,返回給商戶結(jié)果數(shù)據(jù),以便商戶根據(jù)這些數(shù)據(jù)進(jìn)一步處理。5.1.2 列表表5-1 html同步返回參數(shù)說明Parameters Parameter name Type (length scope) Parameter description Null or not SamplesBasic parameterspartner 合作者身份ID String(16) 商戶簽約的支付寶賬號(hào)對(duì)應(yīng)的支付寶唯一用戶號(hào)。以2088開頭的16位純數(shù)字組成。 Not Full 2088101000137799req_id 請(qǐng)求號(hào) String(32) 用于關(guān)聯(lián)請(qǐng)求與響應(yīng),防止請(qǐng)求重播。支付寶限制來自同一個(gè)partner的請(qǐng)求號(hào)必須唯一。 Not Full 1282889689836sec_id 簽名方式 String 對(duì)參數(shù)簽名的方式。取值范圍:0001:RSA簽名算法MD5:MD5簽名算法 Not Full MD5service 接口名稱 String 接口名稱。 Not Full alipay.wap.trade.create.directv 接口版本號(hào) String 接口版本號(hào)。固定取值2.0。 Not Full 2.0sign 簽名 String 對(duì)請(qǐng)求或響應(yīng)中參數(shù)簽名后的值。請(qǐng)求失敗的請(qǐng)況下,不簽名,無此參數(shù)。 可空 72a64fb63f0b54f96b10cefb69319e8aBusiness parametersres_data 返回業(yè)務(wù)參數(shù) String 返回業(yè)務(wù)參數(shù),參見“5.1.2 1. res_data返回業(yè)務(wù)參數(shù)”。請(qǐng)求成功后才會(huì)返回該值。包含接口返回的最重要的授權(quán)令牌request_token。<direct_trade_create_res>:請(qǐng)求根節(jié)點(diǎn)<request_token>:授權(quán)令牌值 Full <?xmlversion="1.0" encoding="utf-8"?><direct_trade_create_res><request_token>20100830e8085e3e0868a466b822350ede5886e8</request_token></direct_trade_create_res>res_error 返回錯(cuò)誤參數(shù) String 返回錯(cuò)誤參數(shù),參見“2. res_error返回錯(cuò)誤參數(shù)”。請(qǐng)求失敗后才會(huì)返回該值。包含請(qǐng)求失敗的錯(cuò)誤碼和錯(cuò)誤原因。<err>:返回錯(cuò)誤根節(jié)點(diǎn)<code>、<sub_code>:錯(cuò)誤編碼(目前兩個(gè)值相同)<msg>:錯(cuò)誤信息 <detail>:錯(cuò)誤詳細(xì)描述參見“9.1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼”。 Full <?xml version="1.0" encoding="utf-8"?><err><code>0005</code><sub_code>0005</sub_code><msg>partner illegal</msg><detail>合作伙伴沒有開通接口訪問權(quán)限</detail></err>1. res_data返回業(yè)務(wù)參數(shù)表5-2 res_data返回業(yè)務(wù)參數(shù)列表Parameters Parameter name Type (length scope) Parameter description Null or not Samplesrequest_token 授權(quán)令牌 String 授權(quán)令牌,請(qǐng)求成功后才會(huì)返回該值。 Not Full 20100830e8085e3e0868a466b822350ede5886e82. res_error返回錯(cuò)誤參數(shù)表5-3 res_error返回錯(cuò)誤參數(shù)列表Parameters Parameter name 類型(長度范圍) Parameter description Null or not Samplescode 錯(cuò)誤代碼 String 請(qǐng)求失敗時(shí),返回的錯(cuò)誤代碼,對(duì)應(yīng)“9.1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼”中的“錯(cuò)誤代碼(code)”。 Not Full 0005sub_code 錯(cuò)誤子代碼 String 預(yù)留參數(shù),目前和code參數(shù)值一致。 Not Full 0005msg 錯(cuò)誤原因 String 錯(cuò)誤原因,對(duì)應(yīng)“9.1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼”中的“錯(cuò)誤原因(msg)”。 Not Full partner illegaldetail 錯(cuò)誤詳細(xì)描述 String 錯(cuò)誤詳細(xì)描述,對(duì)應(yīng)“9.1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼”中的“錯(cuò)誤詳細(xì)描述(detail)”。 Not Full 合作伙伴沒有開通接口訪問權(quán)限5.1.3 Samples 正常輸出:partner=2088101000137799&req_id=1282889689836&res_data=<?xmlversion="1.0" encoding="utf-8"?><direct_trade_create_res><request_token>20100830e8085e3e0868a466b822350ede5886e8</request_token></direct_trade_create_res>&sec_id=MD5&service=alipay.wap.trade.create.direct&v=2.0&sign=72a64fb63f0b54f96b10cefb69319e8a 發(fā)生錯(cuò)誤時(shí)輸出:partner=208810100013779&req_id=1282889689836&res_error=<?xml version="1.0" encoding="utf-8"?><err><code>0005</code><sub_code>0005</sub_code><msg>partner illegal</msg><detail>合作伙伴沒有開通接口訪問權(quán)限</detail></err>&sec_id=0001&service=alipay.wap.trade.create.direct&v=2.05.2 交易接口頁面跳轉(zhuǎn)同步通知參數(shù)說明5.2.1 MeaningAfter Alipay complete processing the request data of commercial users, it will notify the commercial user website through the way of automatic skipping of systemic controlling client end page. These processing result data is the page skipping synchronous notification parameter.支付寶以GET方式訪問商戶網(wǎng)站(參數(shù)call_back_url,在“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”中指定)。5.2.2 List tableTable 5-4 Synchronous notification parameter description of page skippingParameters Parameter name Type (length scope) Parameter description Null or not Samplessign Signature String 對(duì)請(qǐng)求或響應(yīng)中參數(shù)簽名后的值。 Not Full 49a330fee069465c64e561a25bf31c78result 支付結(jié)果 String 判斷支付結(jié)果及交易狀態(tài)。只有支付成功時(shí)(即result=success),才會(huì)跳轉(zhuǎn)到支付成功頁面,result有且只有success一個(gè)交易狀態(tài)。 Not Full successout_trade_no 商戶網(wǎng)站唯一訂單號(hào) String(64) 支付寶合作商戶網(wǎng)站唯一訂單號(hào)。 Not Full 1320742949342trade_no 支付寶交易號(hào) String(32) 該交易在支付寶系統(tǒng)中的交易流水號(hào)。最短16位,最長64位。 Not Full 2011110823389231request_token 授權(quán)令牌 String(40) 授權(quán)令牌,調(diào)用“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”成功后返回的值。 Not Full 201008309e298cf01c58146274208eda1e4cdf2b5.2.3 Sampleshttp://www.xxx.com/alipay/call_back_url.php?out_trade_no=1320742949342&request_token=201008309e298cf01c58146274208eda1e4cdf2b&result=success&trade_no=2011110823389231&sign=49a330fee069465c64e561a25bf31c78說明: 本樣例僅供參考,實(shí)際網(wǎng)關(guān)為商戶域名。 如果支付失敗,直接跳轉(zhuǎn)“手機(jī)網(wǎng)頁即時(shí)到賬授權(quán)接口(alipay.wap.trade.create.direct)”中傳遞的merchant_url參數(shù),跳轉(zhuǎn)merchant_url時(shí)不回傳參數(shù)。5.3 交易接口服務(wù)器異步通知參數(shù)說明5.3.1 Meaning支付寶對(duì)商戶的請(qǐng)求數(shù)據(jù)處理完成后,會(huì)將處理的結(jié)果數(shù)據(jù)通過服務(wù)器主動(dòng)通知的方式通知給商戶網(wǎng)站。這些處理結(jié)果數(shù)據(jù)就是服務(wù)器異步通知參數(shù)。5.3.2 List tableTable 5-5 Server asynchronous notification parameter descriptionParameters Parameter name Type (field length) Parameter description Null or not SamplesBasic parametersservice 接口名稱 String 接口名稱。 Not Full alipay.wap.trade.create.directv 接口版本號(hào) String 接口版本號(hào)。固定取值1.0。 Not Full 1.0sec_id Signature way String 對(duì)參數(shù)簽名的方式。取值范圍:0001:RSA簽名算法MD5:MD5簽名算法 Not Full 0001sign Signature String 對(duì)請(qǐng)求或響應(yīng)中參數(shù)簽名后的值。 Not Full Rw/y4ROnNicXhaj287Fiw5pvP6viSyg53H3iNiJ61D3YVi7zGniG2680pZv6rakMCeXX++q9XRLw8Rj6I1//qHrwMAHS1hViNW6hQYsh2TqemuL/xjXRCY3vjm1HCoZOUa5zF2jU09yG23MsMIUx2FAWCL/rgbcQcOjLe5FugTc=Business parametersnotify_data 通知業(yè)務(wù)參數(shù) String 通知的業(yè)務(wù)參數(shù),參見“表5-6 notify_data通知業(yè)務(wù)參數(shù)列表”。<notify>:通知根節(jié)點(diǎn)<payment_type>:支付類型<subject>:商品名稱<trade_no>:支付寶交易號(hào)<buyer_email>:買家支付寶賬號(hào)<gmt_create>:交易創(chuàng)建時(shí)間<notify_type>:通知類型<quantity>:購買數(shù)量<out_trade_no>:商戶網(wǎng)站唯一訂單號(hào)<notify_time>:通知時(shí)間<seller_id>:賣家支付寶賬戶號(hào)<trade_status>:交易狀態(tài)<is_total_fee_adjust>:是否調(diào)整總價(jià)<total_fee>:交易金額<gmt_payment>:交易付款時(shí)間<seller_email>:賣家支付寶賬號(hào)<gmt_close>:交易關(guān)閉時(shí)間<price>:商品單價(jià)<buyer_id>:買家支付寶用戶號(hào)<notify_id>:通知校驗(yàn)ID<use_coupon>:是否使用紅包買家 Not Full <notify><payment_type>1</payment_type><subject>收銀臺(tái){1283134629741}</subject><trade_no>2010083000136835</trade_no><buyer_email>[email protected]</buyer_email><gmt_create>2010-08-30 10:17:24</gmt_create><notify_type>trade_status_sync</notify_type><quantity>1</quantity><out_trade_no>1283134629741</out_trade_no><notify_time>2010-08-30 10:18:15</notify_time><seller_id>2088101000137799</seller_id><trade_status>TRADE_FINISHED</trade_status><is_total_fee_adjust>N</is_total_fee_adjust><total_fee>1.00</total_fee><gmt_payment>2010-08-30 10:18:26</gmt_payment><seller_email>[email protected]</seller_email><gmt_close>2010-08-30 10:18:26</gmt_close><price>1.00</price><buyer_id>2088102001172352</buyer_id><notify_id>509ad84678759176212c247c46bec05303</notify_id><use_coupon>N</use_coupon></notify>表5-6 notify_data通知業(yè)務(wù)參數(shù)列表Parameters Parameter name Type (field length) Parameter description Null or not Samplespayment_type 支付方式 String 用戶的支付方式:1:商品購買;4:捐贈(zèng)。 Not Full 1subject 商品名稱 String(256) 商品的標(biāo)題/交易標(biāo)題/訂單標(biāo)題/訂單關(guān)鍵字等。它在支付寶的交易明細(xì)中排在第一列,對(duì)于財(cái)務(wù)對(duì)賬尤為重要。是請(qǐng)求時(shí)對(duì)應(yīng)的參數(shù),原樣通知回來。 Not Full 收銀臺(tái){1283134629741}trade_no 支付寶交易號(hào) String(32) 該交易在支付寶系統(tǒng)中的交易流水號(hào)。最短16位,最長64位。 Not Full 2010083000136835buyer_email 買家支付寶賬號(hào) String(100) 買家支付寶賬號(hào),可以是email或手機(jī)號(hào)碼。 Not Full [email protected]gmt_create 交易創(chuàng)建時(shí)間 String 該筆交易創(chuàng)建的時(shí)間。格式為yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:17:24notify_type 通知類型 String 通知的類型。固定值。 Not Full trade_status_syncquantity 購買數(shù)量 String 購買商品的數(shù)量。 Not Full 1out_trade_no 商戶網(wǎng)站唯一訂單號(hào) String(64) 對(duì)應(yīng)商戶網(wǎng)站的訂單系統(tǒng)中的唯一訂單號(hào),非支付寶交易號(hào)。需保證在商戶網(wǎng)站中的唯一性。是請(qǐng)求時(shí)對(duì)應(yīng)的參數(shù),原樣返回。 Not Full 1283134629741notify_time 通知時(shí)間 String 通知的發(fā)送時(shí)間。格式為yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:18:15seller_id 賣家支付寶用戶號(hào) String 賣家支付寶賬號(hào)對(duì)應(yīng)的支付寶唯一用戶號(hào)。以2088開頭的純16位數(shù)字。 Not Full 2088101000137799trade_status 交易狀態(tài) String 交易的狀態(tài),取值范圍參見“9.2 交易狀態(tài)”。 Not Full TRADE_FINISHEDis_total_fee_adjust 是否調(diào)整總價(jià) String 該交易是否調(diào)整過價(jià)格。本接口創(chuàng)建的交易不會(huì)被修改總價(jià),固定值為N。 Not Full Ntotal_fee 交易金額 String(15) 該筆訂單的總金額。請(qǐng)求時(shí)對(duì)應(yīng)的參數(shù),原樣通知回來。 Not Full 1.00gmt_payment 交易付款時(shí)間 String 該筆交易的買家付款時(shí)間。格式為yyyy-MM-dd HH:mm:ss。如果交易未付款,則不返回該參數(shù)。 Full 2010-08-30 10:18:26seller_email 賣家支付寶賬號(hào) String(100) 賣家支付寶賬號(hào),可以是email和手機(jī)號(hào)碼。 Not Full [email protected]gmt_close 交易關(guān)閉時(shí)間 String 交易關(guān)閉時(shí)間。格式為yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:18:26price 商品單價(jià) String 目前和total_fee值相同。單位:元。不應(yīng)低于0.01元。 Not Full 1.00buyer_id 買家支付寶用戶號(hào) String 買家支付寶賬號(hào)對(duì)應(yīng)的支付寶唯一用戶號(hào)。以2088開頭的純16位數(shù)字。 Not Full 2088102001172352notify_id 通知校驗(yàn)ID String 通知校驗(yàn)ID。唯一識(shí)別通知內(nèi)容。重發(fā)相同內(nèi)容的通知時(shí),該值不變。 Not Full 509ad84678759176212c247c46bec05303use_coupon 是否使用紅包買家 String 是否在交易過程中使用了紅包。 Not Full N5.3.3 SamplesNote:This sample is only for reference; the actual gateway shall be the commercial user domain name. 商戶使用RSA簽名時(shí)收到支付寶的通知請(qǐng)求樣例如下:http://www.xxx.com/alipay/notify_url.php?service=alipay.wap.trade.create.direct&sign=Rw/y4ROnNicXhaj287Fiw5pvP6viSyg53H3iNiJ61D3YVi7zGniG2680pZv6rakMCeXX++q9XRLw8Rj6I1//qHrwMAHS1hViNW6hQYsh2TqemuL/xjXRCY3vjm1HCoZOUa5zF2jU09yG23MsMIUx2FAWCL/rgbcQcOjLe5FugTc=&sec_id=0001&v=2.0¬ify_data=g3ivqicRwI9rI5jgmSHSU2osBXV1jcxohapSAPjx4f6qiqsoAzstaRWuPuutE0gxQwzMOtwL3npZqWO3Z89J4w4dXIY/fvOLoTNn8FjExAf7OozoptUS6suBhdMyo/YJyS3lVALfCeT3s27pYWihHgQgna6cTfgi67H2MbX40xtexIpUnjgxBkmOLai8DPOUI58y4UrVwoXQgdcwnXsfn2OthhUFiFPfpINgEphUAq1nC/EPymP6ciHdTCWRI6l1BgWuCzdFy0MxJLliPSnuLyZTou7f+Z5Mw24FgOacaISB+1/G+c4XIJVKJwshCDw9Emz+NAWsPvq34FEEQXVAeQRDOphJx8bDqLK75CGZX+6fx88m5ztq4ykuRUcrmoxZLJ+PiABvYFzi5Yx2uBMP/PmknRmj1HUKEhuVWsXR0t6EWpJFXlyQA4uxbShzncWDigndD7wbfNtkNLg5xMSFFIKay+4YzJK68H9deW4xqk4JYTKsv8eom9Eg9MrJZiIrFkFpVYPuaw0y/n61UEFYdzEQZz+garCmMYehEAQCGibYUQXBlf1iwTOZdqJIxdgCpSX21MIa9N9jicmFu8OXWZJkdN+UrSyvIcpzRori+U6522ovMz5Z8EzVTfcUENu+d注意:以上示例中的notify_data參數(shù)值為加密內(nèi)容,商戶需用自己的RSA私鑰先進(jìn)行解密后再驗(yàn)簽。 商戶使用MD5簽名時(shí)收到支付寶的通知樣例如下:http://www.xxx.com/alipay/notify_url.php?service=alipay.wap.trade.create.direct%20&sign=Rw/y4ROnNicXhaj287Fiw5pvP6viSyg53H3iNiJ61D3YVi7zGniG2680pZv6rakMCeXX++q9XRLw8Rj6I1//qHrwMAHS1hViNW6hQYsh2TqemuL/xjXRCY3vjm1HCoZOUa5zF2jU09yG23MsMIUx2FAWCL/rgbcQcOjLe5FugTc=&v=2.0&sec_id=MD5¬ify_data=%3Cnotify%3E%3Cpayment_type%3E1%3C/payment_type%3E%3Csubject%3E%E6%94%B6%E9%93%B6%E5%8F%B0{1283134629741}%3C/subject%3E%3Ctrade_no%3E2010083000136835%3C/trade_no%3E%3Cbuyer_email%[email protected]%3C/buyer_email%3E%3Cgmt_create%3E2010-08-3010:17:24%3C/gmt_create%3E%3Cnotify_type%3Etrade_status_sync%3C/notify_type%3E%3Cquantity%3E1%3C/quantity%3E%3Cout_trade_no%3E1283134629741%3C/out_trade_no%3E%3Cnotify_time%3E2010-08-3010:18:15%3C/notify_time%3E%3Cseller_id%3E2088101000137799%3C/seller_id%3E%3Ctrade_status%3ETRADE_FINISHED%3C/trade_status%3E%3Cis_total_fee_adjust%3EN%3C/is_total_fee_adjust%3E%3Ctotal_fee%3E1.00%3C/total_fee%3E%3Cgmt_payment%3E2010-08-3010:18:26%3C/gmt_payment%3E%3Cseller_email%[email protected]%3C/seller_email%3E%3Cgmt_close%3E2010-08-3010:18:26%3C/gmt_close%3E%3Cprice%3E1.00%3C/price%3E%3Cbuyer_id%3E2088102001172352%3C/buyer_id%3E%3Cnotify_id%3E509ad84678759176212c247c46bec05303%3C/notify_id%3E%3Cuse_coupon%3EN%3C/use_coupon%3E%3C/notify%3E以上示例中的notify_data參數(shù)值為明文內(nèi)容,無需解密。 支付寶系統(tǒng)通知待簽名數(shù)據(jù)構(gòu)造規(guī)則比較特殊,為固定順序。例如商戶收到如下通知數(shù)據(jù):http://www.xxx.com/alipay/notify_url.php?service=alipay.wap.trade.create.direct&sign=Rw/y4ROnNicXhaj287Fiw5pvP6viSyg53H3iNiJ61D3YVi7zGniG2680pZv6rakMCeXX++q9XRLw8Rj6I1//qHrwMAHS1hViNW6hQYsh2TqemuL/xjXRCY3vjm1HCoZOUa5zF2jU09yG23MsMIUx2FAWCL/rgbcQcOjLe5FugTc=&v=1.0&sec_id=0001¬ify_data=<notify><payment_type>1</payment_type></notify>則只需對(duì)以下數(shù)據(jù)進(jìn)行驗(yàn)簽:service=alipay.wap.trade.create.direct&v=1.0&sec_id=0001¬ify_data=<notify>…</notify>6 Notification returning data processing6.1 html同步返回特性(1) 支付寶處理完請(qǐng)求的數(shù)據(jù)后,當(dāng)前界面會(huì)自動(dòng)刷新,立刻顯示處理結(jié)果;(2) 處理一次請(qǐng)求,當(dāng)前界面只跳轉(zhuǎn)回來一次,即只返回一次處理結(jié)果;(3) 由于沒有參數(shù)return_url來設(shè)置頁面跳轉(zhuǎn)同步通知頁面文件路徑,因此顯示處理結(jié)果的頁面文件所在位置是在支付寶的服務(wù)器中,即當(dāng)前頁面路徑地址是以支付寶的域名為開頭;(4) 該步驟可在本機(jī)電腦調(diào)試,無需到服務(wù)器上;(5) 處理結(jié)果顯示的格式是html格式;(6) 可對(duì)這個(gè)html格式的處理結(jié)果進(jìn)行html遠(yuǎn)程解析,使之能在支付寶處理結(jié)果時(shí)獲取到相關(guān)處理結(jié)果數(shù)據(jù),并對(duì)這個(gè)結(jié)果界面進(jìn)行商戶的業(yè)務(wù)邏輯處理;(7) 本地電腦或商戶服務(wù)器的配置上需支持html遠(yuǎn)程解析,如:需要支持SSL;(8) 頁面跳轉(zhuǎn)后,瀏覽器地址欄中的鏈接僅在一分鐘內(nèi)有效,超過一分鐘該鏈接地址會(huì)失效,導(dǎo)致該頁面中商戶編寫的業(yè)務(wù)邏輯程序無法完成處理。6.2 Page skipping synchronous notification page features(1) After the buyer pays successfully, a page prompt of successful trading will be seen; this page stops for several seconds, then the page will automatically skip to the designated synchronous page of commercial users (Parameter “call_back_url”).(2) The way of obtaining parameters at this page can be obtained in GET WAY, for example, request.QueryString("out_trade_no")、$_GET['out_trade_no'].(3) This way only automatically skip after the buyer completes payment, only once.(4) This way does not mean Alipay automatically recalling commercial users page, but Alipay program utilizes the function of page automatically skipping to make the user’s current page automatically skipping.(5) This way can be debugged on the machine, but not on the server;(6) Returning URL has only one-minute validity. The period more than one minute would make the link address invalid and the verification becomes failed.(7) When setting up page-skipping synchronous notification page path (call_back_url), page document shall not added with self-defined parameter. For example:Wrong format: http://www.alipay.com/alipay/return_url.php?xx=11Correct format: http://www.alipay.com/alipay/return_url.php(8) Alipay will check the legal validity of the domain name of synchronous notification page (call_back_url) of page skipping, thus when setting up page skipping synchronous notification page, the current computer domain shall not be set up. Special characters shall also not be affiliated with special characters (i.e. “!”), for example. Wrong format:http://localhost/alipay/return_url.phphttp://localhost:80/alipay/return_url.phphttp://www.xxx.com/alipay/return!url.do Correct format: Domain name addresses can be normally accessed: http://www.xxx.comalipay/return_url.php IP addresses can be normally accessed: http://121.1.1.255/alipay/return_url.php6.3 Page features of server asynchronous notification(1) It is mandatory to guarantee that server asynchronous notification page (notify_url) does not have any characters, such as space, HTML label, and abnormal prompt information throwing in development system.(2) Alipay uses POST way to send notification information, thus the way of obtaining parameters on the page like follows, request.Form("out_trade_no")、$_POST['out_trade_no'].(3)Alipay actively issues notification. This way can be started.(4) Only the trading is occurred in the transaction management of Alipay and change the trading status, Alipay can issue the server notification of the way (that is, Fastpay trading status “Waiting seller payment” default can not sent notification).(5) Interaction between servers would not display on the page like page skipping synchronous notification. This interacting way is invisible.(6) When changing the first trading status (the trading status is completed through trading in Fastpay), not only the page skipping synchronous notification can be started, but also server asynchronous notification page can receive the processing results notification sent by Alipay.(7) After executing program, it is a must to print output “success”(不包含引號(hào)、前后無空格和其他多余字符). If the characters given feedback from the commercial users are not “Success”, the Alipay server would repeatedly issue notification, until it exceeds 24 hours 22 minutes. Generally, eight notification will be completed within 25 hours (the interval frequency of notification is 2m,10m,10m,1h,2h,6h,15h generally)(8) After executing program, the page can not execute page skipping. If executing page skipping, Alipay can not receive “Success ” Character, it will be judged by Alipay server as abnormal page program and resending the notification of processing results.(9) 程序處理過程中出現(xiàn)異常時(shí)返回“fail”,這時(shí)支付寶服務(wù)器會(huì)選擇重發(fā)通知。(10) “cookies, session” would become invalid on this page, that is, these data can not be obtained.(11) The debugging and running of the way must be on the server, that is, can access on Internet.(12) The function of the way is aim to prevent order loss. That is, page skipping synchronous notification fails to process order upgrade, then it will process.(13) When the commercial users receives the asynchronous notification of server and prints “success”, the synchronous notification parameter “notify_id” would become valid. That is to say, when Alipay sends a same asynchronous notification (including commercial users failed to print “success” causing Alipay repeatedly sending several times of notification), server asynchronous notification parameter “notify_id” is unchangeable.(14) 異步通知在“交易成功”和“支付成功”狀態(tài)都會(huì)進(jìn)行通知發(fā)送,需正確處理通知時(shí)的交易狀態(tài),處理完成之后都需返回“success”,避免出現(xiàn)重復(fù)通知可能導(dǎo)致的業(yè)務(wù)重復(fù)處理錯(cuò)誤。6.4 Triggering conditions of notificationTable 6-1 notification triggering conditionsTriggering conditions name Description of triggering conditions Default value of triggering conditionsTRADE_FINISHED Successful trading true(triggered notification)TRADE_SUCCESS Successful payment true(triggered notification)WAIT_BUYER_PAY Created trading false(untriggered notification )TRADE_CLOSED Closed trading false(untriggered notification)6.5 商戶業(yè)務(wù)處理注意事項(xiàng) 授權(quán)接口當(dāng)支付寶處理完成后,支付寶會(huì)以html同步返回?cái)?shù)據(jù)的形式,把數(shù)據(jù)反饋給商戶網(wǎng)站。商戶可以利用編程方法來模擬http請(qǐng)求遠(yuǎn)程解析html獲得處理的結(jié)果數(shù)據(jù),增加商戶的業(yè)務(wù)邏輯處理程序。此時(shí),商戶必須判斷商戶網(wǎng)站中是否已經(jīng)對(duì)該次的結(jié)果數(shù)據(jù)做過同樣處理。如果不判斷,存在潛在的風(fēng)險(xiǎn),商戶自行承擔(dān)因此而產(chǎn)生的所有損失。 交易接口當(dāng)支付寶處理完成后,支付寶會(huì)把處理結(jié)果以當(dāng)前頁面跳轉(zhuǎn)同步通知和支付寶服務(wù)器主動(dòng)通知商戶網(wǎng)站兩種形式,反饋給商戶網(wǎng)站。商戶可以從頁面跳轉(zhuǎn)同步通知頁面或者從服務(wù)器異步通知頁面中獲得這些信息,并且在驗(yàn)證通過的判斷中增加商戶的業(yè)務(wù)邏輯處理程序。當(dāng)商戶有傳遞參數(shù)notify_url(服務(wù)器異步通知頁面路徑)或call_back_url(頁面跳轉(zhuǎn)同步通知頁面路徑)時(shí),商戶必須判斷商戶網(wǎng)站中是否已經(jīng)對(duì)該次的通知結(jié)果數(shù)據(jù)做過同樣處理。如果不判斷,存在潛在的風(fēng)險(xiǎn),商戶自行承擔(dān)因此而產(chǎn)生的所有損失。7 簽名機(jī)制7.1 生成待簽名的字符串7.1.1 需要參與簽名的參數(shù) 在請(qǐng)求參數(shù)列表中,除去sign參數(shù)外,其他需要使用到的參數(shù)皆是要簽名的參數(shù)。 在授權(quán)接口html返回參數(shù)列表中:正常返回的情況下,除去sign參數(shù)外,凡是返回回來的參數(shù)皆是要簽名的參數(shù);發(fā)生錯(cuò)誤的情況下,不需要簽名。 在交易接口通知返回參數(shù)列表中,除去sign參數(shù)外,凡是通知返回回來的參數(shù)皆是要簽名的參數(shù)。7.1.2 生成待簽名字符串對(duì)于如下的參數(shù)數(shù)組: 授權(quán)接口string[] parameters={"service=alipay.wap.trade.create.direct","req_data=<direct_trade_create_req><subject>彩票</subject><out_trade_no>1282889603601</out_trade_no><total_fee>10.01</total_fee><seller_account_name>[email protected]</seller_account_name><call_back_url>http://www.yoursite.com/waptest0504/servlet/CallBack</call_back_url><notify_url>http://www.yoursite.com/waptest0504/servlet/NotifyReceiver</notify_url><out_user>123456789</out_user><merchant_url>http://www.yoursite.com</merchant_url><pay_expire>3600</pay_expire></direct_trade_create_req>","partner=2088101000137799","req_id=1282889689836","sec_id=0001","format=xml ","v=2.0"}; 交易接口string[] parameters={"service=alipay.wap.auth.authAndExecute","req_data=<auth_and_execute_req><request_token>201008309e298cf01c58146274208eda1e4cdf2b</request_token></auth_and_execute_req>","partner=2088101000137799","sec_id=0001","format=xml","v=2.0",};對(duì)數(shù)組里的每一個(gè)值從a到z的順序排序,若遇到相同首字母,則看第二個(gè)字母,以此類推。排序完成之后,再把所有數(shù)組值以“&”字符連接起來,如: 授權(quán)接口format=xml&partner=2088101000137799&req_data=<direct_trade_create_req><subject>彩票</subject><out_trade_no>1282889603601</out_trade_no><total_fee>10.01</total_fee><seller_account_name>[email protected]</seller_account_name><call_back_url>http://www.yoursite.com/waptest0504/servlet/CallBack</call_back_url><notify_url>http://www.yoursite.com/waptest0504/servlet/NotifyReceiver</notify_url><out_user>123456789</out_user><merchant_url>http://www.yoursite.com</merchant_url><pay_expire>3600</pay_expire></direct_trade_create_req>&req_id=1282889689836&sec_id=0001&service=alipay.wap.trade.create.direct&v=2.0 交易接口format=xml&partner=2088101000137799&req_data=<auth_and_execute_req><request_token>201008309e298cf01c58146274208eda1e4cdf2b</request_token></auth_and_execute_req>&sec_id=0001&service=alipay.wap.auth.authAndExecute&v=2.0這串字符串便是待簽名字符串。注意: notify_url接受到的參數(shù)驗(yàn)簽不要排序,只需要按照支付寶返回的參數(shù)順序,組裝字符串,然后驗(yàn)簽,如支付寶異步通知POST方式返回的參數(shù)順序如下:service=alipay.wap.trade.create.direct&v=1.0&sec_id=0001¬ify_data=<notify>…</notify> 沒有值的參數(shù)無需傳遞,也無需包含到待簽名數(shù)據(jù)中; 簽名時(shí)將字符轉(zhuǎn)化成字節(jié)流時(shí)指定的字符集與_input_charset保持一致; 如果傳遞了_input_charset參數(shù),這個(gè)參數(shù)也應(yīng)該包含在待簽名數(shù)據(jù)中; 根據(jù)HTTP協(xié)議要求,傳遞參數(shù)的值中如果存在特殊字符(如:&、@等),那么該值需要做URL Encoding,這樣請(qǐng)求接收方才能接收到正確的參數(shù)值。這種情況下,待簽名數(shù)據(jù)應(yīng)該是原始值而不是encoding之后的值。例如:調(diào)用某接口需要對(duì)請(qǐng)求參數(shù)email進(jìn)行數(shù)字簽名,那么待簽名數(shù)據(jù)應(yīng)該是[email protected],而不是email=test%40msn.com。7.2 簽名7.2.1 MD5簽名在MD5簽名時(shí),需要私鑰參與簽名。MD5的私鑰是以英文字母和數(shù)字組成的32位字符串。商戶可登錄到商戶服務(wù)中心(https://b.alipay.com),安裝數(shù)字證書,在“技術(shù)服務(wù)”欄目中點(diǎn)擊“交易安全校驗(yàn)碼”,即可查看。 請(qǐng)求時(shí)簽名當(dāng)拿到請(qǐng)求時(shí)的待簽名字符串后,需要把私鑰直接拼接到待簽名字符串后面,形成新的字符串,利用MD5的簽名函數(shù)對(duì)這個(gè)新的字符串進(jìn)行簽名運(yùn)算,從而得到32位簽名結(jié)果字符串(該字符串賦值于參數(shù)sign)。 通知返回時(shí)驗(yàn)證簽名當(dāng)獲得到通知返回時(shí)的待簽名字符串后,同理,需要把私鑰直接拼接到待簽名字符串后面,形成新的字符串,利用MD5的簽名函數(shù)對(duì)這個(gè)新的字符串進(jìn)行簽名運(yùn)算,從而得到32位簽名結(jié)果字符串。此時(shí)這個(gè)新的字符串需要與支付寶通知返回參數(shù)中的參數(shù)sign的值進(jìn)行驗(yàn)證是否相等,來判斷簽名是否驗(yàn)證通過。7.2.2 DSA、RSA簽名在DSA或RSA的簽名時(shí),需要私鑰和公鑰一起參與簽名。私鑰與公鑰皆是客戶通過OPENSSL來生成得出的�?蛻舭焉沙龅墓與支付寶技術(shù)人員配置好的支付寶公鑰做交換。因此,在簽名時(shí),客戶要用到的是客戶的私鑰及支付寶的公鑰。 請(qǐng)求時(shí)簽名當(dāng)拿到請(qǐng)求時(shí)的待簽名字符串后,把待簽名字符串與客戶的私鑰一同放入DSA或RSA的簽名函數(shù)中進(jìn)行簽名運(yùn)算,從而得到簽名結(jié)果字符串。 解密當(dāng)獲得到通知返回時(shí)的原始數(shù)據(jù)后,首先要對(duì)加密的參數(shù)做解密。 在授權(quán)接口中,要解密的返回參數(shù)是“res_data”。 在交易接口中,要解密的返回參數(shù)是“notify_data”。即把res_data或notify_data、商戶私鑰一同放入RSA的解密函數(shù)中進(jìn)行解密運(yùn)算,從而得到解密結(jié)果字符串。 通知返回時(shí)驗(yàn)證簽名當(dāng)獲得到通知返回時(shí)的待簽名字符串后,把待簽名字符串、支付寶提供的公鑰、支付寶通知返回參數(shù)中的參數(shù)sign的值三者一同放入DSA或RSA的簽名函數(shù)中進(jìn)行非對(duì)稱的簽名運(yùn)算,來判斷簽名是否驗(yàn)證通過。8 建議與意見如果您在閱讀技術(shù)文檔時(shí)有任何建議和意見,請(qǐng)點(diǎn)擊下面的鏈接跟帖回復(fù),我們將根據(jù)您的反饋完善文檔內(nèi)容。http://club.alipay.com/read.php?tid=8684674&fid=7039 附錄9.1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼表9-1 手機(jī)網(wǎng)頁即時(shí)到賬業(yè)務(wù)錯(cuò)誤碼錯(cuò)誤代碼(code) 錯(cuò)誤原因(msg) 錯(cuò)誤詳細(xì)描述(detail) 含義0000 system exception 系統(tǒng)異常 系統(tǒng)異常0001 common params illegal 通用參數(shù)中少了如service、partner等必填參數(shù) 缺少必要的參數(shù),請(qǐng)檢查非空參數(shù)是否已傳遞0002 sign illegal 簽名不正確 簽名錯(cuò)誤,請(qǐng)檢查簽名的參數(shù)是否符合支付寶簽名規(guī)范0003 service not exist 不存在對(duì)應(yīng)的service 服務(wù)接口錯(cuò)誤,請(qǐng)檢查service是否傳遞正確0004 req_data illegal req_data沒有按照<req>…<req>格式要求填寫 req_data格式不正確0005 partner illegal 合作伙伴沒有開通接口訪問權(quán)限 商戶未開通接口權(quán)限或合同已過期0006 sec_id not exist 不存在對(duì)應(yīng)的sec_id sec_id(簽名算法)不正確,支持0001(RSA)和MD50007 biz params illegal 缺少了非空的業(yè)務(wù)參數(shù) 缺少非空業(yè)務(wù)參數(shù)0008 biz params too long 業(yè)務(wù)參數(shù)超出長度限制 業(yè)務(wù)參數(shù)超出長度限制0009 seller_account_not_match 賣家賬號(hào)不匹配 商戶不在受限列表中9.2 交易狀態(tài)表9-2 交易狀態(tài)枚舉名稱 枚舉說明WAIT_BUYER_PAY 交易創(chuàng)建,等待買家付款。TRADE_CLOSED 在指定時(shí)間段內(nèi)未支付時(shí)關(guān)閉的交易;在交易完成全額退款成功時(shí)關(guān)閉的交易。TRADE_SUCCESS 交易成功,且可對(duì)該交易做操作,如:多級(jí)分潤、退款等。TRADE_PENDING 等待賣家收款(買家付款后,如果賣家賬號(hào)被凍結(jié))。TRADE_FINISHED 交易成功且結(jié)束,即不可再做任何操作世聯(lián)翻譯-讓世界自由溝通!專業(yè)的全球語言翻譯供應(yīng)商,上海翻譯公司專業(yè)品牌。絲路沿線56種語言一站式翻譯與技術(shù)解決方案,專業(yè)英語翻譯、日語翻譯等文檔翻譯、同傳口譯、視頻翻譯、出國外派服務(wù),加速您的全球交付。 世聯(lián)翻譯公司在北京、上海、深圳等國際交往城市設(shè)有翻譯基地,業(yè)務(wù)覆蓋全國城市。每天有近百萬字節(jié)的信息和貿(mào)易通過世聯(lián)走向全球!積累了大量政商用戶數(shù)據(jù),翻譯人才庫數(shù)據(jù),多語種語料庫大數(shù)據(jù)。世聯(lián)品牌和服務(wù)品質(zhì)已得到政務(wù)防務(wù)和國際組織、跨國公司和大中型企業(yè)等近萬用戶的認(rèn)可。