说明: 本帖是测试营销活动送红包的创建现金活动接口,本帖是使用沙箱环境测试的,仅供参考!!
是否需要签约:需要,【如何签约】
是否支持沙箱环境:支持
接口文档:查看
sdk下载:下载
JAVA版demo:download:营销活动送红包Java版.zip PHP版demo:download:营销活动送红包PHP版.zip
.NET版demo:download:营销活动送红包NET版.zip
1.代码请求
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.URL ,AlipayConfig.APPID,AlipayConfig.RSA_PRIVATE_KEY,"json",AlipayConfig.CHARSET,AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SIGNTYPE ); AlipayMarketingCampaignCashCreateRequest request = new AlipayMarketingCampaignCashCreateRequest(); request.setBizContent("{" + "\\"coupon_name\\":\\"煜雨创建营销活动送红包\\"," + "\\"prize_type\\":\\"random\\"," + "\\"total_money\\":\\"1.00\\"," + "\\"total_num\\":\\"5\\"," + "\\"prize_msg\\":\\"煜雨送您大红包\\"," + "\\"start_time\\":\\"NowTime\\"," + "\\"end_time\\":\\"2019-02-28 17:14:31\\"," + "\\"merchant_link\\":\\"https://www.baidu.com\\"," + "\\"send_freqency\\":\\"D2|L10\\"" + "}"); AlipayMarketingCampaignCashCreateResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用成功"); } else { System.out.println("调用失败"); } System.out.println(response.getBody()); //打印完整的响应报文信息 System.out.println(response.getPayUrl()); //打印支付链接
2.请求成功返回信息示例
调用成功{"alipay_marketing_campaign_cash_create_response":{"code":"10000","msg":"Success","crowd_no":"mLWvlT7N0dfsiL5sj2cY7fdc_GpK60YAs9qFEou3rgnMnSZ96O-zxUfKlHp5cxmx","origin_crowd_no":"20180321199410190701192600585004","pay_url":"http%3A%2F%2Fauthcenter%2Ealipaydev%2Ecom%3Fgoto%3Dhttp%3A%2F%2Fpromoprod%2Ealipaydev%2Ecom%2Fquery%2FopenCashCrowdPay%2Ehtm%3FcrowdNo%3DmLWvlT7N0dfsiL5sj2cY7fdc%5FGpK60YAs9qFEou3rgnMnSZ96O%2DzxUfKlHp5cxmx"},"sign":"XXX"} 支付链接:http%3A%2F%2Fauthcenter%2Ealipaydev%2Ecom%3Fgoto%3Dhttp%3A%2F%2Fpromoprod%2Ealipaydev%2Ecom%2Fquery%2FopenCashCrowdPay%2Ehtm%3FcrowdNo%3DmLWvlT7N0dfsiL5sj2cY7fdc%5FGpK60YAs9qFEou3rgnMnSZ96O%2DzxUfKlHp5cxmx
3.进行支付:
将支付链接pay_url进行URLdecode处理,然后在浏览器直接访问该url使用卖家账号进行支付
不是卖家账号进行支付显示"抱歉,暂时无法操作。红包编号不存在";
正确支付的流程:">正确支付的流程:
使用卖家账号进行支付:
支付页面:
支付成功跳转页面:url会显示现金红包活动号crowd_no
跳转到设置的merchant_link的页面:
正确的提问方式:appid+使用环境(正式/沙箱)+调用接口时间+请求参数(提供信息不完整不回复,谢谢配合)
如果您在接入该接口还有疑问欢迎在本帖下方追问吐槽