营销活动送红包接入说明(.NET版)

简介: 营销活动送红包注意事项:[url]https://openclub.alipay.com/read.php?tid=12196&fid=71[/url]一、.NET示例和demo.NET版demo:download:营销活动送红包NET版.

营销活动送红包注意事项:[url]https://openclub.alipay.com/read.php?tid=12196&fid=71[/url]

一、.NET示例和demo

.NET版demo:download:营销活动送红包NET版.zip

二、调用接口

1、创建现金活动接口请求示例

IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);                      AlipayMarketingCampaignCashCreateRequest request = new AlipayMarketingCampaignCashCreateRequest();                      request.BizContent = "{" +            "\"coupon_name\":\"煜雨创建营销活动送红包\"," +            "\"prize_type\":\"random\"," +            "\"total_money\":\"1.00\"," +            "\"total_num\":\"5\"," +            "\"prize_msg\":\"煜雨送您大红包\"," +            "\"start_time\":\"NowTime\"," +            "\"end_time\":\"2018-11-20 22:48:30\"," +            "\"merchant_link\":\"https://www.baidu.com\"," +            "\"send_freqency\":\"D3|L10\"" +            "}";                      AlipayMarketingCampaignCashCreateResponse response = client.Execute(request);            Console.WriteLine("煜雨创建现金活动:" + response.Body);

接口调用成功示例:

煜雨创建现金活动:{"alipay_marketing_campaign_cash_create_response":{"code":"10000","msg":"Success","crowd_no":"2w0FuES2DFzxla_8YQDpYEjecJbUPuWwacQtqkqe-RrMnSZ96O-zxUfKlHp5cxmx","origin_crowd_no":"20180921149410190701192600920004","pay_url":"http%3A%2F%2Fauthcenter%2Ealipaydev%2Ecom%3Fgoto%3Dhttp%3A%2F%2Fpromoprod%2Ealipaydev%2Ecom%2Fquery%2FopenCashCrowdPay%2Ehtm%3FcrowdNo%3D2w0FuES2DFzxla%5F8YQDpYEjecJbUPuWwacQtqkqe%2DRrMnSZ96O%2DzxUfKlHp5cxmx"},"sign":"m/zWmwWwekxf30SOnxp3sFU8TYyCOZMPBKBQLUuzDxeybnBEu20Yfsbleh10/tzTcUgJFuVXD/pIi7ILnKwf//HGYoC+bOyLi/prjrEdqxVPeiglKXC0azR8AG5hzpqN4K6n1hzZmbtprRCD3eCxiF7QozwDTDvDgeNGM8HUbgn6ylHFbu35iZkhN3UEmVv5QTVPek5S8MfHucOZwITOnB6cQDZBFW/Yw4h6mLDtFdkprAP6PuJOJ1GoVtyUabMPaX0QF4tjDVhbqWN4SxWXixOmMuLTEwey6Lr1vBouEBd9OOjOL4RyvOyLfIoeRJi9+llwn+A+7tQAC2Qrg8+hfA=="}

参数说明:

1>.prize_type:现金红包的发放形式,fixed为固定金额,random为随机金额;

2>.total_money:活动发放的现金总金额,最小金额1.00元

3>.total_num:红包发放个数,最小1个,最大10000000个;必须设置为整数。

4>.pay_url:支付url,有效期为24个小时,需要商家先对其进行UrlDecode处理,然后使用卖家账号登录支付。

 

支付流程:

将支付链接pay_url进行decode处理,然后在浏览器直接访问该url使用卖家账号

2、触发现金红包活动接口请求示例

IAopClient client = new DefaultAopClient(config.gatewayUrl, config.app_id, config.private_key, "json", "1.0", "RSA2", config.alipay_public_key, config.charset, false);                       AlipayMarketingCampaignCashTriggerRequest request = new AlipayMarketingCampaignCashTriggerRequest();                      request.BizContent = "{" +            "\"user_id\":\"2088102174701092\"," +            "\"crowd_no\":\"2w0FuES2DFzxla_8YQDpYEjecJbUPuWwacQtqkqe-RrMnSZ96O-zxUfKlHp5cxmx\"," +            "\"login_id\":\"dvnvqi3054@sandbox.com\"," +            "\"order_price\":\"0.20\"," +            "\"out_biz_no\":\"2018009204544545454545477\"" +            "}";                      AlipayMarketingCampaignCashTriggerResponse response = client.Execute(request);                     Console.WriteLine("煜雨触发现金红包活动:" + response.Body);

