习惯了支付宝的ISV调用时,app_auth_token放到第三个参数。
比如:
response = alipayClient.execute(request,null,token);
今天在做WAP支付的时候发现
form = alipayClient.pageExecute(request).getBody(); //调用SDK生成表单
没有第三个参数!!!!!!!
然后:
百度无果,只好谷歌,找到了解决方案。
request.putOtherTextParam("app_auth_token", config.getApp_auth_token()); form = alipayClient.pageExecute(request).getBody(); //调用SDK生成表单
要单独放。
顺带附上我搜到的,其他几个语言的设置方法
参数:app_auth_token
类型:String(40)
是否必填:否
使用场景:商户对开发者进行应用授权后,开发者可以帮助商户完成相应的业务逻辑,例如服务商代替商户发起当面付的收单请求。
不同开发语言设置app_auth_token的方式不同,具体请查看对应示例:
1、Java开发语言:
//(1)execute(如当面付接口): response = alipayClient.execute(request,null,"app_auth_token参数值"); request.putOtherTextParam("app_auth_token", "app_auth_token参数值");//(2)pageExecute(如电脑网站支付、手机网站支付): request.putOtherTextParam("app_auth_token", "app_auth_token参数值");//(3)sdkexecute(如app支付): request.putOtherTextParam("app_auth_token", "app_auth_token参数值");
2、PHP开发语言:
//(1)execute(如当面付接口): $result = $aop->execute ($request,null,$app_auth_token);//(2)pageExecute(如电脑网站支付、手机网站支付): $result = $aop->pageExecute($request,null,$app_auth_token);//(3)sdkexecute(如app支付): $result = $aop->sdkExecute($request,$app_auth_token);
3、.net开发语言:
//(1)execute(如当面付接口): response=client.Execute(request, null, appAuthToken);//(2)pageExecute(如电脑网站支付、手机网站支付): response=client.pageExecute(request,null,appAuthToken,string reqMethod); //ps:string reqMethod可填写成post或者GET(大写)对应着生成的请求字符串是以form表单格式输出还是请求字符串数据输出。不设置该参数,为空默认传递post,生成的是以form表单的格式数据输出//(3)sdkExecute(如app支付): response =client.sdkExecute(request,appAuthToken);
4、python开发语言:
在udf_params参数内传递auth_token、app_auth_token等其他公共参数,需要引入from alipay.aop.api.constant.ParamConstants import * 方法
udf_params = dict()#传递app_auth_token方法udf_params[P_APP_AUTH_TOKEN] = "app_auth_token参数值"#传递auth_token方法udf_params[P_AUTH_TOKEN] = "auth_token参数值"request.udf_params = udf_params
5、node.js开发语言:
//(1)使用formData方式传递生成请求参数(如电脑网站支付、手机网站支付、app支付) formData.addField('app_auth_token', 'app_auth_token参数值');//(2)不使用formData方式传递,直接提交获取响应数据(如当面付接口) const result =alipaySdk.exec('alipay.trade.precreate',{ //传递app_auth_token方法 appAuthToken:"app_auth_token参数值", bizContent: {}, }