Request Cancel
Phase 1 of cancellation. Resolves whether the subscription can be canceled, lists eligible cancellation reasons, and may return a retention offer the caller can present to the user.
URL
POST /api/c2a/subscription/cancel/request
Request Parameters
Body: RequestCancelRequest.
| Name | Type | Description |
|---|---|---|
orderIdentifier | string | Required. Target subscription's order id (from List Customer Subscriptions). |
cancelationMethod | string (EnSubscriptionCancelMethod) | Normal (default), Immediate, EndOfPeriod. |
currentStep | integer | Funnel step. Default 0. |
source | string (EnInteractionSource) | Forced to C2A server-side. |
Request Example
{
"orderIdentifier": "or_01J3X...",
"cancelationMethod": "Normal",
"currentStep": 0
}
Response Parameters
RequestCancelResponse.
| Name | Type | Description |
|---|---|---|
responseType | string (EnSubscriptionResponseType) | Processed, Presentation, or Offer. See semantics below. |
offer | object (PurchaseOffer) | Populated when responseType = Offer — a retention offer the user can accept instead of canceling. Pass it back to Checkout to convert. |
cancellationReasons | array (SubscriptionCancelReasonSnapshot[]) | Reason codes + labels to present to the user. |
cancellationReasons[].code | string | Reason code (e.g. PRICE). |
cancellationReasons[].label | string | Display label. |
status | object (AzotteStatus) | Operation status envelope. |
responseType Semantics
| Value | Meaning |
|---|---|
Processed | Subscription is cancelable. Proceed to cancel/confirm. |
Presentation | Show a presentation step (info / confirmation). |
Offer | Retention offer generated. If user accepts, run normal checkout against offer.offerIdentifier. If they reject, call cancel/confirm. |
Sample Response
{
"responseType": "Processed",
"cancellationReasons": [
{ "code": "PRICE", "label": "Too expensive" },
{ "code": "USAGE", "label": "I don't use it enough" }
],
"status": { "messageCode": "SUCCESS" }
}
Sample Codes
- cURL
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
curl --location 'https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request' \
--header 'Content-Type: application/json' \
--header 'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f' \
--header 'x-api-key: sk_dev_acme_sample_123456789' \
--data '{
"orderIdentifier": "or_01J3X...",
"cancelationMethod": "Normal",
"currentStep": 0
}'
const res = await fetch('https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
},
body: JSON.stringify({
orderIdentifier: 'or_01J3X...',
cancelationMethod: 'Normal',
currentStep: 0
})
});
console.log(await res.json());
import { request } from 'undici';
const { body } = await request(
'https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
},
body: JSON.stringify({
orderIdentifier: 'or_01J3X...',
cancelationMethod: 'Normal',
currentStep: 0
})
}
);
console.log(await body.json());
import requests
res = requests.post(
"https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request",
headers={
"Content-Type": "application/json",
"x-tn": "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f",
"x-api-key": "sk_dev_acme_sample_123456789",
},
json={
"orderIdentifier": "or_01J3X...",
"cancelationMethod": "Normal",
"currentStep": 0,
},
)
print(res.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String json = """
{
"orderIdentifier": "or_01J3X...",
"cancelationMethod": "Normal",
"currentStep": 0
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request"))
.header("Content-Type", "application/json")
.header("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
.header("x-api-key", "sk_dev_acme_sample_123456789")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
using System.Net.Http.Json;
var payload = new {
orderIdentifier = "or_01J3X...",
cancelationMethod = "Normal",
currentStep = 0
};
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f");
http.DefaultRequestHeaders.Add("x-api-key", "sk_dev_acme_sample_123456789");
var res = await http.PostAsJsonAsync(
"https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request",
payload);
Console.WriteLine(await res.Content.ReadAsStringAsync());
<?php
$payload = [
'orderIdentifier' => 'or_01J3X...',
'cancelationMethod' => 'Normal',
'currentStep' => 0,
];
$ch = curl_init('https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key: sk_dev_acme_sample_123456789',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]any{
"orderIdentifier": "or_01J3X...",
"cancelationMethod": "Normal",
"currentStep": 0,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST",
"https://acme.sandbox.azotte.com/api/v1/c2a/subscription/cancel/request",
bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
req.Header.Set("x-api-key", "sk_dev_acme_sample_123456789")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}