接口调用成功示例:

煜雨触发现金红包活动:{"alipay_marketing_campaign_cash_trigger_response":{"code":"40004","msg":"Business Failed","sub_code":"isv.UNKNOW_SYSTEM_ERROR","sub_msg":"系统繁忙,请稍后再试"},"sign":"t092yfg+ZvGtH+u//YJjPsJy5zQWBL0Zit/3NBoVyFpnBYRpNn4CjJWeW9T4a+ZNSCDe4mNVBvOKV4XzTYAbv8qr9XGBtHm0Ld0r4A2G4opFNIdcfuA+cu13GSvt5H+IRZDy10Q3UsqN/LfrMomZYMS8VMXr5S1/L4wPX/ZW3pqmxrXMGBXoeDeMsPVOgI5nmzn/S9X6P0qsC5l/eVTzjMa7OOU3LjE6851drXzIr25b4aosgzB96FHcfDlHrZqKlJodSBK1OVMt2u7K66b4rzNTInXZrblxKlpqsCm0SmN5je46Qax0KrjNNH4gCrHzkcaI26fXuiHZ9g7Bgz+J4w=="}

参数说明:

1>.user_id:用户唯一标识,可通过用户信息授权接口获取;

2>.order_price:设置发送红包的金额,单位为分,100代表1元;

3>.login_id:用户登录账号名:邮箱或手机号。user_id与login_id至少有一个非空,都非空时以user_id为准。

3、更改现金活动状态接口请求示例

require_once 'AopSdk.php';$aop = new AopClient();$aop->appId = '填写你的沙箱appid';$aop->rsaPrivateKey = '填写您的原始私钥';$aop->alipayrsaPublicKey='填写您的支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';$aop->apiVersion = '1.0';$aop->postCharset='utf-8';$aop->format='json';$aop->signType = 'RSA2';$request = new AlipayMarketingCampaignCashStatusModifyRequest ();$request->setBizContent("{" .		"\"crowd_no\":\"bmhfAI27oG_m1OVdDzn90MdC2y9YVjhsPLPjJLTHhnDMnSZ96O-zxUfKlHp5cxmx\"," .		"\"camp_status\":\"PAUSE\"" .		"}");$result = $aop->execute ( $request);var_dump($result);?>

接口调用成功示例:

 public 'alipay_marketing_campaign_cash_status_modify_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)  public 'sign' => string 'GnpwpMfUdFwQIyyqqdNCTP6obNctCaJ+RE7DwfAYABJTRz5ulLZ6ZZ7jYbur+h//hfG4FNAcKkJ5+yWNWGDj+fWRH25NUoyfZM0PTghWqhZaCuOMTnCn7R5Pm+jVwHDu9ngl8JNY816xD9TcQtqFaUdUufGFxGo/9eY8hmnubSdpp9/6iZn09x//TJPPu4DNU0nWELO3NtDOA/qftg9zWmoE5/sFxqTYbgcLOA71EceTZQ/4DwWpavatOhewATUWflVXP9DwWjBNeONFzUuBwl6BJZOCw3H9ldhC+37x4HDiXoK2E68NZaZRMincmWayrY4SHBq20SHvQUR/VqnOxw==' (length=344)

参数说明:

camp_status:修改后的活动状态,只能设置为PAUSE或者READY或者CLOSED。

4、现金活动列表查询接口请求示例

require_once 'AopSdk.php';$aop = new AopClient();$aop->appId = '填写你的沙箱appid';$aop->rsaPrivateKey = '填写您的原始私钥';$aop->alipayrsaPublicKey='填写您的支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';$aop->apiVersion = '1.0';$aop->postCharset='utf-8';$aop->format='json';$aop->signType = 'RSA2';$request = new AlipayMarketingCampaignCashListQueryRequest ();$request->setBizContent("{" .		"\"camp_status\":\"PAID\"," .		"\"page_size\":\"5\"," .		"\"page_index\":\"1\"" .		"}");$result = $aop->execute ( $request);var_dump($result);?>

