Create Subscription
Creates a recurring billing subscription.
Prerequisite: Enroll a card first to obtain vaulted_token.
frequency.type: DAY | WEEK | MONTH
curl --request POST \
--url https://api-sandbox.y.uno/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"account_id": "YOUR_ACCOUNT_ID",
"name": "Monthly Subscription Plan",
"description": "Billed monthly",
"merchant_reference": "sub-001",
"country": "US",
"amount": {
"currency": "USD",
"value": 9900
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": {
"total": 12
},
"customer_payer": {
"id": "CUSTOMER_UUID"
},
"payment_method": {
"type": "CARD",
"vaulted_token": "VAULTED_TOKEN_UUID"
},
"availability": {
"start_at": "2026-04-01T00:00:00Z",
"finish_at": "2027-03-31T23:59:59Z"
},
"subscription_agreement_id": "sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa"
}
'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions"
payload = {
"account_id": "YOUR_ACCOUNT_ID",
"name": "Monthly Subscription Plan",
"description": "Billed monthly",
"merchant_reference": "sub-001",
"country": "US",
"amount": {
"currency": "USD",
"value": 9900
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": { "total": 12 },
"customer_payer": { "id": "CUSTOMER_UUID" },
"payment_method": {
"type": "CARD",
"vaulted_token": "VAULTED_TOKEN_UUID"
},
"availability": {
"start_at": "2026-04-01T00:00:00Z",
"finish_at": "2027-03-31T23:59:59Z"
},
"subscription_agreement_id": "sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Idempotency-Key': '<x-idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'YOUR_ACCOUNT_ID',
name: 'Monthly Subscription Plan',
description: 'Billed monthly',
merchant_reference: 'sub-001',
country: 'US',
amount: {currency: 'USD', value: 9900},
frequency: {type: 'MONTH', value: 1},
billing_cycles: {total: 12},
customer_payer: {id: 'CUSTOMER_UUID'},
payment_method: {type: 'CARD', vaulted_token: 'VAULTED_TOKEN_UUID'},
availability: {start_at: '2026-04-01T00:00:00Z', finish_at: '2027-03-31T23:59:59Z'},
subscription_agreement_id: 'sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa'
})
};
fetch('https://api-sandbox.y.uno/v1/subscriptions', 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/subscriptions",
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' => 'YOUR_ACCOUNT_ID',
'name' => 'Monthly Subscription Plan',
'description' => 'Billed monthly',
'merchant_reference' => 'sub-001',
'country' => 'US',
'amount' => [
'currency' => 'USD',
'value' => 9900
],
'frequency' => [
'type' => 'MONTH',
'value' => 1
],
'billing_cycles' => [
'total' => 12
],
'customer_payer' => [
'id' => 'CUSTOMER_UUID'
],
'payment_method' => [
'type' => 'CARD',
'vaulted_token' => 'VAULTED_TOKEN_UUID'
],
'availability' => [
'start_at' => '2026-04-01T00:00:00Z',
'finish_at' => '2027-03-31T23:59:59Z'
],
'subscription_agreement_id' => 'sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-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/subscriptions"
payload := strings.NewReader("{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-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/subscriptions")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"amount": {
"currency": "<string>",
"value": 123
},
"frequency": {
"type": "<string>",
"value": 123
},
"subscription_agreement_id": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}Headers
Unique UUID per request. Prevents duplicate processing on retries.
Body
3 - 255ISO 3166-1 alpha-2 country code
AR, BO, BR, CL, CO, CR, EC, SV, GT, HN, MX, NI, PA, PY, PE, US, UY 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
Links this subscription to the initial payment created with the same agreement ID. Used for tracking, reconciliation, and chargeback handling. Must exactly match the subscription_agreement_id sent in payment_method.detail.card.stored_credentials.subscription_agreement_id on the originating payment.
255Response
Subscription created
ACTIVE, PAUSED, CANCELLED, EXPIRED Show child attributes
Show child attributes
Show child attributes
Show child attributes
Links this subscription to the initial payment created with the same agreement ID. Used for tracking, reconciliation, and chargeback handling.
Was this page helpful?
curl --request POST \
--url https://api-sandbox.y.uno/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"account_id": "YOUR_ACCOUNT_ID",
"name": "Monthly Subscription Plan",
"description": "Billed monthly",
"merchant_reference": "sub-001",
"country": "US",
"amount": {
"currency": "USD",
"value": 9900
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": {
"total": 12
},
"customer_payer": {
"id": "CUSTOMER_UUID"
},
"payment_method": {
"type": "CARD",
"vaulted_token": "VAULTED_TOKEN_UUID"
},
"availability": {
"start_at": "2026-04-01T00:00:00Z",
"finish_at": "2027-03-31T23:59:59Z"
},
"subscription_agreement_id": "sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa"
}
'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions"
payload = {
"account_id": "YOUR_ACCOUNT_ID",
"name": "Monthly Subscription Plan",
"description": "Billed monthly",
"merchant_reference": "sub-001",
"country": "US",
"amount": {
"currency": "USD",
"value": 9900
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": { "total": 12 },
"customer_payer": { "id": "CUSTOMER_UUID" },
"payment_method": {
"type": "CARD",
"vaulted_token": "VAULTED_TOKEN_UUID"
},
"availability": {
"start_at": "2026-04-01T00:00:00Z",
"finish_at": "2027-03-31T23:59:59Z"
},
"subscription_agreement_id": "sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Idempotency-Key': '<x-idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'YOUR_ACCOUNT_ID',
name: 'Monthly Subscription Plan',
description: 'Billed monthly',
merchant_reference: 'sub-001',
country: 'US',
amount: {currency: 'USD', value: 9900},
frequency: {type: 'MONTH', value: 1},
billing_cycles: {total: 12},
customer_payer: {id: 'CUSTOMER_UUID'},
payment_method: {type: 'CARD', vaulted_token: 'VAULTED_TOKEN_UUID'},
availability: {start_at: '2026-04-01T00:00:00Z', finish_at: '2027-03-31T23:59:59Z'},
subscription_agreement_id: 'sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa'
})
};
fetch('https://api-sandbox.y.uno/v1/subscriptions', 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/subscriptions",
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' => 'YOUR_ACCOUNT_ID',
'name' => 'Monthly Subscription Plan',
'description' => 'Billed monthly',
'merchant_reference' => 'sub-001',
'country' => 'US',
'amount' => [
'currency' => 'USD',
'value' => 9900
],
'frequency' => [
'type' => 'MONTH',
'value' => 1
],
'billing_cycles' => [
'total' => 12
],
'customer_payer' => [
'id' => 'CUSTOMER_UUID'
],
'payment_method' => [
'type' => 'CARD',
'vaulted_token' => 'VAULTED_TOKEN_UUID'
],
'availability' => [
'start_at' => '2026-04-01T00:00:00Z',
'finish_at' => '2027-03-31T23:59:59Z'
],
'subscription_agreement_id' => 'sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-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/subscriptions"
payload := strings.NewReader("{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-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/subscriptions")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"YOUR_ACCOUNT_ID\",\n \"name\": \"Monthly Subscription Plan\",\n \"description\": \"Billed monthly\",\n \"merchant_reference\": \"sub-001\",\n \"country\": \"US\",\n \"amount\": {\n \"currency\": \"USD\",\n \"value\": 9900\n },\n \"frequency\": {\n \"type\": \"MONTH\",\n \"value\": 1\n },\n \"billing_cycles\": {\n \"total\": 12\n },\n \"customer_payer\": {\n \"id\": \"CUSTOMER_UUID\"\n },\n \"payment_method\": {\n \"type\": \"CARD\",\n \"vaulted_token\": \"VAULTED_TOKEN_UUID\"\n },\n \"availability\": {\n \"start_at\": \"2026-04-01T00:00:00Z\",\n \"finish_at\": \"2027-03-31T23:59:59Z\"\n },\n \"subscription_agreement_id\": \"sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"amount": {
"currency": "<string>",
"value": 123
},
"frequency": {
"type": "<string>",
"value": 123
},
"subscription_agreement_id": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}