TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
TmallPromotionCouponUseRequest req = new TmallPromotionCouponUseRequest();
req.setBizType("suning");
req.setBuyerId("123456");
req.setBuyerNick("我是测试");
req.setSellerId("1111111");
req.setCouponId("222222");
req.setExtraString("{\"suning_coupon_id\":33333}");
TmallPromotionCouponUseResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
TmallPromotionCouponUseRequest req = new TmallPromotionCouponUseRequest();
req.BizType = "suning";
req.BuyerId = "123456";
req.BuyerNick = "我是测试";
req.SellerId = "1111111";
req.CouponId = "222222";
req.Extra = "{\"suning_coupon_id\":33333}";
TmallPromotionCouponUseResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new TmallPromotionCouponUseRequest;
$req->setBizType("suning");
$req->setBuyerId("123456");
$req->setBuyerNick("我是测试");
$req->setSellerId("1111111");
$req->setCouponId("222222");
$req->setExtra("{\"suning_coupon_id\":33333}");
$resp = $c->execute($req);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=tmall.promotion.coupon.use' \
-d 'partner_id=apidoc' \
-d 'sign=4A4EE9C3EA3EF844EFB2F5ED57CCB331' \
-d 'sign_method=hmac' \
-d 'timestamp=2025-04-25+17%3A24%3A34' \
-d 'v=2.0' \
-d 'biz_type=suning' \
-d 'buyer_id=123456' \
-d 'buyer_nick=%E6%88%91%E6%98%AF%E6%B5%8B%E8%AF%95' \
-d 'coupon_id=222222' \
-d 'extra=%7B%5C%22suning_coupon_id%5C%22%3A33333%7D' \
-d 'seller_id=1111111'
# -*- coding: utf-8 -*-
import top.api
req=top.api.TmallPromotionCouponUseRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.biz_type="suning"
req.buyer_id="123456"
req.buyer_nick="我是测试"
req.seller_id="1111111"
req.coupon_id="222222"
req.extra="{\"suning_coupon_id\":33333}"
try:
resp= req.getResponse()
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"tmall.promotion.coupon.use");
add_param(pRequest,"biz_type","suning");
add_param(pRequest,"buyer_id","123456");
add_param(pRequest,"buyer_nick","我是测试");
add_param(pRequest,"seller_id","1111111");
add_param(pRequest,"coupon_id","222222");
add_param(pRequest,"extra","{\"suning_coupon_id\":33333}");
pResponse = top_execute(pClient,pRequest,NULL);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('tmall.promotion.coupon.use', {
'biz_type':'suning',
'buyer_id':'123456',
'buyer_nick':'我是测试',
'seller_id':'1111111',
'coupon_id':'222222',
'extra':'{\"suning_coupon_id\":33333}'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})