淘宝开放平台
- 怀旧特辑
- 2026-07-25 21:28:05
- 8223
淘宝交易API
taobao.trades.sold.get
查询卖家已卖出的交易数据(根据创建时间)
taobao.trade.memo.add
对一笔交易添加备注
taobao.trade.memo.update
修改交易备注
taobao.trade.fullinfo.get
获取单笔交易的详细信息
taobao.trade.close
卖家关闭一笔交易
taobao.trades.sold.increment.get
查询卖家已卖出的增量交易数据(根据修改时间)
taobao.trade.confirmfee.get
获取交易确认收货费用
taobao.trade.ordersku.update
更新交易的销售属性
taobao.trade.shippingaddress.update
更改交易的收货地址
taobao.trade.amount.get
交易帐务查询
taobao.trade.receivetime.delay
延长交易收货时间
taobao.trade.postage.update
修改交易邮费价格
taobao.trades.sold.incrementv.get
查询卖家已卖出的增量交易数据(根据入库时间)
taobao.trades.sold.query
根据收件人信息查询交易单号
taobao.top.oaid.merge
OAID订单合并
taobao.top.once.token.get
网关一次性token获取
taobao.trade.invoice.amount.get
获取订单应开票金额
taobao.top.secret.extend
虚拟号延期
taobao.fulfillment.order.assemble
拆合单结果回传接口
taobao.top.secret.bill.detail
服务商的商家解密账单详情查询
qimen.taobao.chengfei.qimen.test.get
奇门测试chengfei
taobao.trade.sellermemos.get
查询订单备注列表
taobao.trade.sellerflags.get
查询商家插旗
taobao.trade.invoice.summary.get
获取订单应开票信息
taobao.trade.support.refund.open
预售订单打开退定金入口
taobao.ofn.subsidy.difference.refund.query
回收单补贴追差查询接口
taobao.ofn.subsidy.difference.refund.cancel
补贴追差撤销接口
taobao.ofn.subsidy.difference.refund.apply
补贴追差发起接口
taobao.trade.memo.add (对一笔交易添加备注)
¥开放平台免费API
需要授权
根据登录用户的身份(买家或卖家),自动添加相应的交易备注,不能重复调用些接口添加备注,需要更新备注请用taobao.trade.memo.update
公共参数
请求地址:
环境
HTTP请求地址
HTTPS请求地址
正式环境
http://gw.api.taobao.com/router/rest
https://eco.taobao.com/router/rest
公共请求参数:
名称
类型
是否必须
描述
method
String
是
API接口名称。
app_key
String
是
TOP分配给应用的AppKey。
target_app_key
String
否
被调用的目标AppKey,仅当被调用的API为第三方ISV提供时有效。
sign_method
String
是
签名的摘要算法,可选值为:hmac,md5。
sign
String
是
API输入参数签名结果,签名算法介绍请点击这里。
session
String
否
用户登录授权成功后,TOP颁发给应用的授权信息,详细介绍请点击这里。当此API的标签上注明:“需要授权”,则此参数必传;“不需要授权”,则此参数不需要传;“可选授权”,则此参数为可选。
timestamp
String
是
时间戳,格式为yyyy-MM-dd HH:mm:ss,时区为GMT+8,例如:2015-01-01 12:00:00。淘宝API服务端允许客户端请求最大时间误差为10分钟。
format
String
否
响应格式。默认为xml格式,可选值:xml,json。
v
String
是
API协议版本,可选值:2.0。
partner_id
String
否
合作伙伴身份标识。
simplify
Boolean
否
是否采用精简JSON返回格式,仅当format=json时有效,默认值为:false。
请求参数
名称
类型
是否必须
示例值
更多限制
描述
tid
Number
必须
123456789
交易编号
memo
String
必须
交易备注
交易备注。最大长度: 1000个字节
flag
Number
可选
1
默认值:0
交易备注旗帜,可选值为:0(灰色), 1(红色), 2(黄色), 3(绿色), 4(蓝色), 5(紫色), 6(橙色), 7(浅蓝), 8(浅粉), 9(深绿), 10(桃红), 默认值为0
tag
String
可选
红色旗子
插旗备注
operator
Number
可选
123456
操作者
响应参数
名称
类型
示例值
描述
trade
Trade
对一笔交易添加备注后返回其对应的Trade,Trade中可用的返回字段有tid和created
└ tid
Number
2231958349
交易编号 (父订单的交易编号)
└ created
Date
2000-01-01 00:00:00
交易创建时间。格式:yyyy-MM-dd HH:mm:ss
请求示例
JAVA
.NET
PHP
CURL
Python
C/C++
NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
TradeMemoAddRequest req = new TradeMemoAddRequest();
req.setTid(123456789L);
req.setMemo("交易备注");
req.setFlag(1L);
req.setTag("红色旗子");
req.setOperator(123456L);
TradeMemoAddResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
TradeMemoAddRequest req = new TradeMemoAddRequest();
req.Tid = 123456789L;
req.Memo = "交易备注";
req.Flag = 1L;
req.Tag = "红色旗子";
req.Operator = 123456L;
TradeMemoAddResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new TradeMemoAddRequest;
$req->setTid("123456789");
$req->setMemo("交易备注");
$req->setFlag("1");
$req->setTag("红色旗子");
$req->setOperator("123456");
$resp = $c->execute($req, $sessionKey);
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=taobao.trade.memo.add' \
-d 'partner_id=apidoc' \
-d 'session=e9def64b-2cea-4b69-b709-04a8d0150c22' \
-d 'sign=276A3E70BCA5406ACA366892707C8A18' \
-d 'sign_method=hmac' \
-d 'timestamp=2026-07-25+21%3A28%3A05' \
-d 'v=2.0' \
-d 'flag=1' \
-d 'memo=%E4%BA%A4%E6%98%93%E5%A4%87%E6%B3%A8' \
-d 'operator=123456' \
-d 'tag=%E7%BA%A2%E8%89%B2%E6%97%97%E5%AD%90' \
-d 'tid=123456789'
# -*- coding: utf-8 -*-
import top.api
req=top.api.TradeMemoAddRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.tid=123456789
req.memo="交易备注"
req.flag=1
req.tag="红色旗子"
req.operator=123456
try:
resp= req.getResponse(sessionkey)
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,"taobao.trade.memo.add");
add_param(pRequest,"tid","123456789");
add_param(pRequest,"memo","交易备注");
add_param(pRequest,"flag","1");
add_param(pRequest,"tag","红色旗子");
add_param(pRequest,"operator","123456");
pResponse = top_execute(pClient,pRequest,sessionKey);
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',
'url': 'http://gw.api.taobao.com/router/rest'
});
client.execute('taobao.trade.memo.add', {
'tid':'123456789',
'memo':'交易备注',
'flag':'1',
'tag':'红色旗子',
'operator':'123456'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})
响应示例
XML示例
JSON示例
{
"trade_memo_add_response":{
"trade":{
"tid":2231958349,
"created":"2000-01-01 00:00:00"
}
}
}
异常示例
XML示例
JSON示例
50
{
"error_response":{
"msg":"Remote service error",
"code":50,
"sub_msg":"非法参数",
"sub_code":"isv.invalid-parameter"
}
}
错误码解释
错误码
错误描述
解决方案
isv.trade-not-exist
trade 不存在
isv.invalid-parameter
参数无效,格式不对、非法值、越界等
isv.invalid-permission
必须是此交易的卖家或买家才能添加交易备注
查看是否程序出问导致添加交易备注的交易不属于该卖家,出现错误不要重试
API工具
API测试工具
错误码查询工具
SDK下载
如何获得此API
FAQ
我要提问