- 行业新闻
-
上海翻译公司完成电子系统“即时到账接口 ”中文翻译
发布时间:2019-08-28 16:08 点击:
上海翻译公司完成电子系统“即时到账接口 ”中文翻译手机网页即时到账接口服务名称: alipay.wap.trade.create.direct alipay.wap.auth.authAndExecute版本号:1.2支付宝(中国)网络技术有限公司 版权所有1 Document description1.1 Function Description“手机网页即时到账授权接口(alipay.wap.trade.create.direct)”和“手机网页即时到账交易接口(alipay.wap.auth.authAndExecute)”配套使用,共同完成即时到账交易。授权接口用于存储商户创建交易所需信息,并返回一个授权令牌(request_token);交易接口使用授权接口返回的授权令牌(request_token)值,将页面重定向到支付宝支付页面,使得付款者可以直接汇款给另一个拥有支付宝账号的收款者。授权接口并未实际创建即时到账交易,创建即时到账交易并且完成支付的过程由交易接口完成。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.支付失败 余额不足、超额、交易被冻结、账号被冻结、订单已支付、订单金额和支付金额不一致等都会导致支付失败。2 Function demonstration图2-1 手机网页即时到账业务流程图步骤1: 获取token授权令牌商户调用“手机网页即时到账授权接口(alipay.wap.trade.create.direct)”,向支付宝发送订单信息,以获取token授权令牌。步骤2: 即时到账交易付款商户调用“手机网页即时到账交易接口(alipay.wap.auth.authAndExecute)”,验证token值,并创建支付宝交易后完成支付,通知商户并跳转回商户指定页面链接。3 Data interactionFigure 3-1 Commercial user system requirement-Payment affects interactional mode合作商户系统 System of commercial user in cooperation支付宝系统 Alipay system构造请求数据 Structure request data发送请求数据 Issuing requirement data请求的交易 Requested transaction返回相应数据 Return he corresponding data对相应的数据进行处理 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 授权接口支付宝会把处理完成的结果数据以html的形式返回给商户。 交易接口As for the transaction after completing processing, Alipay will give feedback to commercial user website in the following ways.– 程序上自动进行重新构造URL地址链接,在用户当前页面上通过自动跳转的方式跳回商户在请求时设定好的页面路径地址(参数call_back_url,在“手机网页即时到账授权接口(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专业翻译公司 授权接口专业翻译公司商户利用编程方法来模拟http请求远程解析html,获取支付宝返回的结果数据后,可以结合自身网站的业务逻辑进行数据处理。 交易接口商户在同步通知处理页面(参数call_back_url指定页面文件)或服务器异步通知页面(参数notify_url指定页面文件)获取支付宝返回的结果数据后,可以结合自身网站的业务逻辑进行数据处理(如:订单更新、自动充值到会员账号中等)。4 Request parameters4.1 授权接口请求参数说明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 请求参数格式 String 请求参数格式。固定取值xml。 Not Full xmlv 接口版本号 String 接口版本号。固定取值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 请求号 String(32) 用于关联请求与响应,防止请求重播。支付宝限制来自同一个partner的请求号必须唯一。 Not Full 1282889689836sec_id 签名方式 对参数签名的方式。取值范围:0001:RSA签名算法MD5:MD5签名算法Not Full 0001sign 签名 String 对请求或响应中参数签名后的值。 Not Full VRVr7adPfsHblFjiBkGWryhKIKt+CaI4Cq2MA2wG1ENVuBAyFDlp3FbttndmID0USlfn22a9/6fQ+X+KPDE09hcTNz3gJ1edUiDWxHXY/ahTexCP79SDtoHx29uepXsHBe32DP0k9jZbfhpT8Ly0+ksuo5VJO0iymxQ87hQPjJw=Business parametersParameters Parameter name Type (field length) Parameter description Null or not Samplesreq_data 请求业务参数 String 请求业务参数请参考“表4-2 req_data请求业务参数列表”。<direct_trade_create_req>:根节点<subject>:商品名称<out_trade_no>:商户网站唯一订单号<total_fee>:交易金额<seller_account_name>:卖家支付宝账号<call_back_url>:支付成功跳转页面路径<notify_url>:服务器异步通知页面路径<out_user>:商户系统用户唯一标识<merchant_url>:操作中断返回地址<pay_expire>:交易自动关闭时间 Not Full <direct_trade_create_req><subject>彩票</subject><out_trade_no>1282889603601</out_trade_no><total_fee>10.01</total_fee><seller_account_name>chenf003@yahoo.cn</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请求业务参数列表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],精确到小数点后两位。 Not Full 10.01seller_account_name Seller Alipay account String(100) 卖家的支付宝账号。交易成功后,买家资金会转移到该账户中。 Not Full chenf003@yahoo.cncall_back_url 支付成功跳转页面路径 String(200) 支付成功后的跳转页面链接。支付成功才会跳转。 Not Full http://www.yoursite.com/waptest0504/servlet/CallBacknotify_url 服务器异步通知页面路径 String(200) 支付宝服务器主动通知商户网站里指定的页面http路径。 Full http://www.yoursite.com/waptest0504/servlet/NotifyReceiverout_user 商户系统用户唯一标识 String(32) 买家在商户系统的唯一标识。当该买家支付成功一次后,再次支付金额在30元内时,不需要再次输入密码。 Full 123456789merchant_url 操作中断返回地址 String 用户付款中途退出返回商户的地址。 Full http://www.yoursite.compay_expire 交易自动关闭时间 String 交易自动关闭时间,单位为分钟。默认值21600(即15天)。 Full 3600说明: req_data参数的值不能包含半角或全角的“&”符号; 部分参数类型为String,未指明长度范围,表明系统不校验该参数的长度。4.1.3 Samples说明: 本样例仅供参考,支付宝网关为http://wappaygw.alipay.com/service/rest.htm。 蓝色为必填参数,绿色为固定值参数,红色为选填参数。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>chenf003@yahoo.cn</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 交易接口请求参数说明4.2.1 Meaning请求参数是商户在与支付宝进行数据交互时,提供给支付宝的请求数据,以便支付宝根据这些数据进一步处理。4.2.2 列表表4-3 请求参数说明Parameters Parameter name Type (field length) Parameter description Null or not SamplesBasic parametersservice Interface name String Interface name Not Full alipay.wap.auth.authAndExecuteformat 请求参数格式 String 请求参数格式。固定取值xml。 Not Full xmlv 接口版本号 String 接口版本号。固定取值2.0。 Not Full 2.0partner 合作者身份ID String(16) 商户签约的支付宝账号对应的支付宝唯一用户号。以2088开头的16位纯数字组成。 Not Full 2088101000137799sec_id 签名方式 String 对参数签名的方式。取值范围:0001:RSA签名算法MD5:MD5签名算法 Not Full 0001sign 签名 String 对请求或响应中参数签名后的值。 Not Full LdXbwMLug8E4UjfJMuYv2KoD5X5F3vHGQsQbZ/rdEQ3eaN4FPal7rhsbZZ/+ZUL1kAKzTQSDdMk87MEWtWO1Yq6rhnt2Tv8Hh6Hb16211VXKgbBCpq861+LopRwegPbGStcwBuAyE4pi6fYlJ6gxzL4tMyeLe+T5XZ0RKRUk00U=Business parametersreq_data 请求业务参数 String 请求业务参数请参考“表4-4 req_data请求业务参数列表”。<auth_and_execute_req>:根节点<request_token>:授权令牌 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 授权令牌 String(40) 授权令牌,调用“手机网页即时到账授权接口(alipay.wap.trade.create.direct)”成功后返回该值。此参数值不能更改。 Not Full 201008309e298cf01c58146274208eda1e4cdf2b说明: 只有支付成功时才会跳转到call_back_url,支付失败时跳转到merchant_url(不返回任何参数),跳转地址都在“手机网页即时到账授权接口(alipay.wap.trade.create.direct)”中设置。 部分参数类型为String,未指明长度范围,表明系统不校验该参数的长度。4.2.3 Samples说明: 本样例仅供参考,支付宝网关为http://wappaygw.alipay.com/service/rest.htm。 所有参数都必传,蓝色为可变值参数,绿色为固定值参数。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 返回参数5.1 授权接口html同步返回参数说明5.1.1 Meaning支付宝对商户提供的请求数据进行处理后,返回给商户结果数据,以便商户根据这些数据进一步处理。5.1.2 列表表5-1 html同步返回参数说明Parameters Parameter name Type (length scope) Parameter description Null or not SamplesBasic parameterspartner 合作者身份ID String(16) 商户签约的支付宝账号对应的支付宝唯一用户号。以2088开头的16位纯数字组成。 Not Full 2088101000137799req_id 请求号 String(32) 用于关联请求与响应,防止请求重播。支付宝限制来自同一个partner的请求号必须唯一。 Not Full 1282889689836sec_id 签名方式 String 对参数签名的方式。取值范围:0001:RSA签名算法MD5:MD5签名算法 Not Full MD5service 接口名称 String 接口名称。 Not Full alipay.wap.trade.create.directv 接口版本号 String 接口版本号。固定取值2.0。 Not Full 2.0sign 签名 String 对请求或响应中参数签名后的值。请求失败的请况下,不签名,无此参数。 可空 72a64fb63f0b54f96b10cefb69319e8aBusiness parametersres_data 返回业务参数 String 返回业务参数,参见“5.1.2 1. res_data返回业务参数”。请求成功后才会返回该值。包含接口返回的最重要的授权令牌request_token。<direct_trade_create_res>:请求根节点<request_token>:授权令牌值 Full <?xmlversion="1.0" encoding="utf-8"?><direct_trade_create_res><request_token>20100830e8085e3e0868a466b822350ede5886e8</request_token></direct_trade_create_res>res_error 返回错误参数 String 返回错误参数,参见“2. res_error返回错误参数”。请求失败后才会返回该值。包含请求失败的错误码和错误原因。<err>:返回错误根节点<code>、<sub_code>:错误编码(目前两个值相同)<msg>:错误信息 <detail>:错误详细描述参见“9.1 手机网页即时到账业务错误码”。 Full <?xml version="1.0" encoding="utf-8"?><err><code>0005</code><sub_code>0005</sub_code><msg>partner illegal</msg><detail>合作伙伴没有开通接口访问权限</detail></err>1. res_data返回业务参数表5-2 res_data返回业务参数列表Parameters Parameter name Type (length scope) Parameter description Null or not Samplesrequest_token 授权令牌 String 授权令牌,请求成功后才会返回该值。 Not Full 20100830e8085e3e0868a466b822350ede5886e82. res_error返回错误参数表5-3 res_error返回错误参数列表Parameters Parameter name 类型(长度范围) Parameter description Null or not Samplescode 错误代码 String 请求失败时,返回的错误代码,对应“9.1 手机网页即时到账业务错误码”中的“错误代码(code)”。 Not Full 0005sub_code 错误子代码 String 预留参数,目前和code参数值一致。 Not Full 0005msg 错误原因 String 错误原因,对应“9.1 手机网页即时到账业务错误码”中的“错误原因(msg)”。 Not Full partner illegaldetail 错误详细描述 String 错误详细描述,对应“9.1 手机网页即时到账业务错误码”中的“错误详细描述(detail)”。 Not Full 合作伙伴没有开通接口访问权限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 发生错误时输出: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>合作伙伴没有开通接口访问权限</detail></err>&sec_id=0001&service=alipay.wap.trade.create.direct&v=2.05.2 交易接口页面跳转同步通知参数说明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方式访问商户网站(参数call_back_url,在“手机网页即时到账授权接口(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 对请求或响应中参数签名后的值。 Not Full 49a330fee069465c64e561a25bf31c78result 支付结果 String 判断支付结果及交易状态。只有支付成功时(即result=success),才会跳转到支付成功页面,result有且只有success一个交易状态。 Not Full successout_trade_no 商户网站唯一订单号 String(64) 支付宝合作商户网站唯一订单号。 Not Full 1320742949342trade_no 支付宝交易号 String(32) 该交易在支付宝系统中的交易流水号。最短16位,最长64位。 Not Full 2011110823389231request_token 授权令牌 String(40) 授权令牌,调用“手机网页即时到账授权接口(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说明: 本样例仅供参考,实际网关为商户域名。 如果支付失败,直接跳转“手机网页即时到账授权接口(alipay.wap.trade.create.direct)”中传递的merchant_url参数,跳转merchant_url时不回传参数。5.3 交易接口服务器异步通知参数说明5.3.1 Meaning支付宝对商户的请求数据处理完成后,会将处理的结果数据通过服务器主动通知的方式通知给商户网站。这些处理结果数据就是服务器异步通知参数。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 接口版本号 String 接口版本号。固定取值1.0。 Not Full 1.0sec_id Signature way String 对参数签名的方式。取值范围:0001:RSA签名算法MD5:MD5签名算法 Not Full 0001sign Signature String 对请求或响应中参数签名后的值。 Not Full Rw/y4ROnNicXhaj287Fiw5pvP6viSyg53H3iNiJ61D3YVi7zGniG2680pZv6rakMCeXX++q9XRLw8Rj6I1//qHrwMAHS1hViNW6hQYsh2TqemuL/xjXRCY3vjm1HCoZOUa5zF2jU09yG23MsMIUx2FAWCL/rgbcQcOjLe5FugTc=Business parametersnotify_data 通知业务参数 String 通知的业务参数,参见“表5-6 notify_data通知业务参数列表”。<notify>:通知根节点<payment_type>:支付类型<subject>:商品名称<trade_no>:支付宝交易号<buyer_email>:买家支付宝账号<gmt_create>:交易创建时间<notify_type>:通知类型<quantity>:购买数量<out_trade_no>:商户网站唯一订单号<notify_time>:通知时间<seller_id>:卖家支付宝账户号<trade_status>:交易状态<is_total_fee_adjust>:是否调整总价<total_fee>:交易金额<gmt_payment>:交易付款时间<seller_email>:卖家支付宝账号<gmt_close>:交易关闭时间<price>:商品单价<buyer_id>:买家支付宝用户号<notify_id>:通知校验ID<use_coupon>:是否使用红包买家 Not Full <notify><payment_type>1</payment_type><subject>收银台{1283134629741}</subject><trade_no>2010083000136835</trade_no><buyer_email>dinglang@a.com</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>chenf003@yahoo.cn</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通知业务参数列表Parameters Parameter name Type (field length) Parameter description Null or not Samplespayment_type 支付方式 String 用户的支付方式:1:商品购买;4:捐赠。 Not Full 1subject 商品名称 String(256) 商品的标题/交易标题/订单标题/订单关键字等。它在支付宝的交易明细中排在第一列,对于财务对账尤为重要。是请求时对应的参数,原样通知回来。 Not Full 收银台{1283134629741}trade_no 支付宝交易号 String(32) 该交易在支付宝系统中的交易流水号。最短16位,最长64位。 Not Full 2010083000136835buyer_email 买家支付宝账号 String(100) 买家支付宝账号,可以是email或手机号码。 Not Full dinglang@a.comgmt_create 交易创建时间 String 该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:17:24notify_type 通知类型 String 通知的类型。固定值。 Not Full trade_status_syncquantity 购买数量 String 购买商品的数量。 Not Full 1out_trade_no 商户网站唯一订单号 String(64) 对应商户网站的订单系统中的唯一订单号,非支付宝交易号。需保证在商户网站中的唯一性。是请求时对应的参数,原样返回。 Not Full 1283134629741notify_time 通知时间 String 通知的发送时间。格式为yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:18:15seller_id 卖家支付宝用户号 String 卖家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字。 Not Full 2088101000137799trade_status 交易状态 String 交易的状态,取值范围参见“9.2 交易状态”。 Not Full TRADE_FINISHEDis_total_fee_adjust 是否调整总价 String 该交易是否调整过价格。本接口创建的交易不会被修改总价,固定值为N。 Not Full Ntotal_fee 交易金额 String(15) 该笔订单的总金额。请求时对应的参数,原样通知回来。 Not Full 1.00gmt_payment 交易付款时间 String 该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss。如果交易未付款,则不返回该参数。 Full 2010-08-30 10:18:26seller_email 卖家支付宝账号 String(100) 卖家支付宝账号,可以是email和手机号码。 Not Full chenf003@yahoo.cngmt_close 交易关闭时间 String 交易关闭时间。格式为yyyy-MM-dd HH:mm:ss。 Not Full 2010-08-30 10:18:26price 商品单价 String 目前和total_fee值相同。单位:元。不应低于0.01元。 Not Full 1.00buyer_id 买家支付宝用户号 String 买家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字。 Not Full 2088102001172352notify_id 通知校验ID String 通知校验ID。唯一识别通知内容。重发相同内容的通知时,该值不变。 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签名时收到支付宝的通知请求样例如下: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参数值为加密内容,商户需用自己的RSA私钥先进行解密后再验签。 商户使用MD5签名时收到支付宝的通知样例如下: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%3Edinglang@a.com%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%3Echenf003@yahoo.cn%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参数值为明文内容,无需解密。 支付宝系统通知待签名数据构造规则比较特殊,为固定顺序。例如商户收到如下通知数据: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>则只需对以下数据进行验签:service=alipay.wap.trade.create.direct&v=1.0&sec_id=0001¬ify_data=<notify>…</notify>6 Notification returning data processing6.1 html同步返回特性(1) 支付宝处理完请求的数据后,当前界面会自动刷新,立刻显示处理结果;(2) 处理一次请求,当前界面只跳转回来一次,即只返回一次处理结果;(3) 由于没有参数return_url来设置页面跳转同步通知页面文件路径,因此显示处理结果的页面文件所在位置是在支付宝的服务器中,即当前页面路径地址是以支付宝的域名为开头;(4) 该步骤可在本机电脑调试,无需到服务器上;(5) 处理结果显示的格式是html格式;(6) 可对这个html格式的处理结果进行html远程解析,使之能在支付宝处理结果时获取到相关处理结果数据,并对这个结果界面进行商户的业务逻辑处理;(7) 本地电脑或商户服务器的配置上需支持html远程解析,如:需要支持SSL;(8) 页面跳转后,浏览器地址栏中的链接仅在一分钟内有效,超过一分钟该链接地址会失效,导致该页面中商户编写的业务逻辑程序无法完成处理。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”(不包含引号、前后无空格和其他多余字符). 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) 程序处理过程中出现异常时返回“fail”,这时支付宝服务器会选择重发通知。(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) 异步通知在“交易成功”和“支付成功”状态都会进行通知发送,需正确处理通知时的交易状态,处理完成之后都需返回“success”,避免出现重复通知可能导致的业务重复处理错误。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 商户业务处理注意事项 授权接口当支付宝处理完成后,支付宝会以html同步返回数据的形式,把数据反馈给商户网站。商户可以利用编程方法来模拟http请求远程解析html获得处理的结果数据,增加商户的业务逻辑处理程序。此时,商户必须判断商户网站中是否已经对该次的结果数据做过同样处理。如果不判断,存在潜在的风险,商户自行承担因此而产生的所有损失。 交易接口当支付宝处理完成后,支付宝会把处理结果以当前页面跳转同步通知和支付宝服务器主动通知商户网站两种形式,反馈给商户网站。商户可以从页面跳转同步通知页面或者从服务器异步通知页面中获得这些信息,并且在验证通过的判断中增加商户的业务逻辑处理程序。当商户有传递参数notify_url(服务器异步通知页面路径)或call_back_url(页面跳转同步通知页面路径)时,商户必须判断商户网站中是否已经对该次的通知结果数据做过同样处理。如果不判断,存在潜在的风险,商户自行承担因此而产生的所有损失。7 签名机制7.1 生成待签名的字符串7.1.1 需要参与签名的参数 在请求参数列表中,除去sign参数外,其他需要使用到的参数皆是要签名的参数。 在授权接口html返回参数列表中:正常返回的情况下,除去sign参数外,凡是返回回来的参数皆是要签名的参数;发生错误的情况下,不需要签名。 在交易接口通知返回参数列表中,除去sign参数外,凡是通知返回回来的参数皆是要签名的参数。7.1.2 生成待签名字符串对于如下的参数数组: 授权接口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>chenf003@yahoo.cn</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",};对数组里的每一个值从a到z的顺序排序,若遇到相同首字母,则看第二个字母,以此类推。排序完成之后,再把所有数组值以“&”字符连接起来,如: 授权接口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>chenf003@yahoo.cn</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接受到的参数验签不要排序,只需要按照支付宝返回的参数顺序,组装字符串,然后验签,如支付宝异步通知POST方式返回的参数顺序如下:service=alipay.wap.trade.create.direct&v=1.0&sec_id=0001¬ify_data=<notify>…</notify> 没有值的参数无需传递,也无需包含到待签名数据中; 签名时将字符转化成字节流时指定的字符集与_input_charset保持一致; 如果传递了_input_charset参数,这个参数也应该包含在待签名数据中; 根据HTTP协议要求,传递参数的值中如果存在特殊字符(如:&、@等),那么该值需要做URL Encoding,这样请求接收方才能接收到正确的参数值。这种情况下,待签名数据应该是原始值而不是encoding之后的值。例如:调用某接口需要对请求参数email进行数字签名,那么待签名数据应该是email=test@msn.com,而不是email=test%40msn.com。7.2 签名7.2.1 MD5签名在MD5签名时,需要私钥参与签名。MD5的私钥是以英文字母和数字组成的32位字符串。商户可登录到商户服务中心(https://b.alipay.com),安装数字证书,在“技术服务”栏目中点击“交易安全校验码”,即可查看。 请求时签名当拿到请求时的待签名字符串后,需要把私钥直接拼接到待签名字符串后面,形成新的字符串,利用MD5的签名函数对这个新的字符串进行签名运算,从而得到32位签名结果字符串(该字符串赋值于参数sign)。 通知返回时验证签名当获得到通知返回时的待签名字符串后,同理,需要把私钥直接拼接到待签名字符串后面,形成新的字符串,利用MD5的签名函数对这个新的字符串进行签名运算,从而得到32位签名结果字符串。此时这个新的字符串需要与支付宝通知返回参数中的参数sign的值进行验证是否相等,来判断签名是否验证通过。7.2.2 DSA、RSA签名在DSA或RSA的签名时,需要私钥和公钥一起参与签名。私钥与公钥皆是客户通过OPENSSL来生成得出的。客户把生成出的公钥与支付宝技术人员配置好的支付宝公钥做交换。因此,在签名时,客户要用到的是客户的私钥及支付宝的公钥。 请求时签名当拿到请求时的待签名字符串后,把待签名字符串与客户的私钥一同放入DSA或RSA的签名函数中进行签名运算,从而得到签名结果字符串。 解密当获得到通知返回时的原始数据后,首先要对加密的参数做解密。 在授权接口中,要解密的返回参数是“res_data”。 在交易接口中,要解密的返回参数是“notify_data”。即把res_data或notify_data、商户私钥一同放入RSA的解密函数中进行解密运算,从而得到解密结果字符串。 通知返回时验证签名当获得到通知返回时的待签名字符串后,把待签名字符串、支付宝提供的公钥、支付宝通知返回参数中的参数sign的值三者一同放入DSA或RSA的签名函数中进行非对称的签名运算,来判断签名是否验证通过。8 建议与意见如果您在阅读技术文档时有任何建议和意见,请点击下面的链接跟帖回复,我们将根据您的反馈完善文档内容。http://club.alipay.com/read.php?tid=8684674&fid=7039 附录9.1 手机网页即时到账业务错误码表9-1 手机网页即时到账业务错误码错误代码(code) 错误原因(msg) 错误详细描述(detail) 含义0000 system exception 系统异常 系统异常0001 common params illegal 通用参数中少了如service、partner等必填参数 缺少必要的参数,请检查非空参数是否已传递0002 sign illegal 签名不正确 签名错误,请检查签名的参数是否符合支付宝签名规范0003 service not exist 不存在对应的service 服务接口错误,请检查service是否传递正确0004 req_data illegal req_data没有按照<req>…<req>格式要求填写 req_data格式不正确0005 partner illegal 合作伙伴没有开通接口访问权限 商户未开通接口权限或合同已过期0006 sec_id not exist 不存在对应的sec_id sec_id(签名算法)不正确,支持0001(RSA)和MD50007 biz params illegal 缺少了非空的业务参数 缺少非空业务参数0008 biz params too long 业务参数超出长度限制 业务参数超出长度限制0009 seller_account_not_match 卖家账号不匹配 商户不在受限列表中9.2 交易状态表9-2 交易状态枚举名称 枚举说明WAIT_BUYER_PAY 交易创建,等待买家付款。TRADE_CLOSED 在指定时间段内未支付时关闭的交易;在交易完成全额退款成功时关闭的交易。TRADE_SUCCESS 交易成功,且可对该交易做操作,如:多级分润、退款等。TRADE_PENDING 等待卖家收款(买家付款后,如果卖家账号被冻结)。TRADE_FINISHED 交易成功且结束,即不可再做任何操作世联翻译-让世界自由沟通!专业的全球语言翻译供应商,上海翻译公司专业品牌。丝路沿线56种语言一站式翻译与技术解决方案,专业英语翻译、日语翻译等文档翻译、同传口译、视频翻译、出国外派服务,加速您的全球交付。 世联翻译公司在北京、上海、深圳等国际交往城市设有翻译基地,业务覆盖全国城市。每天有近百万字节的信息和贸易通过世联走向全球!积累了大量政商用户数据,翻译人才库数据,多语种语料库大数据。世联品牌和服务品质已得到政务防务和国际组织、跨国公司和大中型企业等近万用户的认可。