接口调用成功示例:

 public 'alipay_marketing_campaign_cash_list_query_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'page_index' => string '0' (length=1)      public 'page_size' => string '5' (length=1)      public 'total_size' => string '0' (length=1)  public 'sign' => string 't8e83/k/KfvN2JfjYoM6t28qEW52b4fC4YkSO98e80K34a045yXI1ujClvvU5FNTyNA8drwzUZfHMVcp8ijBwJJoNEryY11LP4rrK6oGLC+xg7FyisBANwj94PdRXfiOd/S5NyxbvNYOvFjhN1NJv52MhOdQTCeomAA3yWVK7bfRYb7m4BH1Usdsgex9CwM2AwT39SR8AMHe8ELaWTksS8KMTAKw0/qotT94KZHKKw454etEfEiPoOnMJNJufuEHrWUX/KZLeg4BYAQMz7iUb0IrmZlLV0638dDPx5pkJr9yeNskqtPjsu810xwii5+kJesdUTRUWeozQpNCfM9yIA==' (length=344)

参数说明:

camp_status要查询的活动状态,不填默认返回所有类型。

5、现金活动详情查询接口请求示例

require_once 'AopSdk.php';$aop = new AopClient();$aop->appId = '填写你的沙箱appid';$aop->rsaPrivateKey = '填写您的原始私钥';$aop->alipayrsaPublicKey='填写您的支付宝公钥';$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';$aop->apiVersion = '1.0';$aop->postCharset='utf-8';$aop->format='json';$aop->signType = 'RSA2';$request = new AlipayMarketingCampaignCashDetailQueryRequest ();$request->setBizContent("{" ."\"crowd_no\":\"bmhfAI27oG_m1OVdDzn90MdC2y9YVjhsPLPjJLTHhnDMnSZ96O-zxUfKlHp5cxmx\"" ."}");$result = $aop->execute ( $request);var_dump($result);?>

接口调用成功示例:

 public 'alipay_marketing_campaign_cash_detail_query_response' =>     object(stdClass)[10]      public 'code' => string '10000' (length=5)      public 'msg' => string 'Success' (length=7)      public 'camp_status' => string 'READY' (length=5)      public 'coupon_name' => string '煜雨创建营销活动送红包' (length=33)      public 'crowd_no' => string 'bmhfAI27oG_m1OVdDzn90MdC2y9YVjhsPLPjJLTHhnDMnSZ96O-zxUfKlHp5cxmx' (length=64)      public 'end_time' => string '2018-12-26 12:48:31' (length=19)      public 'origin_crowd_no' => string '20181026169410190701192600817004' (length=32)      public 'prize_msg' => string '煜雨送您大红包' (length=21)      public 'prize_type' => string 'random' (length=6)      public 'send_amount' => string '0.00' (length=4)      public 'start_time' => string '2018-10-26 16:00:13' (length=19)      public 'total_amount' => string '1.00' (length=4)  public 'sign' => string 'ne3iAW8hGGmDuwgKAfAZ83FIQNI3G86IoOOtj2v11tLeg2yb8GjvVL+Zphz5qptaAeOSu/UXHaNkAm/FfspABtpkKpYAIEZTJrRrhlrZUmcKO5HbafN8yTPwKqP5DNb9lYDtA21IePC7fcER8ytgHT9wBgKZjciUhaOEskoIkIzOE9jBiyGILAVN8F0pleQ2PgcCrt3MfgOj/gbRPnPXJzTbh9Hcr9sCIbW9G3ZKzoJ9Ddcw2eZRVWtVAlsTZ4WT+zIgIQFipA3TIRpB+OCZlQqsFCuYsSXPBVmqv2q177cX6nD0yPmVODoz52BZa09lHYSx7YitR+gKalznvLWsCA==' (length=344)

三、显示效果

商户创建完成并生效红包活动后,可在支付宝商家红包后台查看发放情况并下载账单(账单将以T+1时效更新)。

商家红包后台地址:[url]https://hb.alipay.com/mhb/giftList.htm[/url]

钱包中可查询红包的账单信息:

红包说明是固定格式:沙箱环境是:沙箱环境-现金红包;正式环境是:公司名称-现金红包

 

