支付宝卡包——管理卡劵(alipay.pass.template.update)

简介: 接口名称:支付宝pass更新模版接口英文名称:alipay.pass.template.update上一步:[url]https://openclub.alipay.com/read.php?tid=13243&fid=72[/url]一、注意事项该接口主要用于管理卡劵模板样式进行修改、。

接口名称:支付宝pass更新模版接口

英文名称:alipay.pass.template.update

上一步:[url]https://openclub.alipay.com/read.php?tid=13243&fid=72[/url]

一、注意事项

该接口主要用于管理卡劵模板样式进行修改、。

二、参数说明

参数说明详见alipay.pass.template.add(卡券模板创建)接口示例。

1、tpl_id:需修改模板ID,创建卡劵模板接口返回;

2、tpl_content:content(即pass.json内容,必传)、icon、logo(图片url地址,必传)、strip(图片的url地址);

3、content:模板中的自定义参数以双$符号标志,即$ serialNumber $表示自定义参数名为serialNumber,供发布卡券时使用

三、接口请求示例

Java版本请求示例

public static void main(String[] args) throws AlipayApiException {
     AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, AlipayConfig.format, AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type); 
     AlipayPassTemplateUpdateRequest request = new AlipayPassTemplateUpdateRequest();
     request.setBizContent(
           "{\"tpl_id\":\"2019013016274826850929194\","
           + "\"tpl_content\":"
           + "{\"logo\":\"https://alipass.alipay.com//temps/free/logo.png\","
           + "\"strip\":\"https://alipass.alipay.com//temps/free/strip.png\","
           +"\"icon\":\"http://alipassprod.test.alipay.net/temps/free/icon.png\","
           + "\"content\":"
           + "{\"evoucherInfo\":"
           + "{\"title\":\"九月一号更新卡券模板优惠券\",\"type\":\"coupon\",\"product\":\"free\",\"startDate\":\"$validStartDate$\",\"endDate\":\"$validEndDate$\",\"operation\":"
           + "[{\"format\":\"barcode\",\"message\":\"45612346579465\",\"messageEncoding\":\"UTF-8\",\"altText\":\"45612346579465\"}],"
           + "\"einfo\":{"
           + "\"logoText\":\"$logoText$\","
           + "\"secondLogoText\":\"$secondLogoText$\","
           + "\"headFields\":"
           + "[{\"key\":\"status\",\"label\":\"状态\",\"value\":\"$useStateDesc$\",\"type\":\"text\"}],"
           + "\"primaryFields\":"
           + "[{\"key\":\"strip\",\"label\":\"\",\"value\":\"$discountInfo$\",\"type\":\"text\"}],"
           + "\"secondaryFields\":"
           + "[{\"key\":\"validDate\",\"label\":\"有效期至:\",\"value\":\"$validEndDate$\",\"type\":\"text\"}],"
           + "\"auxiliaryFields\":[],"
           + "\"backFields\":"
           + "[{\"key\":\"description\",\"label\":\"详情描述\",\"value\":\"1.该优惠有效期:截止至2024年06月18日;\
2.凭此券可以享受以下优惠:\
享门市价优惠\
不与其他优惠同享。详询商家。\",\"type\":\"text\"},"
           + "{\"key\":\"shops\",\"label\":\"可用门店\",\"value\":\"\",\"type\":\"text\"},"
           + "{\"key\":\"disclaimer\",\"label\":\"负责声明\",\"value\":\"除特殊注明外,本优惠不能与其他优惠同时享受;本优惠最终解释权归商家所有,如有疑问请与商家联系。提示:为了使您得到更好的服务,请在进店时出示本券。\",\"type\":\"text\"}"
           + "]},"
           + "\"remindInfo\":"
           + "{\"offset\":\"2\"}},"
           + "\"merchant\":{\"mname\":\"hodewu\",\"mtel\":\"\",\"minfo\":\"\"},"
           + "\"platform\":{\"channelID\":\"$channelID$\",\"webServiceUrl\":\"\"},"
           + "\"style\":{\"backgroundColor\":\"RGB(255,126,0)\"},"
           + "\"fileInfo\":{\"formatVersion\":\"2\",\"canShare\":true,\"canBuy\":false,\"canPresent\":true,\"serialNumber\":\"$serialNumber$\",\"supportTaxi\":\"true\",\"taxiSchemaUrl\":\"alipays://platformapi/startapp?appId=20000130&sourceId=20000030&showTitleBar=YES&showToolBar=NO&showLoading=NO&safePayEnabled=YES&readTitle=YES&backBehavior=back&url=/www/index.html\"},"
           + "\"appInfo\":{\"app\":{},\"label\":\"\",\"message\":\"\"},"
           + "\"source\":\"alipassprod\","
           + "\"alipayVerify\":[]"
           + "}}}");
          AlipayPassTemplateUpdateResponse response=null;
          try {
              response = alipayClient.execute(request);
              System.out.println(response.getBody());
          } catch (AlipayApiException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          if(response.isSuccess()){
          System.out.println("调用成功");
          } else {
          System.out.println("调用失败");
          }
}

