curl --request POST \
--url https://{api}.subotiz.com/api/v1/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"order_id": "<string>",
"line_items": [
{
"price_id": "<string>",
"quantity": "<string>",
"quantity_editable": true,
"quantity_min": "<string>",
"quantity_max": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
order_id: '<string>',
line_items: [
{
price_id: '<string>',
quantity: '<string>',
quantity_editable: true,
quantity_min: '<string>',
quantity_max: '<string>'
}
]
})
};
fetch('https://{api}.subotiz.com/api/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/session"
payload = {
"order_id": "<string>",
"line_items": [
{
"price_id": "<string>",
"quantity": "<string>",
"quantity_editable": True,
"quantity_min": "<string>",
"quantity_max": "<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/session",
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([
'order_id' => '<string>',
'line_items' => [
[
'price_id' => '<string>',
'quantity' => '<string>',
'quantity_editable' => true,
'quantity_min' => '<string>',
'quantity_max' => '<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/session"
payload := strings.NewReader("{\n \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\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/session")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/session")
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 \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"session_id": "<string>",
"session_url": "<string>"
}
}创建结账会话
创建结账会话
curl --request POST \
--url https://{api}.subotiz.com/api/v1/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"order_id": "<string>",
"line_items": [
{
"price_id": "<string>",
"quantity": "<string>",
"quantity_editable": true,
"quantity_min": "<string>",
"quantity_max": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
order_id: '<string>',
line_items: [
{
price_id: '<string>',
quantity: '<string>',
quantity_editable: true,
quantity_min: '<string>',
quantity_max: '<string>'
}
]
})
};
fetch('https://{api}.subotiz.com/api/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/session"
payload = {
"order_id": "<string>",
"line_items": [
{
"price_id": "<string>",
"quantity": "<string>",
"quantity_editable": True,
"quantity_min": "<string>",
"quantity_max": "<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/session",
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([
'order_id' => '<string>',
'line_items' => [
[
'price_id' => '<string>',
'quantity' => '<string>',
'quantity_editable' => true,
'quantity_min' => '<string>',
'quantity_max' => '<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/session"
payload := strings.NewReader("{\n \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\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/session")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/session")
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 \"order_id\": \"<string>\",\n \"line_items\": [\n {\n \"price_id\": \"<string>\",\n \"quantity\": \"<string>\",\n \"quantity_editable\": true,\n \"quantity_min\": \"<string>\",\n \"quantity_max\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"session_id": "<string>",
"session_url": "<string>"
}
}授权
Bearer API Key 鉴权。格式:Authorization: Bearer {your_api_key}
请求头
请求的唯一标识符
请求体
创建 checkout session 的请求
接入方订单号
本次结账包含的商品定价数组(目前仅支持一个 lineItem)
Show child attributes
Show child attributes
Subotiz 平台顾客唯一标识,需提前在 Subotiz 创建。payer_id 、customer_id 和 email 必须存在其一
顾客邮箱
顾客支付成功之后跳转的 URL。若调用时传入了 URL,则优先使用传入值。若未传入,则自动使用开发者信息中的默认配置。
顾客取消支付之后跳转的 URL。若调用时传入了 URL,则优先使用传入值。若未传入,则自动使用开发者信息中的默认配置。
支付模式,用于判断是否校验商品信息:
- checkout:校验商品数据,默认值
- payment:不校验商品数据
接入方的顾客 ID,如果传入的 ID 不存在与 Subotiz 系统中,那么会自动创建顾客,每个商户下的 payer_id 是唯一的。
集成模式:
- hosted:托管式,默认为该模式
- embedded :嵌入式集成
支付金额,当 mode 选择 payment 模式时必填金额。
嵌入式ui模式的重定向行为
- always: 支付成功后,会自动重定向到 return_url
- if_required: 仅在有重定向的付款方式才会重定向到return_url
指定结账会话所使用的语言,默认根据浏览器语言确定。
可选值:
- ar-SA:阿拉伯语(沙特阿拉伯)
- de-DE:德语(德国)
- en-US:英语(美国)
- es-ES:西班牙语(西班牙)
- fr-FR:法语(法国)
- id-ID:印尼语(印度尼西亚)
- it-IT:意大利语(意大利)
- ja-JP:日语(日本)
- ko-KR:韩语(韩国)
- nl-NL:荷兰语(荷兰)
- pl-PL:波兰语(波兰)
- pt-PT:葡萄牙语(葡萄牙)
- ru-RU:俄语(俄罗斯)
- th-TH:泰语(泰国)
- zh-CN:中文(中国大陆)
- zh-TW:中文(中国台湾)
指定结账会话的订单结算币种,传入平台支持的 ISO 4217 货币代码,如 USD、CNY。系统会以店铺主货币为基准,将订单金额换算为该币种进行展示与计价;未传 merchant_rate 时,系统默认按当日实时汇率完成换算。
指定店铺主货币兑换 target_currency 的自定义汇率,传入值须为大于 0 的数字,且必须与 target_currency 同时传入。该字段仅在订单结算币种与店铺主货币不一致时使用。汇率方向为“1 单位店铺主货币可兑换的 target_currency 金额”。例如:店铺主货币为 USD,target_currency 为 CNY,传入 7.999 表示 1 USD = 7.999 CNY,系统将按该汇率计算订单金额。
一组可附加到对象上的键值对,允许您以结构化格式存储附加信息。
传递给结账会话中订阅创建的子集参数
Show child attributes
Show child attributes
传递给结账会话中交易创建的子集参数
Show child attributes
Show child attributes
首次交易来源渠道识别,用于交易归因统计,长度限制为 50 个字符。
账单地址信息
Show child attributes
Show child attributes
支付业务模式:
onetime_payment:一次性支付模式。仅处理单次支付交易,不创建任何重复支付令牌。subscription:订阅支付模式。处理初始支付,并生成用于自动重复支付的支付令牌。后续的续费费用将根据订阅计划配置使用此令牌进行处理。
试用期定价限制试用 1 次. 1: 不限制, 2:限制试用一次, 3: 跳过试用期
订阅固定期限,取值正整数
是否支持固定期限转为持续订阅
此页面对您有帮助吗?