Subscriptions
Cancel Subscription
Permanently cancels a subscription. This action cannot be undone.
POST
/
v1
/
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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": {
"currency": "BRL",
"value": 100
},
"next_payment_date": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "VALIDATION_ERROR",
"messages": [
"amount must be greater than 0",
"country must not be blank"
]
}{
"code": "VALIDATION_ERROR",
"messages": [
"amount must be greater than 0",
"country must not be blank"
]
}Authorizations
Your public API key from the Yuno Dashboard
Your private secret key (server-side only)
Path Parameters
The unique identifier of the subscription
Response
Subscription cancelled successfully
Available options:
ACTIVE, PAUSED, CANCELLED, PAST_DUE, EXPIRED Show child attributes
Show child attributes
Example:
{ "currency": "BRL", "value": 100 }
Available options:
DAILY, WEEKLY, MONTHLY, YEARLY ⌘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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": {
"currency": "BRL",
"value": 100
},
"next_payment_date": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "VALIDATION_ERROR",
"messages": [
"amount must be greater than 0",
"country must not be blank"
]
}{
"code": "VALIDATION_ERROR",
"messages": [
"amount must be greater than 0",
"country must not be blank"
]
}