Create Customer Session
Creates a customer session for enrolling and managing saved payment methods for future use
curl --request POST \
--url https://api-sandbox.y.uno/v1/customers/sessions \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"account_id": "8beac4de-5f6f-11ed-9b6a-0242ac120002",
"customer_id": "ae106483-65ee-463b-8782-9794022b3112",
"country": "US",
"callback_url": "https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df",
"created_at": "2025-05-07T20:00:18.721786Z",
"checkout_id": "6822f80c-684e-41a3-8628-78963d3d60f7",
"metadata": [
{
"key": "on_behalf_of",
"value": "acct_1A2b3C4d5E6f7G8h"
},
{
"key": "order_ref",
"value": "ABC-123"
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/customers/sessions"
payload = {
"account_id": "8beac4de-5f6f-11ed-9b6a-0242ac120002",
"customer_id": "ae106483-65ee-463b-8782-9794022b3112",
"country": "US",
"callback_url": "https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df",
"created_at": "2025-05-07T20:00:18.721786Z",
"checkout_id": "6822f80c-684e-41a3-8628-78963d3d60f7",
"metadata": [
{
"key": "on_behalf_of",
"value": "acct_1A2b3C4d5E6f7G8h"
},
{
"key": "order_ref",
"value": "ABC-123"
}
]
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '8beac4de-5f6f-11ed-9b6a-0242ac120002',
customer_id: 'ae106483-65ee-463b-8782-9794022b3112',
country: 'US',
callback_url: 'https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df',
created_at: '2025-05-07T20:00:18.721786Z',
checkout_id: '6822f80c-684e-41a3-8628-78963d3d60f7',
metadata: [
{key: 'on_behalf_of', value: 'acct_1A2b3C4d5E6f7G8h'},
{key: 'order_ref', value: 'ABC-123'}
]
})
};
fetch('https://api-sandbox.y.uno/v1/customers/sessions', 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/customers/sessions",
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([
'account_id' => '8beac4de-5f6f-11ed-9b6a-0242ac120002',
'customer_id' => 'ae106483-65ee-463b-8782-9794022b3112',
'country' => 'US',
'callback_url' => 'https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df',
'created_at' => '2025-05-07T20:00:18.721786Z',
'checkout_id' => '6822f80c-684e-41a3-8628-78963d3d60f7',
'metadata' => [
[
'key' => 'on_behalf_of',
'value' => 'acct_1A2b3C4d5E6f7G8h'
],
[
'key' => 'order_ref',
'value' => 'ABC-123'
]
]
]),
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/customers/sessions"
payload := strings.NewReader("{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api-sandbox.y.uno/v1/customers/sessions")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/customers/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}"
response = http.request(request)
puts response.read_bodycustomer_id from Create Customer.Authorizations
Body
The unique identifier of the account. You find this information on the Yuno dashboard (UUID, 36 chars).
The customer's country (MAX 2; MIN 2; ISO 3166-1).
AR, BO, BR, CL, CO, CR, EC, SV, GT, HN, MX, NI, PA, PY, PE, US, UY The unique identifier of the customer, created using the Create Customer endpoint (UUID, 36 chars).
The URL to redirect your customer after the enrollment is made in the provider's environment (MAX 526; MIN 3).
The unique identifier (UUID) of the Custom Checkout to use for this enrollment session. Optional. When omitted, the session uses the account's default checkout.
Optional custom key–value tags for the payment method enrolled with this session. They behave like the metadata of a direct enrollment: stored with the enrolled payment method, returned when you retrieve it and on the enrollment.enroll webhook, and sent to the provider integration with the enrollment, except the reserved gateway_options entry, which is stored and returned but not forwarded. Up to 120 items and 75000 characters in total, counting every key and value.
Show child attributes
Show child attributes
Response
201
"7dd71f21-9e4c-439a-9c6d-58f240bd28df"
"ae106483-65ee-463b-8782-9794022b3112"
"US"
"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df"
"2025-05-07T20:00:18.721786Z"
"6822f80c-684e-41a3-8628-78963d3d60f7"
Was this page helpful?
curl --request POST \
--url https://api-sandbox.y.uno/v1/customers/sessions \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"account_id": "8beac4de-5f6f-11ed-9b6a-0242ac120002",
"customer_id": "ae106483-65ee-463b-8782-9794022b3112",
"country": "US",
"callback_url": "https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df",
"created_at": "2025-05-07T20:00:18.721786Z",
"checkout_id": "6822f80c-684e-41a3-8628-78963d3d60f7",
"metadata": [
{
"key": "on_behalf_of",
"value": "acct_1A2b3C4d5E6f7G8h"
},
{
"key": "order_ref",
"value": "ABC-123"
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/customers/sessions"
payload = {
"account_id": "8beac4de-5f6f-11ed-9b6a-0242ac120002",
"customer_id": "ae106483-65ee-463b-8782-9794022b3112",
"country": "US",
"callback_url": "https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df",
"created_at": "2025-05-07T20:00:18.721786Z",
"checkout_id": "6822f80c-684e-41a3-8628-78963d3d60f7",
"metadata": [
{
"key": "on_behalf_of",
"value": "acct_1A2b3C4d5E6f7G8h"
},
{
"key": "order_ref",
"value": "ABC-123"
}
]
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '8beac4de-5f6f-11ed-9b6a-0242ac120002',
customer_id: 'ae106483-65ee-463b-8782-9794022b3112',
country: 'US',
callback_url: 'https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df',
created_at: '2025-05-07T20:00:18.721786Z',
checkout_id: '6822f80c-684e-41a3-8628-78963d3d60f7',
metadata: [
{key: 'on_behalf_of', value: 'acct_1A2b3C4d5E6f7G8h'},
{key: 'order_ref', value: 'ABC-123'}
]
})
};
fetch('https://api-sandbox.y.uno/v1/customers/sessions', 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/customers/sessions",
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([
'account_id' => '8beac4de-5f6f-11ed-9b6a-0242ac120002',
'customer_id' => 'ae106483-65ee-463b-8782-9794022b3112',
'country' => 'US',
'callback_url' => 'https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df',
'created_at' => '2025-05-07T20:00:18.721786Z',
'checkout_id' => '6822f80c-684e-41a3-8628-78963d3d60f7',
'metadata' => [
[
'key' => 'on_behalf_of',
'value' => 'acct_1A2b3C4d5E6f7G8h'
],
[
'key' => 'order_ref',
'value' => 'ABC-123'
]
]
]),
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/customers/sessions"
payload := strings.NewReader("{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api-sandbox.y.uno/v1/customers/sessions")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/customers/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"8beac4de-5f6f-11ed-9b6a-0242ac120002\",\n \"customer_id\": \"ae106483-65ee-463b-8782-9794022b3112\",\n \"country\": \"US\",\n \"callback_url\": \"https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df\",\n \"created_at\": \"2025-05-07T20:00:18.721786Z\",\n \"checkout_id\": \"6822f80c-684e-41a3-8628-78963d3d60f7\",\n \"metadata\": [\n {\n \"key\": \"on_behalf_of\",\n \"value\": \"acct_1A2b3C4d5E6f7G8h\"\n },\n {\n \"key\": \"order_ref\",\n \"value\": \"ABC-123\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body