响应参数返回示例

{"alipay_pass_template_update_response":{"code":"10000","msg":"Success","result":"{"errorCode":"KP.AE_SUCCESS","errorMsg":"处理成功","tpl_id":"2019013016274826850929194","tpl_params":["useStateDesc","logoText","discountInfo","secondLogoText","validEndDate","validStartDate","serialNumber","channelID"]}","success":true},"sign":"ETPaWh0xRBEMuPG7TeW3mOUkqXV19JE3taIpPGT4zXjmsuI9c6HKaM95amxLCA/f+vjk3VGrkv2c4Oa5EJkn0ur22f1sR9Vj5d0XGG7gakmf4fsZ9cu+gTxUeg/md2GUAL6E3KVjOkiylsjs2WHM/i6FbHdYWNhSWtgc/ebkuK2GuOBC3LosFuhVOgcuG6xnhAh2Qi+lqcLVv4OZEDEJz9nkwUXwoBni60WZIaSmfecKIhV5/JAuy89dqcYsif1CgYA9VEu6aiqPd1G0GHnPxQwOivCyG3X2lIHHNt/+yKrFn70PS/sFWNIjqQP801okBgKzc/Zymd7n9kBS0kCVzA=="}


PHP版本请求示例

<?php
require_once 'AopSdk.php';
$aop = new AopClient ();
$aop->appId = '填写您的appid';
$aop->rsaPrivateKey = '填写您的私钥';
$aop->alipayrsaPublicKey='填写您的支付宝公钥';
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='utf-8';
$aop->format='json';
$date=date("YmdHis");
$arr=range(1000,9999);
shuffle($arr);
$request = new AlipayPassTemplateUpdateRequest ();
$request->setBizContent(
              '{"tpl_id":"2019022209351735229484926",'
           .  '"tpl_content":{'
      	   .  '"logo":"https://alipass.alipay.com//temps/free/logo.png",'
      	   .  '"strip":"https://alipass.alipay.com//temps/free/strip.png",'
      	   .  '"icon":"http://alipassprod.test.alipay.net/temps/free/icon.png",'
       	   .  '"content":{'
       	   .  '"evoucherInfo":{'
           .  '"title":"九月一号更新卡券模板优惠券","type":"coupon","product":"free","startDate":"$validStartDate$","endDate":"$validEndDate$",'
		   .  '"operation":'
           .  '[{"format":"barcode","message":"45612346579465","messageEncoding":"UTF-8","altText":"45612346579465"}],'
           .  '"einfo":{'
           .  '"logoText":"$logoText$",'
           .  '"secondLogoText":"$secondLogoText$",'
           .  '"headFields":'
           .  '[{"key":"status","label":"状态","value":"$useStateDesc$","type":"text"}],'
           .  '"primaryFields":'
           .  '[{"key":"strip","label":"","value":"$discountInfo$","type":"text"}],'
           .  '"secondaryFields":'
           .  '[{"key":"validDate","label":"有效期至:","value":"$validEndDate$","type":"text"}],'
           .  '"auxiliaryFields":[],'
           .  '"backFields":'
           .  '[{"key":"description","label":"详情描述","value":"1.该优惠有效期:截止至2024年06月18日;n2.凭此券可以享受以下优惠:n享门市价优惠n不与其他优惠同享。详询商家。","type":"text"},'
           .  '{"key":"shops","label":"可用门店","value":"","type":"text"},'
           .  '{"key":"disclaimer","label":"负责声明","value":"除特殊注明外,本优惠不能与其他优惠同时享受;本优惠最终解释权归商家所有,如有疑问请与商家联系。提示:为了使您得到更好的服务,请在进店时出示本券。","type":"text"}'
           .  ']},'
           .  '"remindInfo":'
           .  '{"offset":"2"}},'
           .  '"merchant":{"mname":"hodewu","mtel":"","minfo":""},'
           .  '"platform":{"channelID":"$channelID$","webServiceUrl":""},'
           .  '"style":{"backgroundColor":"RGB(255,126,0)"},'
           .  '"fileInfo":{"formatVersion":"2","canShare":true,"canBuy":false,"canPresent":true,"serialNumber":"$serialNumber$","supportTaxi":"true","taxiSchemaUrl":"alipays://platformapi/startapp?appId=20000130&sourceId=20000030&showTitleBar=YES&showToolBar=NO&showLoading=NO&safePayEnabled=YES&readTitle=YES&backBehavior=back&url=/www/index.html"},'
           .  '"appInfo":{"app":{},"label":"","message":""},'
           .  '"source":"alipassprod",'
           .  '"alipayVerify":[]'
           .  '}}}');
