结账会话
更新结账会话
更新现有结账会话的字段,仅修改您发送的值
PATCH
/
checkout
/
sessions
/
{checkout_session}
更新结账会话
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session} \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"country": "BR",
"amount": {
"currency": "ARS"
},
"alternative_amount": {
"currency": "ARS"
},
"merchant_order_id": "007",
"payment_description": "Payment Test",
"account_id": "{{account_id}}"
}
'import requests
url = "https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}"
payload = {
"country": "BR",
"amount": { "currency": "ARS" },
"alternative_amount": { "currency": "ARS" },
"merchant_order_id": "007",
"payment_description": "Payment Test",
"account_id": "{{account_id}}"
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
country: 'BR',
amount: {currency: 'ARS'},
alternative_amount: {currency: 'ARS'},
merchant_order_id: '007',
payment_description: 'Payment Test',
account_id: '{{account_id}}'
})
};
fetch('https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'country' => 'BR',
'amount' => [
'currency' => 'ARS'
],
'alternative_amount' => [
'currency' => 'ARS'
],
'merchant_order_id' => '007',
'payment_description' => 'Payment Test',
'account_id' => '{{account_id}}'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"private-secret-key: <api-key>",
"public-api-key: <api-key>"
],
]);
$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-sandbox.y.uno/v1/checkout/sessions/{checkout_session}"
payload := strings.NewReader("{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
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.patch("https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}"
response = http.request(request)
puts response.read_body{
"merchant_order_id": "007",
"checkout_session": "c67ce158-6053-4661-a1de-aed5c945b935",
"country": "BR",
"payment_description": "Payment Test",
"callback_url": null,
"amount": {
"currency": "ARS",
"value": 100
},
"created_at": "2025-11-14T00:43:22.719648Z",
"metadata": null,
"workflow": "SDK_CHECKOUT",
"installments": {
"plan_id": null,
"plan": null
},
"used": false,
"customer_id": "5e7baf7d-88d5-47c4-8baf-93354d5e195e",
"recurring_payment": {
"description": "Monthly subscription",
"management_url": "https://example.com/manage",
"billing_agreement": "BA-123",
"regular_billing": {
"label": "Monthly",
"amount": 9.99,
"interval_unit": "month",
"interval_count": 1
},
"trial_billing": {
"label": "Free trial",
"amount": 0,
"interval_unit": "month",
"interval_count": 1
}
},
"checkout_id": "fd9b15a0-92a4-4e2c-8e4c-27764a1aa43e"
}
使用此 endpoint 更新现有的结账会话。只有您发送的字段会被更新。
更新结账会话不会延长其有效期。会话仍会在创建后 2.5 小时过期(在 sandbox 中为 3.5 小时)。如果会话已经过期,此 endpoint 会返回
CHECKOUT_SESSION_EXPIRED_TIME,您必须创建新的结账会话。授权
请求体
application/json
必须处理该交易的国家(MAX 2;MIN 2;ISO 3166-1)。
账户的唯一标识符。您可以在 Yuno Dashboard 上找到此信息(UUID,36 个字符)。
客户的唯一标识符,通过 Create Customer endpoint 创建(UUID,36 个字符)。
响应
200
此页面对您有帮助吗?
⌘I
更新结账会话
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session} \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"country": "BR",
"amount": {
"currency": "ARS"
},
"alternative_amount": {
"currency": "ARS"
},
"merchant_order_id": "007",
"payment_description": "Payment Test",
"account_id": "{{account_id}}"
}
'import requests
url = "https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}"
payload = {
"country": "BR",
"amount": { "currency": "ARS" },
"alternative_amount": { "currency": "ARS" },
"merchant_order_id": "007",
"payment_description": "Payment Test",
"account_id": "{{account_id}}"
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
country: 'BR',
amount: {currency: 'ARS'},
alternative_amount: {currency: 'ARS'},
merchant_order_id: '007',
payment_description: 'Payment Test',
account_id: '{{account_id}}'
})
};
fetch('https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'country' => 'BR',
'amount' => [
'currency' => 'ARS'
],
'alternative_amount' => [
'currency' => 'ARS'
],
'merchant_order_id' => '007',
'payment_description' => 'Payment Test',
'account_id' => '{{account_id}}'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"private-secret-key: <api-key>",
"public-api-key: <api-key>"
],
]);
$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-sandbox.y.uno/v1/checkout/sessions/{checkout_session}"
payload := strings.NewReader("{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
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.patch("https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/checkout/sessions/{checkout_session}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"BR\",\n \"amount\": {\n \"currency\": \"ARS\"\n },\n \"alternative_amount\": {\n \"currency\": \"ARS\"\n },\n \"merchant_order_id\": \"007\",\n \"payment_description\": \"Payment Test\",\n \"account_id\": \"{{account_id}}\"\n}"
response = http.request(request)
puts response.read_body{
"merchant_order_id": "007",
"checkout_session": "c67ce158-6053-4661-a1de-aed5c945b935",
"country": "BR",
"payment_description": "Payment Test",
"callback_url": null,
"amount": {
"currency": "ARS",
"value": 100
},
"created_at": "2025-11-14T00:43:22.719648Z",
"metadata": null,
"workflow": "SDK_CHECKOUT",
"installments": {
"plan_id": null,
"plan": null
},
"used": false,
"customer_id": "5e7baf7d-88d5-47c4-8baf-93354d5e195e",
"recurring_payment": {
"description": "Monthly subscription",
"management_url": "https://example.com/manage",
"billing_agreement": "BA-123",
"regular_billing": {
"label": "Monthly",
"amount": 9.99,
"interval_unit": "month",
"interval_count": 1
},
"trial_billing": {
"label": "Free trial",
"amount": 0,
"interval_unit": "month",
"interval_count": 1
}
},
"checkout_id": "fd9b15a0-92a4-4e2c-8e4c-27764a1aa43e"
}