Create Payment
Creates a payment from an existing checkout session and a payment method. Set a stable merchant_order_id on the upstream checkout session so a retry of the same logical operation can be looked up via Get Payment by Merchant Order instead of producing a duplicate payment.
curl --request POST \
--url https://api-sandbox.y.uno/v1/payments \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'public-api-key: YOUR_PUBLIC_API_KEY' \
--header 'private-secret-key: YOUR_PRIVATE_SECRET_KEY' \
--data '{
"account_id": "YOUR_ACCOUNT_CODE",
"merchant_order_id": "order-20260301-001",
"description": "Premium subscription - March 2026",
"country": "BR",
"amount": { "currency": "BRL", "value": 150.00 },
"workflow": "DIRECT",
"payment_method": {
"type": "CARD",
"vaulted_token": "4a8b9c2d-1e3f-5678-90ab-cdef12345678",
"detail": { "card": { "capture": true, "installments": 1 } }
}
}'import requests
url = "https://api-sandbox.y.uno/v1/payments"
payload = {
"description": "Test Payment",
"account_id": "{{account-code}}",
"merchant_order_id": "AA01",
"merchant_reference": "Test_AAB",
"country": "US",
"additional_data": {
"airline": {
"legs": [
{
"arrival_airport": "AMS",
"base_fare": 200,
"base_fare_currency": "USD",
"carrier_code": "KL",
"departure_airport": "EZE",
"departure_airport_timezone": "-03:00",
"departure_datetime": "2024-07-03T05:00:00",
"arrival_datetime": "2024-08-03T05:00:00",
"fare_basis_code": "HL7LNR",
"fare_class_code": "FR",
"flight_number": "842",
"stopover_code": "s"
}
],
"passengers": [
{
"country": "US",
"date_of_birth": "1984-05-01",
"document": {
"document_number": "123456789",
"document_type": "SSN",
"country": "US"
},
"phone": {
"country_code": "1",
"number": "5551234567"
},
"first_name": "John",
"last_name": "Doe",
"loyalty_number": "123456",
"loyalty_tier": "GOLD",
"middle_name": "Theodore",
"nationality": "US",
"type": "s"
}
],
"pnr": "1P-2UUGJW",
"tickets": [
{
"ticket_number": "123456",
"restricted": False,
"total_fare_amount": 80,
"total_tax_amount": 22,
"total_fee_amount": 14,
"issue": None,
"e_ticket": False
}
]
},
"order": {
"fee_amount": 100,
"tip_amount": 50,
"items": [
{
"brand": "XYZ",
"category": "Clothes",
"id": "123AD",
"manufacture_part_number": "XYZ123456",
"name": "Skirt",
"quantity": 1,
"sku_code": "8765432109",
"unit_amount": 4800
}
],
"shipping_amount": 50
},
"seller_details": {
"name": "Test_company",
"email": "testcompany@example.com",
"reference": "AAOO",
"website": "www.testcompany.com",
"industry": "ELECTRONICS",
"merchant_category_code": "TTRR",
"country": "US",
"document": {
"document_number": "123456789",
"document_type": "EIN"
},
"phone": {
"country_code": "1",
"number": "5551234567"
}
}
},
"amount": {
"currency": "USD",
"value": 5000
},
"checkout": { "session": "{{checkout_session}}" },
"customer_payer": {
"id": "{{customer_id}}",
"billing_address": {
"address_line_1": "123 Main St",
"address_line_2": "Apt 502",
"city": "New York",
"country": "US",
"state": "NY",
"zip_code": "10001",
"neighborhood": "Midtown"
},
"browser_info": {
"accept_header": "true",
"color_depth": "24",
"javascript_enabled": True,
"language": "en-US",
"screen_height": "2048",
"screen_width": "1152",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"
},
"date_of_birth": "1990-02-28",
"device_fingerprints": [
{
"provider_id": "CLEARSALE",
"id": "hi88287gbd8d7d782ge287gbd8d7d78"
}
],
"document": {
"document_type": "SSN",
"document_number": "123456789"
},
"email": "johndoe@example.com",
"first_name": "John",
"gender": "M",
"ip_address": "192.168.123.167",
"last_name": "Doe",
"merchant_customer_id": "example00234",
"merchant_customer_created_at": "2014-05-12 13:05:00",
"nationality": "US",
"phone": {
"country_code": "1",
"number": "5551234567"
},
"shipping_address": {
"address_line_1": "123 Main St",
"address_line_2": "Apt 502",
"city": "New York",
"country": "US",
"state": "NY",
"zip_code": "10001",
"neighborhood": "Midtown"
}
},
"payment_method": { "token": "{{onetime_token}}" },
"metadata": [
{
"key": "ID",
"value": "SD00"
}
],
"callback_url": "www.example.com"
}
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({
description: 'Test Payment',
account_id: '{{account-code}}',
merchant_order_id: 'AA01',
merchant_reference: 'Test_AAB',
country: 'US',
additional_data: {
airline: {
legs: [
{
arrival_airport: 'AMS',
base_fare: 200,
base_fare_currency: 'USD',
carrier_code: 'KL',
departure_airport: 'EZE',
departure_airport_timezone: '-03:00',
departure_datetime: '2024-07-03T05:00:00',
arrival_datetime: '2024-08-03T05:00:00',
fare_basis_code: 'HL7LNR',
fare_class_code: 'FR',
flight_number: '842',
stopover_code: 's'
}
],
passengers: [
{
country: 'US',
date_of_birth: '1984-05-01',
document: {document_number: '123456789', document_type: 'SSN', country: 'US'},
phone: {country_code: '1', number: '5551234567'},
first_name: 'John',
last_name: 'Doe',
loyalty_number: '123456',
loyalty_tier: 'GOLD',
middle_name: 'Theodore',
nationality: 'US',
type: 's'
}
],
pnr: '1P-2UUGJW',
tickets: [
{
ticket_number: '123456',
restricted: false,
total_fare_amount: 80,
total_tax_amount: 22,
total_fee_amount: 14,
issue: null,
e_ticket: false
}
]
},
order: {
fee_amount: 100,
tip_amount: 50,
items: [
{
brand: 'XYZ',
category: 'Clothes',
id: '123AD',
manufacture_part_number: 'XYZ123456',
name: 'Skirt',
quantity: 1,
sku_code: '8765432109',
unit_amount: 4800
}
],
shipping_amount: 50
},
seller_details: {
name: 'Test_company',
email: 'testcompany@example.com',
reference: 'AAOO',
website: 'www.testcompany.com',
industry: 'ELECTRONICS',
merchant_category_code: 'TTRR',
country: 'US',
document: {document_number: '123456789', document_type: 'EIN'},
phone: {country_code: '1', number: '5551234567'}
}
},
amount: {currency: 'USD', value: 5000},
checkout: {session: '{{checkout_session}}'},
customer_payer: {
id: '{{customer_id}}',
billing_address: {
address_line_1: '123 Main St',
address_line_2: 'Apt 502',
city: 'New York',
country: 'US',
state: 'NY',
zip_code: '10001',
neighborhood: 'Midtown'
},
browser_info: {
accept_header: 'true',
color_depth: '24',
javascript_enabled: true,
language: 'en-US',
screen_height: '2048',
screen_width: '1152',
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
},
date_of_birth: '1990-02-28',
device_fingerprints: [{provider_id: 'CLEARSALE', id: 'hi88287gbd8d7d782ge287gbd8d7d78'}],
document: {document_type: 'SSN', document_number: '123456789'},
email: 'johndoe@example.com',
first_name: 'John',
gender: 'M',
ip_address: '192.168.123.167',
last_name: 'Doe',
merchant_customer_id: 'example00234',
merchant_customer_created_at: '2014-05-12 13:05:00',
nationality: 'US',
phone: {country_code: '1', number: '5551234567'},
shipping_address: {
address_line_1: '123 Main St',
address_line_2: 'Apt 502',
city: 'New York',
country: 'US',
state: 'NY',
zip_code: '10001',
neighborhood: 'Midtown'
}
},
payment_method: {token: '{{onetime_token}}'},
metadata: [{key: 'ID', value: 'SD00'}],
callback_url: 'www.example.com'
})
};
fetch('https://api-sandbox.y.uno/v1/payments', 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/payments",
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([
'description' => 'Test Payment',
'account_id' => '{{account-code}}',
'merchant_order_id' => 'AA01',
'merchant_reference' => 'Test_AAB',
'country' => 'US',
'additional_data' => [
'airline' => [
'legs' => [
[
'arrival_airport' => 'AMS',
'base_fare' => 200,
'base_fare_currency' => 'USD',
'carrier_code' => 'KL',
'departure_airport' => 'EZE',
'departure_airport_timezone' => '-03:00',
'departure_datetime' => '2024-07-03T05:00:00',
'arrival_datetime' => '2024-08-03T05:00:00',
'fare_basis_code' => 'HL7LNR',
'fare_class_code' => 'FR',
'flight_number' => '842',
'stopover_code' => 's'
]
],
'passengers' => [
[
'country' => 'US',
'date_of_birth' => '1984-05-01',
'document' => [
'document_number' => '123456789',
'document_type' => 'SSN',
'country' => 'US'
],
'phone' => [
'country_code' => '1',
'number' => '5551234567'
],
'first_name' => 'John',
'last_name' => 'Doe',
'loyalty_number' => '123456',
'loyalty_tier' => 'GOLD',
'middle_name' => 'Theodore',
'nationality' => 'US',
'type' => 's'
]
],
'pnr' => '1P-2UUGJW',
'tickets' => [
[
'ticket_number' => '123456',
'restricted' => false,
'total_fare_amount' => 80,
'total_tax_amount' => 22,
'total_fee_amount' => 14,
'issue' => null,
'e_ticket' => false
]
]
],
'order' => [
'fee_amount' => 100,
'tip_amount' => 50,
'items' => [
[
'brand' => 'XYZ',
'category' => 'Clothes',
'id' => '123AD',
'manufacture_part_number' => 'XYZ123456',
'name' => 'Skirt',
'quantity' => 1,
'sku_code' => '8765432109',
'unit_amount' => 4800
]
],
'shipping_amount' => 50
],
'seller_details' => [
'name' => 'Test_company',
'email' => 'testcompany@example.com',
'reference' => 'AAOO',
'website' => 'www.testcompany.com',
'industry' => 'ELECTRONICS',
'merchant_category_code' => 'TTRR',
'country' => 'US',
'document' => [
'document_number' => '123456789',
'document_type' => 'EIN'
],
'phone' => [
'country_code' => '1',
'number' => '5551234567'
]
]
],
'amount' => [
'currency' => 'USD',
'value' => 5000
],
'checkout' => [
'session' => '{{checkout_session}}'
],
'customer_payer' => [
'id' => '{{customer_id}}',
'billing_address' => [
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 502',
'city' => 'New York',
'country' => 'US',
'state' => 'NY',
'zip_code' => '10001',
'neighborhood' => 'Midtown'
],
'browser_info' => [
'accept_header' => 'true',
'color_depth' => '24',
'javascript_enabled' => true,
'language' => 'en-US',
'screen_height' => '2048',
'screen_width' => '1152',
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
],
'date_of_birth' => '1990-02-28',
'device_fingerprints' => [
[
'provider_id' => 'CLEARSALE',
'id' => 'hi88287gbd8d7d782ge287gbd8d7d78'
]
],
'document' => [
'document_type' => 'SSN',
'document_number' => '123456789'
],
'email' => 'johndoe@example.com',
'first_name' => 'John',
'gender' => 'M',
'ip_address' => '192.168.123.167',
'last_name' => 'Doe',
'merchant_customer_id' => 'example00234',
'merchant_customer_created_at' => '2014-05-12 13:05:00',
'nationality' => 'US',
'phone' => [
'country_code' => '1',
'number' => '5551234567'
],
'shipping_address' => [
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 502',
'city' => 'New York',
'country' => 'US',
'state' => 'NY',
'zip_code' => '10001',
'neighborhood' => 'Midtown'
]
],
'payment_method' => [
'token' => '{{onetime_token}}'
],
'metadata' => [
[
'key' => 'ID',
'value' => 'SD00'
]
],
'callback_url' => 'www.example.com'
]),
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/payments"
payload := strings.NewReader("{\n \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\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/payments")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/payments")
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 \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\n}"
response = http.request(request)
puts response.read_bodypayment_method.detail.card.capture to true to authorize and capture in one call, or false to authorize only and capture or cancel later. For direct 3DS integrations, populate payment_method.detail.card.three_d_secure with your authentication result. The Yuno SDK and hosted checkout handle 3DS automatically. Test in sandbox with the Yuno Testing Gateway.
merchant_order_id on the upstream checkout session to make retries safe. This endpoint does not honor X-Idempotency-Key. The dedupe pattern is to look up an existing payment with Get Payment by Merchant Order before retrying. See Avoiding duplicates.metadata to drive routing rules, it must also be set on the Checkout Session. Setting it only here will not trigger route logic.Authorizations
Your public API key from the Yuno Dashboard
Your private secret key (server-side only)
Body
The unique identifier of the account. You find this information on the Yuno dashboard (UUID, 36 chars).
The unique identifier of the customer's order (MAX 255; MIN 3).
The description of the payment (MAX 255; MIN 3).
Specifies the payment amount object, with the value and currency.
Show child attributes
Show child attributes
Country where the transaction must be processed (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 payment method object.
Show child attributes
Show child attributes
Links this payment to a previously-created Checkout Session. Required when workflow is SDK_CHECKOUT (or when workflow is omitted, since SDK_CHECKOUT is the default). Not required for DIRECT or REDIRECT back-to-back payments.
Show child attributes
Show child attributes
Specifies the additional_data object. This object is not mandatory. However, if you send this information, the payment experience will be enhanced for your user.
Show child attributes
Show child attributes
Identification of the payment transaction defined by the merchant (MAX 255; MIN 3). Optional to complement the merchant_order_id.
Specifies customer object for payments.
Show child attributes
Show child attributes
The payment workflow. Indicates whether the integration will use Yuno´s SDK or will be a back to back connection. Guides
SDK_CHECKOUT: [Recommended] - Use Yuno's SDK.DIRECT: Back to back integration with provider info for custom payment experience.REDIRECT: Back to back integration with provider redirection.
SDK_CHECKOUT, CHECKOUT, REDIRECT, DIRECT, SDK_SEAMLESS Specifies the subscription object.
Show child attributes
Show child attributes
The URL where to redirect the customer after the payment. Only required for DIRECT integrations that have a redirection (MAX 526; MIN 3).
Fraud screening object.
Show child attributes
Show child attributes
Split marketplace array of objects
Show child attributes
Show child attributes
Custom key–value tags to track this payment or add context (e.g., order_id, invoice, campaign). Up to 120 items.
Show child attributes
Show child attributes
Response
201
- Payment
- Card - With card details
- Card - With airline data
- Card - With customer, billing, and shipping details
- Card - With customer, billing, shipping and order items
- Card - With installments
- Card - With authorization
- Card - With merchant advice code (MAC)
- Card - With device fingerprint
- Card - With vault on success
- Card - With vaulted token
- Alternative payment method
- Card - With shipping, fee and tip amount
- Card - With NT
- Wallet - Direct
- Split Marketplace
"6c44ed29-cc51-4479-a5eb-108afdaadd50"
"493e9374-510a-4201-9e09-de669d75f256"
"Test Payment"
"US"
"SUCCEEDED"
"APPROVED"
"1744403449"
"2025-04-11T20:30:49.825637Z"
"2025-04-11T20:30:51.953868Z"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
"http://www.google.com/?checkoutSession=7fb7093e-dc67-4c7a-80c5-d25cf5e6ff27"
"SDK_CHECKOUT"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
false
curl --request POST \
--url https://api-sandbox.y.uno/v1/payments \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'public-api-key: YOUR_PUBLIC_API_KEY' \
--header 'private-secret-key: YOUR_PRIVATE_SECRET_KEY' \
--data '{
"account_id": "YOUR_ACCOUNT_CODE",
"merchant_order_id": "order-20260301-001",
"description": "Premium subscription - March 2026",
"country": "BR",
"amount": { "currency": "BRL", "value": 150.00 },
"workflow": "DIRECT",
"payment_method": {
"type": "CARD",
"vaulted_token": "4a8b9c2d-1e3f-5678-90ab-cdef12345678",
"detail": { "card": { "capture": true, "installments": 1 } }
}
}'import requests
url = "https://api-sandbox.y.uno/v1/payments"
payload = {
"description": "Test Payment",
"account_id": "{{account-code}}",
"merchant_order_id": "AA01",
"merchant_reference": "Test_AAB",
"country": "US",
"additional_data": {
"airline": {
"legs": [
{
"arrival_airport": "AMS",
"base_fare": 200,
"base_fare_currency": "USD",
"carrier_code": "KL",
"departure_airport": "EZE",
"departure_airport_timezone": "-03:00",
"departure_datetime": "2024-07-03T05:00:00",
"arrival_datetime": "2024-08-03T05:00:00",
"fare_basis_code": "HL7LNR",
"fare_class_code": "FR",
"flight_number": "842",
"stopover_code": "s"
}
],
"passengers": [
{
"country": "US",
"date_of_birth": "1984-05-01",
"document": {
"document_number": "123456789",
"document_type": "SSN",
"country": "US"
},
"phone": {
"country_code": "1",
"number": "5551234567"
},
"first_name": "John",
"last_name": "Doe",
"loyalty_number": "123456",
"loyalty_tier": "GOLD",
"middle_name": "Theodore",
"nationality": "US",
"type": "s"
}
],
"pnr": "1P-2UUGJW",
"tickets": [
{
"ticket_number": "123456",
"restricted": False,
"total_fare_amount": 80,
"total_tax_amount": 22,
"total_fee_amount": 14,
"issue": None,
"e_ticket": False
}
]
},
"order": {
"fee_amount": 100,
"tip_amount": 50,
"items": [
{
"brand": "XYZ",
"category": "Clothes",
"id": "123AD",
"manufacture_part_number": "XYZ123456",
"name": "Skirt",
"quantity": 1,
"sku_code": "8765432109",
"unit_amount": 4800
}
],
"shipping_amount": 50
},
"seller_details": {
"name": "Test_company",
"email": "testcompany@example.com",
"reference": "AAOO",
"website": "www.testcompany.com",
"industry": "ELECTRONICS",
"merchant_category_code": "TTRR",
"country": "US",
"document": {
"document_number": "123456789",
"document_type": "EIN"
},
"phone": {
"country_code": "1",
"number": "5551234567"
}
}
},
"amount": {
"currency": "USD",
"value": 5000
},
"checkout": { "session": "{{checkout_session}}" },
"customer_payer": {
"id": "{{customer_id}}",
"billing_address": {
"address_line_1": "123 Main St",
"address_line_2": "Apt 502",
"city": "New York",
"country": "US",
"state": "NY",
"zip_code": "10001",
"neighborhood": "Midtown"
},
"browser_info": {
"accept_header": "true",
"color_depth": "24",
"javascript_enabled": True,
"language": "en-US",
"screen_height": "2048",
"screen_width": "1152",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"
},
"date_of_birth": "1990-02-28",
"device_fingerprints": [
{
"provider_id": "CLEARSALE",
"id": "hi88287gbd8d7d782ge287gbd8d7d78"
}
],
"document": {
"document_type": "SSN",
"document_number": "123456789"
},
"email": "johndoe@example.com",
"first_name": "John",
"gender": "M",
"ip_address": "192.168.123.167",
"last_name": "Doe",
"merchant_customer_id": "example00234",
"merchant_customer_created_at": "2014-05-12 13:05:00",
"nationality": "US",
"phone": {
"country_code": "1",
"number": "5551234567"
},
"shipping_address": {
"address_line_1": "123 Main St",
"address_line_2": "Apt 502",
"city": "New York",
"country": "US",
"state": "NY",
"zip_code": "10001",
"neighborhood": "Midtown"
}
},
"payment_method": { "token": "{{onetime_token}}" },
"metadata": [
{
"key": "ID",
"value": "SD00"
}
],
"callback_url": "www.example.com"
}
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({
description: 'Test Payment',
account_id: '{{account-code}}',
merchant_order_id: 'AA01',
merchant_reference: 'Test_AAB',
country: 'US',
additional_data: {
airline: {
legs: [
{
arrival_airport: 'AMS',
base_fare: 200,
base_fare_currency: 'USD',
carrier_code: 'KL',
departure_airport: 'EZE',
departure_airport_timezone: '-03:00',
departure_datetime: '2024-07-03T05:00:00',
arrival_datetime: '2024-08-03T05:00:00',
fare_basis_code: 'HL7LNR',
fare_class_code: 'FR',
flight_number: '842',
stopover_code: 's'
}
],
passengers: [
{
country: 'US',
date_of_birth: '1984-05-01',
document: {document_number: '123456789', document_type: 'SSN', country: 'US'},
phone: {country_code: '1', number: '5551234567'},
first_name: 'John',
last_name: 'Doe',
loyalty_number: '123456',
loyalty_tier: 'GOLD',
middle_name: 'Theodore',
nationality: 'US',
type: 's'
}
],
pnr: '1P-2UUGJW',
tickets: [
{
ticket_number: '123456',
restricted: false,
total_fare_amount: 80,
total_tax_amount: 22,
total_fee_amount: 14,
issue: null,
e_ticket: false
}
]
},
order: {
fee_amount: 100,
tip_amount: 50,
items: [
{
brand: 'XYZ',
category: 'Clothes',
id: '123AD',
manufacture_part_number: 'XYZ123456',
name: 'Skirt',
quantity: 1,
sku_code: '8765432109',
unit_amount: 4800
}
],
shipping_amount: 50
},
seller_details: {
name: 'Test_company',
email: 'testcompany@example.com',
reference: 'AAOO',
website: 'www.testcompany.com',
industry: 'ELECTRONICS',
merchant_category_code: 'TTRR',
country: 'US',
document: {document_number: '123456789', document_type: 'EIN'},
phone: {country_code: '1', number: '5551234567'}
}
},
amount: {currency: 'USD', value: 5000},
checkout: {session: '{{checkout_session}}'},
customer_payer: {
id: '{{customer_id}}',
billing_address: {
address_line_1: '123 Main St',
address_line_2: 'Apt 502',
city: 'New York',
country: 'US',
state: 'NY',
zip_code: '10001',
neighborhood: 'Midtown'
},
browser_info: {
accept_header: 'true',
color_depth: '24',
javascript_enabled: true,
language: 'en-US',
screen_height: '2048',
screen_width: '1152',
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
},
date_of_birth: '1990-02-28',
device_fingerprints: [{provider_id: 'CLEARSALE', id: 'hi88287gbd8d7d782ge287gbd8d7d78'}],
document: {document_type: 'SSN', document_number: '123456789'},
email: 'johndoe@example.com',
first_name: 'John',
gender: 'M',
ip_address: '192.168.123.167',
last_name: 'Doe',
merchant_customer_id: 'example00234',
merchant_customer_created_at: '2014-05-12 13:05:00',
nationality: 'US',
phone: {country_code: '1', number: '5551234567'},
shipping_address: {
address_line_1: '123 Main St',
address_line_2: 'Apt 502',
city: 'New York',
country: 'US',
state: 'NY',
zip_code: '10001',
neighborhood: 'Midtown'
}
},
payment_method: {token: '{{onetime_token}}'},
metadata: [{key: 'ID', value: 'SD00'}],
callback_url: 'www.example.com'
})
};
fetch('https://api-sandbox.y.uno/v1/payments', 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/payments",
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([
'description' => 'Test Payment',
'account_id' => '{{account-code}}',
'merchant_order_id' => 'AA01',
'merchant_reference' => 'Test_AAB',
'country' => 'US',
'additional_data' => [
'airline' => [
'legs' => [
[
'arrival_airport' => 'AMS',
'base_fare' => 200,
'base_fare_currency' => 'USD',
'carrier_code' => 'KL',
'departure_airport' => 'EZE',
'departure_airport_timezone' => '-03:00',
'departure_datetime' => '2024-07-03T05:00:00',
'arrival_datetime' => '2024-08-03T05:00:00',
'fare_basis_code' => 'HL7LNR',
'fare_class_code' => 'FR',
'flight_number' => '842',
'stopover_code' => 's'
]
],
'passengers' => [
[
'country' => 'US',
'date_of_birth' => '1984-05-01',
'document' => [
'document_number' => '123456789',
'document_type' => 'SSN',
'country' => 'US'
],
'phone' => [
'country_code' => '1',
'number' => '5551234567'
],
'first_name' => 'John',
'last_name' => 'Doe',
'loyalty_number' => '123456',
'loyalty_tier' => 'GOLD',
'middle_name' => 'Theodore',
'nationality' => 'US',
'type' => 's'
]
],
'pnr' => '1P-2UUGJW',
'tickets' => [
[
'ticket_number' => '123456',
'restricted' => false,
'total_fare_amount' => 80,
'total_tax_amount' => 22,
'total_fee_amount' => 14,
'issue' => null,
'e_ticket' => false
]
]
],
'order' => [
'fee_amount' => 100,
'tip_amount' => 50,
'items' => [
[
'brand' => 'XYZ',
'category' => 'Clothes',
'id' => '123AD',
'manufacture_part_number' => 'XYZ123456',
'name' => 'Skirt',
'quantity' => 1,
'sku_code' => '8765432109',
'unit_amount' => 4800
]
],
'shipping_amount' => 50
],
'seller_details' => [
'name' => 'Test_company',
'email' => 'testcompany@example.com',
'reference' => 'AAOO',
'website' => 'www.testcompany.com',
'industry' => 'ELECTRONICS',
'merchant_category_code' => 'TTRR',
'country' => 'US',
'document' => [
'document_number' => '123456789',
'document_type' => 'EIN'
],
'phone' => [
'country_code' => '1',
'number' => '5551234567'
]
]
],
'amount' => [
'currency' => 'USD',
'value' => 5000
],
'checkout' => [
'session' => '{{checkout_session}}'
],
'customer_payer' => [
'id' => '{{customer_id}}',
'billing_address' => [
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 502',
'city' => 'New York',
'country' => 'US',
'state' => 'NY',
'zip_code' => '10001',
'neighborhood' => 'Midtown'
],
'browser_info' => [
'accept_header' => 'true',
'color_depth' => '24',
'javascript_enabled' => true,
'language' => 'en-US',
'screen_height' => '2048',
'screen_width' => '1152',
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
],
'date_of_birth' => '1990-02-28',
'device_fingerprints' => [
[
'provider_id' => 'CLEARSALE',
'id' => 'hi88287gbd8d7d782ge287gbd8d7d78'
]
],
'document' => [
'document_type' => 'SSN',
'document_number' => '123456789'
],
'email' => 'johndoe@example.com',
'first_name' => 'John',
'gender' => 'M',
'ip_address' => '192.168.123.167',
'last_name' => 'Doe',
'merchant_customer_id' => 'example00234',
'merchant_customer_created_at' => '2014-05-12 13:05:00',
'nationality' => 'US',
'phone' => [
'country_code' => '1',
'number' => '5551234567'
],
'shipping_address' => [
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 502',
'city' => 'New York',
'country' => 'US',
'state' => 'NY',
'zip_code' => '10001',
'neighborhood' => 'Midtown'
]
],
'payment_method' => [
'token' => '{{onetime_token}}'
],
'metadata' => [
[
'key' => 'ID',
'value' => 'SD00'
]
],
'callback_url' => 'www.example.com'
]),
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/payments"
payload := strings.NewReader("{\n \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\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/payments")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/payments")
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 \"description\": \"Test Payment\",\n \"account_id\": \"{{account-code}}\",\n \"merchant_order_id\": \"AA01\",\n \"merchant_reference\": \"Test_AAB\",\n \"country\": \"US\",\n \"additional_data\": {\n \"airline\": {\n \"legs\": [\n {\n \"arrival_airport\": \"AMS\",\n \"base_fare\": 200,\n \"base_fare_currency\": \"USD\",\n \"carrier_code\": \"KL\",\n \"departure_airport\": \"EZE\",\n \"departure_airport_timezone\": \"-03:00\",\n \"departure_datetime\": \"2024-07-03T05:00:00\",\n \"arrival_datetime\": \"2024-08-03T05:00:00\",\n \"fare_basis_code\": \"HL7LNR\",\n \"fare_class_code\": \"FR\",\n \"flight_number\": \"842\",\n \"stopover_code\": \"s\"\n }\n ],\n \"passengers\": [\n {\n \"country\": \"US\",\n \"date_of_birth\": \"1984-05-01\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"SSN\",\n \"country\": \"US\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"loyalty_number\": \"123456\",\n \"loyalty_tier\": \"GOLD\",\n \"middle_name\": \"Theodore\",\n \"nationality\": \"US\",\n \"type\": \"s\"\n }\n ],\n \"pnr\": \"1P-2UUGJW\",\n \"tickets\": [\n {\n \"ticket_number\": \"123456\",\n \"restricted\": false,\n \"total_fare_amount\": 80,\n \"total_tax_amount\": 22,\n \"total_fee_amount\": 14,\n \"issue\": null,\n \"e_ticket\": false\n }\n ]\n },\n \"order\": {\n \"fee_amount\": 100,\n \"tip_amount\": 50,\n \"items\": [\n {\n \"brand\": \"XYZ\",\n \"category\": \"Clothes\",\n \"id\": \"123AD\",\n \"manufacture_part_number\": \"XYZ123456\",\n \"name\": \"Skirt\",\n \"quantity\": 1,\n \"sku_code\": \"8765432109\",\n \"unit_amount\": 4800\n }\n ],\n \"shipping_amount\": 50\n },\n \"seller_details\": {\n \"name\": \"Test_company\",\n \"email\": \"testcompany@example.com\",\n \"reference\": \"AAOO\",\n \"website\": \"www.testcompany.com\",\n \"industry\": \"ELECTRONICS\",\n \"merchant_category_code\": \"TTRR\",\n \"country\": \"US\",\n \"document\": {\n \"document_number\": \"123456789\",\n \"document_type\": \"EIN\"\n },\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n }\n }\n },\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 5000\n },\n \"checkout\": {\n \"session\": \"{{checkout_session}}\"\n },\n \"customer_payer\": {\n \"id\": \"{{customer_id}}\",\n \"billing_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n },\n \"browser_info\": {\n \"accept_header\": \"true\",\n \"color_depth\": \"24\",\n \"javascript_enabled\": true,\n \"language\": \"en-US\",\n \"screen_height\": \"2048\",\n \"screen_width\": \"1152\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\n },\n \"date_of_birth\": \"1990-02-28\",\n \"device_fingerprints\": [\n {\n \"provider_id\": \"CLEARSALE\",\n \"id\": \"hi88287gbd8d7d782ge287gbd8d7d78\"\n }\n ],\n \"document\": {\n \"document_type\": \"SSN\",\n \"document_number\": \"123456789\"\n },\n \"email\": \"johndoe@example.com\",\n \"first_name\": \"John\",\n \"gender\": \"M\",\n \"ip_address\": \"192.168.123.167\",\n \"last_name\": \"Doe\",\n \"merchant_customer_id\": \"example00234\",\n \"merchant_customer_created_at\": \"2014-05-12 13:05:00\",\n \"nationality\": \"US\",\n \"phone\": {\n \"country_code\": \"1\",\n \"number\": \"5551234567\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 502\",\n \"city\": \"New York\",\n \"country\": \"US\",\n \"state\": \"NY\",\n \"zip_code\": \"10001\",\n \"neighborhood\": \"Midtown\"\n }\n },\n \"payment_method\": {\n \"token\": \"{{onetime_token}}\"\n },\n \"metadata\": [\n {\n \"key\": \"ID\",\n \"value\": \"SD00\"\n }\n ],\n \"callback_url\": \"www.example.com\"\n}"
response = http.request(request)
puts response.read_body