$result = $aop->execute ( $request); 
var_dump($result);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
echo "成功";
} else {
echo "失败";
}

响应参数返回示例

public 'alipay_pass_template_update_response' => 
    object(stdClass)[9]
      public 'code' => string '10000' (length=5)
      public 'msg' => string 'Success' (length=7)
      public 'result' => string '{"errorCode":"KP.AE_SUCCESS","errorMsg":"处理成功","tpl_id":"2019022209351735229484926","tpl_params":["useStateDesc","logoText","discountInfo","secondLogoText","validEndDate","validStartDate","serialNumber","channelID"]}' (length=224)
      public 'success' => boolean true
  public 'sign' => string 'fCqydQLMdftRqn7qg4KzFQi5VFNtf+uNTrBQoFTUQVd39KJygYcCBCHdpnmaSvvg2Cc1xl7ybfjTGd+Kc4szXDIutE4fCY9+ws2MwDcHEGEBzyi7nL3LmtzArTCZGe/CxckCrP1Ye/nUI/Hp+6jDbR7Bn2bx7/tJcGjnjGe3Ja5RcQnM8MjiLMrF6Tet63WP3TXee8Zi8VH38HNbqFms44gl8xxa9tJhNr+HFz1QFBM0lI4Mi/3FwSOIYNNMPEXiwPgPyMlR2vpdQjMHhbNuA3z4EXKwIjJbk9JuSraF2Kc6O664IJqznQEmRJwZtP138JwJ02kihhxuKWC4G51ElQ==' (length=344)


.NET版本请求示例

 IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);

        AlipayPassTemplateUpdateRequest request = new AlipayPassTemplateUpdateRequest();

        request.BizContent="{"
                    + ""tpl_id":"2019040215104450132405465","
                    + ""tpl_content":"
                    + "{"logo":"https://alipass.alipay.com//temps/free/logo.png","
                    + ""strip":"https://alipass.alipay.com//temps/free/strip.png","
                    + ""icon":"http://alipassprod.test.alipay.net/temps/free/icon.png","
                    + ""content":{"
                    
