创建结账会话
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>"
}
}结账会话
创建结账会话
创建结账会话
POST
/
api
/
v1
/
session
创建结账会话
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>"
}
}请求体
application/json
创建 checkout session 的请求
订单应税分类。仅 mode=payment 时生效,可选。
Software as a service (SaaS):通过互联网提供软件服务的模式,用户可按需订阅,无需本地安装或维护。Software:可下载/授权独立软件:需要本地安装的独立软件(如安装包、许可证密钥)。Online Video Content:视频内容:通过流媒体或下载提供的视频内容(如课程、影片、直播流)。Information Service:数字数据/报告:提供数据、新闻或分析的数字产品(如数据库、行业报告)。eBook:电子书/数字出版物:可在电子设备上阅读的数字化图书或出版物。Digital Graphic / Template:可编辑数字模板:可编辑的数字设计素材(如PSD模板、PowerPoint模板)。Video Game:数字游戏:交互式数字游戏,包括下载、内购或订阅服务(如Xbox Game Pass)。Blockchain Digital Products:加密数字资产:基于区块链的唯一数字资产(如NFT艺术品、虚拟房产)。Other Digital Products:其他虚拟商品:未涵盖的其他虚拟商品(如活动门票)。 未传或传入值不在上述范围时按未传处理(回落到商户默认税码),不报错、不阻断结账会话创建
此页面对您有帮助吗?