Subscriptions
Cancel Subscription
Cancels a subscription permanently, changing its status to CANCELED with no reversal.
POST
/
subscriptions
/
{subscription_id}
/
cancel
Cancel Subscription
curl --request POST \
--url https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel"
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'public-api-key': '<api-key>', 'private-secret-key': '<api-key>'}
};
fetch('https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel', 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/{subscription_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
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/{subscription_id}/cancel")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel")
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>'
response = http.request(request)
puts response.read_body{
"id": "7304911d-5df9-429e-8488-ad41abea1a4c",
"name": "sub_001",
"description": "streaming service",
"account_id": "2404911d-5df9-429e-8488-ad41abea1a4b",
"merchant_reference": "001_marzo_23",
"status": "CANCELED",
"subscription_plan_id": "1904911d-5df9-429e-8488-ad41abea1a4d",
"amount": {
"currency": "USD",
"value": 12100
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": {
"total": 10,
"current": 2,
"next_at": "2023-02-16T20:00:00.786342Z"
},
"customer_payer": {
"id": "3t04911d-5df9-429e-8488-ad41abea1a2c"
},
"payment_method": [
{
"type": "CARD",
"token": "9104911d-5df9-429e-8488-ad41abea1a4b",
"vaulted_token": "6104911d-5df9-429e-8488-ad41abea1a4b",
"card": {
"verify": false,
"card_data": {
"number": "4507990000000010",
"expiration_month": 10,
"expiration_year": 2025,
"security_code": 123,
"holder_name": "JOHN DOE"
}
}
}
],
"availability": {
"start_at": "2024-01-16T00:00:00.786342Z",
"finish_at": "2024-05-26T20:00:00.786342Z"
},
"metadata": {
"key": "sub_ext_id",
"value": "AA001"
},
"payments": [
"5104911d-5df9-229e-8468-bd41abea1a4s"
],
"created_at": "2023-12-16T20:46:54.786342Z",
"updated_at": "2023-12-16T21:00:54.786342Z"
}"{\n Refer to the HTTP Response Codes section for more details: 'https://docs.y.uno/reference/response-codes'\n}"Calling this endpoint will cancel a subscription, changing its
status to CANCELED. This change cannot be reverted back, being a final point for the respective subscription.Authorizations
Path Parameters
The unique identifier of a subscription.
Response
200
Example:
"7304911d-5df9-429e-8488-ad41abea1a4c"
Example:
"sub_001"
Example:
"streaming service"
Example:
"2404911d-5df9-429e-8488-ad41abea1a4b"
Example:
"001_marzo_23"
Example:
"CANCELED"
Example:
"1904911d-5df9-429e-8488-ad41abea1a4d"
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
Example:
"2023-12-16T20:46:54.786342Z"
Example:
"2023-12-16T21:00:54.786342Z"
Was this page helpful?
Previous
Payout StatusExplains the payout state machine and the status and response codes it can return
Next
⌘I
Cancel Subscription
curl --request POST \
--url https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel"
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'public-api-key': '<api-key>', 'private-secret-key': '<api-key>'}
};
fetch('https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel', 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/{subscription_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
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/{subscription_id}/cancel")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions/{subscription_id}/cancel")
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>'
response = http.request(request)
puts response.read_body{
"id": "7304911d-5df9-429e-8488-ad41abea1a4c",
"name": "sub_001",
"description": "streaming service",
"account_id": "2404911d-5df9-429e-8488-ad41abea1a4b",
"merchant_reference": "001_marzo_23",
"status": "CANCELED",
"subscription_plan_id": "1904911d-5df9-429e-8488-ad41abea1a4d",
"amount": {
"currency": "USD",
"value": 12100
},
"frequency": {
"type": "MONTH",
"value": 1
},
"billing_cycles": {
"total": 10,
"current": 2,
"next_at": "2023-02-16T20:00:00.786342Z"
},
"customer_payer": {
"id": "3t04911d-5df9-429e-8488-ad41abea1a2c"
},
"payment_method": [
{
"type": "CARD",
"token": "9104911d-5df9-429e-8488-ad41abea1a4b",
"vaulted_token": "6104911d-5df9-429e-8488-ad41abea1a4b",
"card": {
"verify": false,
"card_data": {
"number": "4507990000000010",
"expiration_month": 10,
"expiration_year": 2025,
"security_code": 123,
"holder_name": "JOHN DOE"
}
}
}
],
"availability": {
"start_at": "2024-01-16T00:00:00.786342Z",
"finish_at": "2024-05-26T20:00:00.786342Z"
},
"metadata": {
"key": "sub_ext_id",
"value": "AA001"
},
"payments": [
"5104911d-5df9-229e-8468-bd41abea1a4s"
],
"created_at": "2023-12-16T20:46:54.786342Z",
"updated_at": "2023-12-16T21:00:54.786342Z"
}"{\n Refer to the HTTP Response Codes section for more details: 'https://docs.y.uno/reference/response-codes'\n}"