Subscription - Cancel Subscription
curl --request POST \
--url https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '
{
"cancel_option": "immediately",
"credit_option_for_current_term_charges": "prorate",
"refundable_credits_handling": "schedule_refund",
"unbilled_charges_option": "invoice"
}
'import requests
url = "https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel"
payload = {
"cancel_option": "immediately",
"credit_option_for_current_term_charges": "prorate",
"refundable_credits_handling": "schedule_refund",
"unbilled_charges_option": "invoice"
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Profile-Id': '<x-profile-id>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cancel_option: 'immediately',
credit_option_for_current_term_charges: 'prorate',
refundable_credits_handling: 'schedule_refund',
unbilled_charges_option: 'invoice'
})
};
fetch('https://sandbox.orchestratorx.com/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://sandbox.orchestratorx.com/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_POSTFIELDS => json_encode([
'cancel_option' => 'immediately',
'credit_option_for_current_term_charges' => 'prorate',
'refundable_credits_handling' => 'schedule_refund',
'unbilled_charges_option' => 'invoice'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>",
"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://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel"
payload := strings.NewReader("{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("api-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://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel")
.header("X-Profile-Id", "<x-profile-id>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "active",
"profile_id": "<string>",
"merchant_id": "<string>",
"customer_id": "<string>",
"merchant_reference_id": "<string>",
"cancelled_at": "<string>"
}Subscriptions
Subscription - Cancel Subscription
Cancel the subscription
POST
/
subscriptions
/
{subscription_id}
/
cancel
Subscription - Cancel Subscription
curl --request POST \
--url https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '
{
"cancel_option": "immediately",
"credit_option_for_current_term_charges": "prorate",
"refundable_credits_handling": "schedule_refund",
"unbilled_charges_option": "invoice"
}
'import requests
url = "https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel"
payload = {
"cancel_option": "immediately",
"credit_option_for_current_term_charges": "prorate",
"refundable_credits_handling": "schedule_refund",
"unbilled_charges_option": "invoice"
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Profile-Id': '<x-profile-id>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cancel_option: 'immediately',
credit_option_for_current_term_charges: 'prorate',
refundable_credits_handling: 'schedule_refund',
unbilled_charges_option: 'invoice'
})
};
fetch('https://sandbox.orchestratorx.com/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://sandbox.orchestratorx.com/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_POSTFIELDS => json_encode([
'cancel_option' => 'immediately',
'credit_option_for_current_term_charges' => 'prorate',
'refundable_credits_handling' => 'schedule_refund',
'unbilled_charges_option' => 'invoice'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>",
"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://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel"
payload := strings.NewReader("{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("api-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://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel")
.header("X-Profile-Id", "<x-profile-id>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.orchestratorx.com/subscriptions/{subscription_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cancel_option\": \"immediately\",\n \"credit_option_for_current_term_charges\": \"prorate\",\n \"refundable_credits_handling\": \"schedule_refund\",\n \"unbilled_charges_option\": \"invoice\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "active",
"profile_id": "<string>",
"merchant_id": "<string>",
"customer_id": "<string>",
"merchant_reference_id": "<string>",
"cancelled_at": "<string>"
}Authorizations
Body
application/json
Request payload for cancelling a subscription.
Response
Subscription cancelled successfully
Response payload returned after successfully cancelling a subscription.
Possible states of a subscription lifecycle.
Created: Subscription was created but not yet activated.Active: Subscription is currently active.InActive: Subscription is inactive.Pending: Subscription is pending activation.Trial: Subscription is in a trial period.Paused: Subscription is paused.Unpaid: Subscription is unpaid.Onetime: Subscription is a one-time payment.Cancelled: Subscription has been cancelled.Failed: Subscription has failed.
Available options:
active, created, in_active, pending, trial, paused, unpaid, onetime, cancelled, failed