如果还是报错,请按如下方式进行提问:

正确提问方式:使用环境(沙箱还是正式环境)+接口名称(中文+英文)+ 请求参数 + 报错信息详情

目录
相关文章
|
运维 前端开发 安全
人人都是 Serverless 架构师 | “盲盒抽奖”创意营销活动实践
当 Serverless 与低代码这两个不同的技术共同相交于同一个业务时会有怎样的价值展现?本文以 “盲盒抽奖” 这个 Serverless Devs 做过的创意营销活动为例,为大家讲述 Serverless 和低代码是如何搭配来满足一个业务诉求的。
人人都是 Serverless 架构师 | “盲盒抽奖”创意营销活动实践
|
监控 Cloud Native 数据挖掘
【产品动态】Quick Audience 营销活动功能一期上线
营销活动为Quick Audience(QA)用户洞察下的一个功能模块,通过这个模块,可以将QA侧生成的受众以及营销渠道全部关联起来,从营销活动的视角,一站式完成活动目标制定、活动计划制定到活动任务执行。
1606 0
【产品动态】Quick Audience 营销活动功能一期上线
|
Java
营销活动送红包之更改现金活动状态(alipay.marketing.campaign.cash.status.modify)-java版
说明: 本帖是测试营销活动送红包的更改现金活动状态接口,本帖是使用沙箱环境测试的,仅供参考!! 是否需要签约:需要,【如何签约】  是否支持沙箱环境:支持 接口文档:查看  sdk下载:下载  营销活动送红包沙箱Java版demo:download:营销活动送红包Java版.
540 12
|
Java
营销活动送红包之触发现金红包活动(alipay.marketing.campaign.cash.trigger)-java版
说明: 本帖是测试营销活动送红包的触发现金红包活动接口,本帖是使用沙箱环境测试的,仅供参考!! 是否需要签约:需要,【如何签约】  是否支持沙箱环境:支持 接口文档:查看  sdk下载:下载  营销活动送红包沙箱Java版demo:download:营销活动送红包Java版.
703 12
|
Java
营销活动送红包之创建现金活动接口(alipay.marketing.campaign.cash.create)-java版
说明:  本帖是测试营销活动送红包的创建现金活动接口,本帖是使用沙箱环境测试的,仅供参考!!  是否需要签约:需要,【如何签约】   是否支持沙箱环境:支持  接口文档:查看   sdk下载:下载   JAVA版demo:download:营销活动送红包Java版.
724 12
|
Java
营销活动送红包之查询接口-java版
说明   本帖是测试营销活动送红包的现金活动列表查询和现金活动详情查询接口,本帖是使用沙箱环境测试的,仅供参考!!   是否需要签约:需要,【如何签约】    是否支持沙箱环境:支持   接口文档: 现金活动列表查询文档,现金活动详情查询文档   sdk下载:下载    营销活动送红包沙箱Java版demo:download:营销活动送红包Java版.
428 11
|
JSON 数据格式
营销活动送红包详解
场景: 帮助商户快速创建和发放现金红包,同时可以对已创建的红包进行管理和查看。 流程图:  是否需要签约:是 接口流程图:  需要注意的点: 1.用户领取现金红包后,资金将直接进支付宝余额,并在app首页的红包应用中,查看到出资商户的品牌信息。
1117 0
|
JSON PHP 数据格式
营销活动送红包接入说明(PHP版)
营销活动送红包注意事项:[url]https://openclub.alipay.com/read.php?tid=12196&fid=71[/url] 一、PHP示例demo PHP版demo:download:营销活动送红包PHP版.
769 0
营销活动创建接口出现REQ_VALIDATE_ERROR
报错信息:    调用营销活动创建接口创建集点卡活动出现REQ_VALIDATE_ERROR  {"koubei_marketing_campaign_activity_create_response":{"code":"40004","msg":"Business Failed","sub_co...
645 0
|
6月前
自适应IT互联网营销企业网站pbootcms模板
一款蓝色自适应IT互联网营销企业网站pbootcms模板,该模板采用响应式设计,可自适应手机端,适合一切网络技术公司、互联网IT行业,源码下载,为您提供了便捷哦。
61 2

热门文章

最新文章