# 04-交易
# 1 订单
# 1.1 创建订单(POST)
下单接口,根据发货地和目的地下单,如果发货地和目的地不一样,则需要分别下单
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/order/createOrder
# CURL
curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/shopping/order/createOrder' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"orderNumber": "1234",
"shippingZip": "123",
"shippingCountryCode": "US",
"shippingCountry": "123",
"shippingProvince": "123",
"shippingCity": "132",
"shippingAddress": "123213",
"shippingCustomerName": "123",
"shippingPhone": "111",
"remark": "note",
"fromCountryCode": "CN",
"logisticName": "PostNL",
"houseNumber": "123",
"products": [
{
"vid": "92511400-C758-4474-93CA-66D442F5F787",
"quantity": 1,
"shippingName": "123"
}
]
}'
参数名称 | 参数意义 | 参数类型 | 是否必传 | 长度 | 备注 |
---|---|---|---|---|---|
orderNumber | 订单编号 | String | Y | 40 | The ID of the order, used for API purposes. This is different from the orderNumber property, which is a unique identifier for the order that's used by the shop owner and customer |
shippingCountryCode | 交易国家简码 | string | 是 | 200 | |
shippingCountry | 交易国家 | string | 是 | 200 | |
shippingProvince | 交易省 | string | 是 | 200 | |
shippingCity | 交易城市 | string | 是 | 200 | |
shippingAddress | 交易地址 | string | 是 | 200 | |
shippingCustomerName | 交易接收人 | string | 是 | 200 | |
shippingZip | 交易邮编 | string | 是 | 200 | |
shippingPhone | 交易电话 | string | 是 | 200 | 收货人,电话号码一定要准确 |
remark | 订单备注 | string | 否 | 500 | |
logisticName | 物流名称 | string | 是 | 200 | |
fromCountryCode | 发货地 | string | 是 | 200 | 发货仓库 |
houseNumber | 门牌号 | string | 否 | 20 | |
products | list | 是 | 200 | ||
vid | 变体 id | string | 是 | 200 | |
quantity | 变体 数量 | string | 是 | 200 | |
shippingName | 交易名称 | string | 是 | 200 | 交易名称,仅仅作为订单显示,不对业务产生任何影响 |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": "210711100018655344",
"requestId": "9eddf3f5-bd3d-4fae-a4f2-028cbb90db97"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回(订单号) | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 1.2 订单列表(GET)
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/order/list?pageNum=1&pageSize=10
# CURL
curl --location --request GET 'https://developers.cjdropshipping.com/api2.0/v1/shopping/order/list?pageNum=1&pageSize=10' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
参数名称 | 参数意义 | 参数类型 | 是否必传 | 长度 | 备注 |
---|---|---|---|---|---|
pageNum | 页数 | int | 否 | 20 | 默认 1 |
pageSize | 每页返回多少条 | int | 否 | 20 | 默认 20 |
orderIds | 订单ID | List | 否 | 100 | 查询条件 |
status | 订单状态 | string | 否 | 20 | 默认值: CANCELLED, 可选值:CREATED,IN_CART,UNPAID,UNSHIPPED,SHIPPED,DELIVERED,CANCELLED,OTHER |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": {
"orderId": "210823100016290555",
"orderNum": "api_52f268d40b8d460e82c0683955e63cc9",
"cjOrderId": null,
"shippingCountryCode": "US",
"shippingProvince": "Connecticut",
"shippingCity": "ftdsr",
"shippingPhone": "43514123",
"shippingAddress": "rfdxf rfdesr",
"shippingCustomerName": "Xu Old",
"remark": null,
"orderWeight": 20,
"orderStatus": "CREATED",
"orderAmount": 4.25,
"productAmount": 0.57,
"postageAmount": 3.68,
"logisticName": "CJPacket Ordinary",
"trackNumber": null,
"createDate": "2021-08-23 11:31:45",
"paymentDate": null,
"productList": [
{
"vid": "1392053744945991680",
"quantity": 1,
"sellPrice": 0.57
}
]
},
"requestId": "3adccdcb-d41b-4808-996b-c7c5c833d77d"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
orderId | 订单ID | string | 200 | |
orderNum | 订单号 | string | 200 | |
cjOrderId | CJ订单ID | string | 200 | |
shippingCountryCode | 交易国家 | string | 200 | |
shippingProvince | 交易省份 | string | 200 | |
shippingCity | 交易城市 | string | 200 | |
shippingAddress | 交易地址 | string | 200 | |
shippingCustomerName | 交易接收人 | string | 是 | 200 |
shippingPhone | 交易电话 | string | 200 | |
remark | 订单备注 | string | 否 | 500 |
logisticName | 物流名称 | string | 200 | |
trackNumber | 追踪单号 | string | 200 | |
orderWeight | 订单重量 | int | 200 | |
orderAmount | 订单金额 | BigDecimal | (18,2) | 单位:$(美元) |
productAmount | 商品金额 | BigDecimal | (18,2) | 单位:$(美元) |
postageAmount | 物流金额 | BigDecimal | (18,2) | 单位:$(美元) |
orderStatus | 订单状态 | string | 200 | 参考订单状态 |
createDate | 创建时间 | string | 200 | |
paymentDate | 支付时间 | string | 200 | |
productList | list | 200 | ||
vid | 变体ID | string | 200 | |
quantity | 数量 | int | 200 | |
sellPrice | 售价 | BigDecimal | (18,2) | 单位:$(美元) |
订单状态
订单状态 | 状态 |
---|---|
CREATED | 创建订单 |
IN_CART | 加入购物车 |
UNPAID | 未支付 |
UNSHIPPED | 未发货 |
SHIPPED | 发货 |
DELIVERED | 已完成 |
CANCELLED | 取消 |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 1.3 订单查询(GET)
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/order/getOrderDetail?orderId=210711100018043276
# CURL
curl --location --request GET 'https://developers.cjdropshipping.com/api2.0/v1/shopping/order/getOrderDetail?orderId=210711100018043276' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
参数名称 | 参数意义 | 参数类型 | 是否必传 | 长度 | 备注 |
---|---|---|---|---|---|
orderId | 订单 id | string | 是 | 200 | 查询条件 |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": {
"orderId": "210823100016290555",
"orderNum": "api_52f268d40b8d460e82c0683955e63cc9",
"cjOrderId": null,
"shippingCountryCode": "US",
"shippingProvince": "Connecticut",
"shippingCity": "ftdsr",
"shippingPhone": "43514123",
"shippingAddress": "rfdxf rfdesr",
"shippingCustomerName": "Xu Old",
"remark": null,
"orderWeight": 20,
"orderStatus": "CREATED",
"orderAmount": 4.25,
"productAmount": 0.57,
"postageAmount": 3.68,
"logisticName": "CJPacket Ordinary",
"trackNumber": null,
"createDate": "2021-08-23 11:31:45",
"paymentDate": null,
"productList": [
{
"vid": "1392053744945991680",
"quantity": 1,
"sellPrice": 0.57
}
]
},
"requestId": "3adccdcb-d41b-4808-996b-c7c5c833d77d"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
orderId | 订单ID | string | 200 | |
orderNum | 订单号 | string | 200 | |
cjOrderId | CJ订单ID | string | 200 | |
shippingCountryCode | 交易国家 | string | 200 | |
shippingProvince | 交易省份 | string | 200 | |
shippingCity | 交易城市 | string | 200 | |
shippingAddress | 交易地址 | string | 200 | |
shippingCustomerName | 交易接收人 | string | 是 | 200 |
shippingPhone | 交易电话 | string | 200 | |
remark | 订单备注 | string | 否 | 500 |
logisticName | 物流名称 | string | 200 | |
trackNumber | 追踪单号 | string | 200 | |
orderWeight | 订单重量 | int | 200 | |
orderAmount | 订单金额 | BigDecimal | (18,2) | 单位:$(美元) |
productAmount | 商品金额 | BigDecimal | (18,2) | 单位:$(美元) |
postageAmount | 物流金额 | BigDecimal | (18,2) | 单位:$(美元) |
orderStatus | 订单状态 | string | 200 | 参考订单状态 |
createDate | 创建时间 | string | 200 | |
paymentDate | 支付时间 | string | 200 | |
productList | list | 200 | ||
vid | 变体ID | string | 200 | |
quantity | 数量 | int | 200 | |
sellPrice | 售价 | BigDecimal | (18,2) | 单位:$(美元) |
订单状态
订单状态 | 状态 |
---|---|
CREATED | 创建订单 |
IN_CART | 加入购物车 |
UNPAID | 未支付 |
UNSHIPPED | 未发货 |
SHIPPED | 发货 |
DELIVERED | 已完成 |
CANCELLED | 取消 |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 1.4 订单删除(DEL)
确认订单后则无法删除
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/order/deleteOrder?orderId=210711100018655344
# CURL
curl --location --request DELETE 'https://developers.cjdropshipping.com/api2.0/v1/shopping/order/deleteOrder?orderId=210711100018655344' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
参数名称 | 参数意义 | 参数类型 | 是否必传 | 长度 | 备注 |
---|---|---|---|---|---|
orderId | 订单 id | string | 是 | 200 | 查询条件 |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": "210711100018655344",
"requestId": "721341bf-abf8-4d8c-b400-1fbdaef79039"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回(订单号) | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 1.5 订单确认(PATCH)
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/order/confirmOrder
# CURL
curl --location --request PATCH 'https://developers.cjdropshipping.com/api2.0/v1/shopping/order/confirmOrder' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"orderId": "210711100018655344"
}'
参数名称 | 参数意义 | 参数类型 | 是否必传 | 长度 | 备注 |
---|---|---|---|---|---|
orderId | 订单 id | string | 是 | 200 | 查询条件 |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": "210711100018655344",
"requestId": "721341bf-abf8-4d8c-b400-1fbdaef79039"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回(订单号) | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
error
{
"code": 1603001,
"result": false,
"message": "order confirm fail",
"data": null,
"requestId": "7dc61955-c0e8-4731-bb9b-393b4fffeaaf"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 2 支付
# 2.1 余额查询(GET)
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/pay/getBalance
# CURL
curl --location --request GET 'https://developers.cjdropshipping.com/api2.0/v1/shopping/pay/getBalance' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": {
"amount": 87247.32,
"noWithdrawalAmount": 0.00,
"freezeAmount": 0.00
},
"requestId": "36fc030a-a110-4318-bc83-f39f9d3e5484"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
amount | 余额 | string | 200 | 末尾2位小数点 |
noWithdrawalAmount | 未支付金额 | BigDecimal | (18,2) | 单位:$(美元) |
freezeAmount | 冻结金额 | BigDecimal | (18,2) | 单位:$(美元) |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
# 2.2 余额支付(POST)
# URL
https://developers.cjdropshipping.com/api2.0/v1/shopping/pay/payBalance
# CURL
curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/shopping/pay/payBalance' \
--header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"orderId": "210711100018655344"
}'
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
orderId | 订单 | string | 200 |
# 返回
success
{
"code": 200,
"result": true,
"message": "Success",
"data": 12,
"requestId": "7dbe69b9-dd82-4ee3-907c-a6fca833e3ce"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回(订单号) | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |
error
{
"code": 1600100,
"result": false,
"message": "Param error",
"data": null,
"requestId": "323fda9d-3c94-41dc-a944-5cc1b8baf5b1"
}
返回字段 | 字段意思 | 字段类型 | 长度 | 备注 |
---|---|---|---|---|
code | 错误码 | int | 20 | 返回错误码标准表 |
result | 是否正常返回 | boolean | 1 | |
message | 返回信息 | string | 200 | |
data | 接口数据返回 | |||
requestId | 请求Id | string | 48 | 用于日志查询错误 |