目录
相关文章
|
缓存 Java PHP
解决Hbuilder打包的APP微信支付时无法唤起支付,且提示{“code“:-100,“message“:“[payment微信:-1]General errors“}的问题
解决Hbuilder打包的APP微信支付时无法唤起支付,且提示{“code“:-100,“message“:“[payment微信:-1]General errors“}的问题
|
5月前
|
存储
支付系统36-------订单表优化,添加payment_type字段,无论是微信支付还是支付宝支付都放到 t_order_info表中了,payment_type用来判断支付宝还是微信支付的
支付系统36-------订单表优化,添加payment_type字段,无论是微信支付还是支付宝支付都放到 t_order_info表中了,payment_type用来判断支付宝还是微信支付的
|
7月前
|
API
taobao.trade.memo.update( 修改交易备注 ) 丨淘宝店铺订单接口
taobao.trade.memo.update( 修改交易备注 ) 丨淘宝店铺订单接口
支付宝卡包——创建卡劵模板(alipay.pass.template.add)
接口名称:卡券模板创建接口 英文名称:alipay.pass.template.add 上一步:[url]https://openclub.alipay.com/read.php?tid=12967&fid=72&page=1#anchor3[/url] 下一步:[url]https://openclub.alipay.com/read.php?tid=13242&fid=72[/url] 一、注意事项 该接口用于进行创建支付宝卡劵模板。
921 12
支付宝卡包——核销卡劵(alipay.pass.instance.update)
接口名称:支付宝pass更新卡券实例接口 英文名称:alipay.pass.instance.update 上一步:[url]https://openclub.alipay.com/read.php?tid=13242&fid=72[/url] 下一步:[url]https://openclub.alipay.com/read.php?tid=13244&fid=72[/url] 一、注意事项 该接口主要用于使页面显示核销状态,且该接口还含有失效卡劵、更新卡劵功能。
2027 12
支付宝卡包——发放卡劵(alipay.pass.instance.add)
接口名称:支付宝pass新建卡券实例接口 英文名称:alipay.pass.instance.add 上一步:[url]https://openclub.alipay.com/read.php?tid=13240&fid=72[/url] 下一步:[url]https://openclub.alipay.com/read.php?tid=13243&fid=72[/url] 一、注意事项 该接口用于将卡劵发放到用户卡包内。
858 12
收发现金红包——alipay.fund.coupon.order.app.pay(红包无线支付接口)
接口名称:红包无线支付接口 英文名称:alipay.fund.coupon.order.app.pay 产品首页:[url]https://openclub.alipay.com/read.php?tid=12180&fid=72[/url] 下一步:[url]https://openclub.alipay.com/read.php?tid=13609&fid=72[/url] 一、注意事项 1、适用于用户在手机移动端商户app中进行红包的发放,可以通过唤起支付宝app进行支付。
2055 12
alipay.trade.create+JS调起收银台详解
说明: 在很多场景中都会需要通过alipay.trade.create接口生成一笔支付订单,然后通过JS唤起收银台支付,例如扫码点菜等。 需要注意的点: 交易状态必须以异步通知或查询接口为准,异步通知规则可以参考【请点击】。
2541 12
|
JSON 数据格式
收发现金红包——alipay.fund.coupon.order.page.pay(红包页面支付接口)
接口名称:红包页面支付接口 英文名称:alipay.fund.coupon.order.page.pay 产品首页:[url]https://openclub.alipay.com/read.php?tid=12180&fid=72[/url] 下一步:[url]https://openclub.alipay.com/read.php?tid=13609&fid=72[/url] 一、注意事项 1、适用于用户在商户PC网页进行红包的发放,付款时会链接到支付宝PC登录页面进行登录和后续的支付,在支付成功后跳转回商户页面。
1033 12
|
Java
发放卡券接口(alipay.pass.instance.add)JAVA版本小样
调用这个接口前需要先创建卡券模板,参考该贴:https://openclub.alipay.com/read.php?tid=2135&fid=8 官方接口文档:https://docs.open.alipay.
569 12