开发者社区
社区提问意见反馈
开发者钉组织
扫描二维码
加入支付宝开发者钉组织
文档中心
api 
卡券模板创建接口
收藏
我的文档
设置
创建卡券的模板,卡券的样式、内容信息通过该接口提交到支付宝,支付宝会生成模板id反馈给开发者,用于后续的更新和发布。

公共请求参数

参数类型是否必选最大长度描述示例值
app_idstring必选32
支付宝分配给开发者的应用id
2014072300007148
methodstring必选128
接口名称
alipay.pass.template.add
formatstring可选40
仅支持json
json
charsetstring必选10
请求使用的编码格式,如utf-8,gbk,gb2312等
utf-8
sign_typestring必选10
商户生成签名字符串所使用的签名算法类型,目前支持rsa2和rsa,推荐使用rsa2
rsa2
signstring必选344
商户请求参数的签名串,详见签名
详见示例
timestampstring必选19
发送请求的时间,格式"yyyy-mm-dd hh:mm:ss"
2014-07-24 03:07:50
versionstring必选3
调用的接口版本,固定为:1.0
1.0
app_auth_tokenstring可选40
biz_contentstring必选
请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档

业务请求参数

unique_id必选string(999)
【描述】商户用于控制模版的唯一性。(可以使用时间戳保证唯一性)
【示例值】20140709150010
tpl_content必选string(99999)
【描述】模板内容信息,遵循json规范,详情参见tpl_content 参数详细说明
【示例值】{"logo": "","strip": null,"icon": null,"content": {}}
常见请求示例
alipayclient alipayclient = new defaultalipayclient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","gbk","alipay_public_key","rsa2");
alipaypasstemplateaddrequest request = new alipaypasstemplateaddrequest();
request.setbizcontent("{" 
"  \"unique_id\":\"20140709150010\"," 
"  \"tpl_content\":\"{\\\"logo\\\": \\\"\\\",\\\"strip\\\": null,\\\"icon\\\": null,\\\"content\\\": {}}\"" 
"}");
alipaypasstemplateaddresponse response = alipayclient.execute(request);
if(response.issuccess()){
system.out.println("调用成功");
} else {
system.out.println("调用失败");
}
说明:本示例仅供参考。

公共响应参数

参数类型是否必选最大长度描述示例值
codestring必选-
网关返回码,
40004
msgstring必选-
网关返回码描述,
business failed
sub_codestring可选-
业务返回码,参见具体的api接口文档
acq.trade_has_success
sub_msgstring可选-
业务返回码描述,参见具体的api接口文档
交易已被支付
signstring必选-
签名,
dzxh8eetuahoye3w1j poiphfdxoybfunn1lket/v7p4zjdyojwea6izs6hz0ydw5cp/viufub5i0/v5wens3oyr8zredqo6d futdlhdc efyckiqhbxizgngpdpdfp1pis7bdhhzrszhbrqb7o4k3dxc aanfauu4v6zdwczo=

业务响应参数

success必选string(99)
【描述】操作成功标识【true:成功;false:失败】
【示例值】true
result必选string(9999)
【描述】接口调用返回结果信息(json字串):
errorcode:处理结果码(错误码);
errormsg:处理结果说明(错误说明);
tpl_id:模板编号,预期在调发券接口时必须传入;
tpl_params:动态参数(变量)列表,预期在调发券接口时传入;
【示例值】{"errorcode":"kp.ae_success","errormsg":"处理成功","tpl_id":"2017032xxxxxxxx","tpl_params":["title","channelid","serialnumber"]}
响应示例
{
    "alipay_pass_template_add_response": {
        "code": "10000",
        "msg": "success",
        "success": "true",
        "result": "{\"errorcode\":\"kp.ae_success\",\"errormsg\":\"处理成功\",\"tpl_id\":\"2017032xxxxxxxx\",\"tpl_params\":[\"title\",\"channelid\",\"serialnumber\"]}"
    },
    "sign": "eritjkeijkjhkkkkkkkhjereeeeeeeeeee"
}
说明:本示例仅供参考。

公共错误码

业务错误码

错误码错误描述凯发app官方网站的解决方案
kp.ae_alipass_template_paramter_is_null模板参数为空
确认请求中的模板参数是否为空
kp.ae_alipass_template_app_id_is_null入参app_id为空
确认参数app_id是否填入
kp.ae_alipass_template_content_is_blank入参tpl_content为空
确认参数tpl_content是否填入
kp.ae_alipass_template_unique_id_is_blank入参unique_id为空
确认参数unique_id是否填入
kp.ae_alipass_recognition_type_nosupport发券方式不支持
确认appid已填入的前提下,尝试重试
kp.ae_alipss_template_existed模版已存在
模板已存在,如需更新模板内容请调用alipay.pass.template.update接口;如的确需要重新创建模板,需要变更请求参数中的unique_id
kp.ae_system_error系统繁忙或系统异常
尝试重试
kp.ae_illegal_parameters保存模板信息时存在参数格式错误
确认参数格式是否符合文档需求,如有效期时间字段格式等
kp.ae_alipass_data_contain_forbidden_word模板内容中存在敏感词、违禁词
去除模板内容中的敏感词、违禁词
kp.ae_alipass_template_unrecognize_property模板内容中存在不识别的属性
核查确认tpl_content中的字段属性符合文档预期
内容没有解决您的问题?您还可以前往 或 寻求帮助
凯发k8官方网娱乐官方 copyright © 2022 支付宝(杭州)信息技术有限公司  | icp证浙b2-20160559
该文档对你是否有帮助?
当前页面目录
网站地图