创建交易单
curl --request POST \
--url https://{api}.subotiz.com/api/v1/trades \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"amount": "<string>",
"currency": "<string>",
"order_id": "<string>",
"payment_mode": "<string>",
"txn_time": "<string>",
"server_name": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
currency: '<string>',
order_id: '<string>',
payment_mode: '<string>',
txn_time: '<string>',
server_name: '<string>'
})
};
fetch('https://{api}.subotiz.com/api/v1/trades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/trades"
payload = {
"amount": "<string>",
"currency": "<string>",
"order_id": "<string>",
"payment_mode": "<string>",
"txn_time": "<string>",
"server_name": "<string>"
}
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/trades",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'currency' => '<string>',
'order_id' => '<string>',
'payment_mode' => '<string>',
'txn_time' => '<string>',
'server_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Request-Id: <request-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{api}.subotiz.com/api/v1/trades"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{api}.subotiz.com/api/v1/trades")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"trade_id": "<string>",
"access_no": "<string>",
"merchant_id": "<string>",
"amount": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"callback_url": "<string>",
"metadata": {},
"last_payment_error": {
"code": "<string>",
"message": "<string>"
},
"next_action": {
"type": "<string>",
"redirect": {
"url": "<string>"
},
"client": {
"confirm_url": "<string>",
"apple_pay_session": "<string>"
}
},
"order_id": "<string>",
"last_trans_id": "<string>",
"paid_at": "<string>",
"payment_mode": "<string>",
"payment_token": "<string>",
"payment_method": "<string>",
"payment_channel": "<string>",
"return_url": "<string>",
"trade_status": "<string>",
"txn_time": "<string>",
"created_at": "<string>",
"refund_status": "<string>",
"total_refunded_amount": "<string>",
"session_id": "<string>",
"session_url": "<string>",
"refer_info": {
"country_code": "<string>",
"ip": "<string>",
"device": "<string>",
"user_agent": "<string>"
},
"order_type": "<string>",
"tax_amount": "<string>"
}
}交易单
创建交易单
创建交易单
POST
/
api
/
v1
/
trades
创建交易单
curl --request POST \
--url https://{api}.subotiz.com/api/v1/trades \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"amount": "<string>",
"currency": "<string>",
"order_id": "<string>",
"payment_mode": "<string>",
"txn_time": "<string>",
"server_name": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
currency: '<string>',
order_id: '<string>',
payment_mode: '<string>',
txn_time: '<string>',
server_name: '<string>'
})
};
fetch('https://{api}.subotiz.com/api/v1/trades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/trades"
payload = {
"amount": "<string>",
"currency": "<string>",
"order_id": "<string>",
"payment_mode": "<string>",
"txn_time": "<string>",
"server_name": "<string>"
}
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/trades",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'currency' => '<string>',
'order_id' => '<string>',
'payment_mode' => '<string>',
'txn_time' => '<string>',
'server_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Request-Id: <request-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{api}.subotiz.com/api/v1/trades"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{api}.subotiz.com/api/v1/trades")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"order_id\": \"<string>\",\n \"payment_mode\": \"<string>\",\n \"txn_time\": \"<string>\",\n \"server_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"trade_id": "<string>",
"access_no": "<string>",
"merchant_id": "<string>",
"amount": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"callback_url": "<string>",
"metadata": {},
"last_payment_error": {
"code": "<string>",
"message": "<string>"
},
"next_action": {
"type": "<string>",
"redirect": {
"url": "<string>"
},
"client": {
"confirm_url": "<string>",
"apple_pay_session": "<string>"
}
},
"order_id": "<string>",
"last_trans_id": "<string>",
"paid_at": "<string>",
"payment_mode": "<string>",
"payment_token": "<string>",
"payment_method": "<string>",
"payment_channel": "<string>",
"return_url": "<string>",
"trade_status": "<string>",
"txn_time": "<string>",
"created_at": "<string>",
"refund_status": "<string>",
"total_refunded_amount": "<string>",
"session_id": "<string>",
"session_url": "<string>",
"refer_info": {
"country_code": "<string>",
"ip": "<string>",
"device": "<string>",
"user_agent": "<string>"
},
"order_type": "<string>",
"tax_amount": "<string>"
}
}授权
Bearer API Key 鉴权。格式:Authorization: Bearer {your_api_key}
请求头
请求的唯一标识符
请求体
application/json
支付金额,金额必须大于0,只有使用 subscription 支付方式时可出现0。截取两位小数
金额对应的交易币种,编码遵照ISO4217
接入方订单 ID
支付业务模式:
- onetime_payment:一次性支付,需要收集顾客支付信息,传入 payment_method_data 字段
- subscription:首次订阅支付,需要收集顾客支付信息,传入 payment_method_data 字段,支付成功时会返回 payment_token 用于后续订阅续费
- recurring_payment:订阅续订支付,需要传入 payment_token 完成支付,无需收集用户支付信息
交易发起时间,UTC格式,示例:2025-07-02T15:04:05Z
客户端域名信息,固定值: checkout.subotiz.com
Subotiz 顾客 id,关联 Subotiz 中已有顾客,与 customer_data 字段二选一,在需要关联已有顾客的场景选择使用该字段
顾客数据,在 Subotiz 创建顾客对象,与 customer_id 字段二选一,在需要创建新顾客的场景选择使用该字段。
Show child attributes
Show child attributes
一组可附加到对象上的键值对,允许您以结构化格式存储附加信息。
顾客支付 token,用于订阅续订,使用 recurring_payment 支付方式时必传。
在类似 3DS 跳转支付场景时,支付渠道受理成功后重定向的页面
顾客支付信息,首次订阅支付,使用 subscription 支付方式时必传
Show child attributes
Show child attributes
交易摘要信息,如果渠道接口支持,该字段会传递给渠道。当前仅支持自有支付的非0元支付
客户的来源信息
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I