Stykite
  1. Subscription
Stykite
  • Introduction
  • Pre-requisites: Account & API Keys
  • Integration
    • Self-Serve Integration on your SaaS/AI App
    • Usage-Based Billing
    • Customer Facing Widgets
      • Pricing Widget Integration Guide
      • My Account Widget Integration
      • Subscribe Button
    • API Reference
      • Webhooks
        • Customer Subscription Status Update
        • Add-on Purchase Success
      • Usage
        • Send Usage
      • Customer
        • Create Customer with Auto Subscribe
        • Get Customer and Subscription Details
      • Subscription
        • Cancel Subscription
          POST
        • Update Subscription
          PUT
  • Learning Stykite
    • Subscriptions & Plans
    • Add-ons
    • Pricing Versions
    • Manual Subscriptions & Exclusive Plans
    • Invoices
    • Payments
    • Sales Tax
    • Customers
    • Transactions & Refunds
    • Settings
  1. Subscription

Cancel Subscription

POST
/v1/company/{companyId}/country/{countryId}/customer/{customerIdentifier}/cancel_subscription

Cancel Subscription API#

Description#

This API endpoint allows you to cancel a customer's subscription.

Request Parameters#

Path Parameters:#

companyId (string, required): The unique identifier of the company.
countryId (string, required): The unique identifier of the country.
customerIdentifier (string, required): The unique identifier of the customer.

Headers:#

Authorization (string, required): The authorization token in the format Bearer <your_token>.
Content-Type (string, required): The content type of the request, should be application/json.

Body Parameters:#

subscription_tsid (string, required): The unique identifier of the subscription to be canceled.
when (string, required): Defines when to cancel the subscription (IMMEDIATE, END_OF_CYCLE).

Request Example#

Response#

Error Responses#

Unauthorized (401)#

{
    "success": false,
    "message": "Unauthorized access. Invalid token."
}

Not Found (404)#

{
    "success": false,
    "message": "Subscription not found."
}

Bad Request (400)#

{
    "success": false,
    "message": "Invalid request parameters."
}

Notes#

The when parameter determines whether the cancellation is immediate or deferred.
Ensure that the correct subscription_tsid is provided to avoid errors.
Authentication is required using a valid Bearer token.

Contact#

For any issues, contact support at support@stykite.com.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params
companyId
string 
required
countryId
string 
required
customerIdentifier
string 
required
Header Params
authorization
string 
required
Example:
Bearer
Content-Type
string 
required
Example:
application/json
Body Params application/json
subscription_tsid
string 
required
when
string 
required
Example
{
    "subscription_tsid": "CSU-0JTAGV2KWBHEW",
    "when": "END_OF_CYCLE"
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://sandbox.api.stykite.com/v1/company//country//customer//cancel_subscription' \
--header 'authorization: Bearer' \
--header 'Content-Type: application/json' \
--data-raw '{
    "subscription_tsid": "CSU-0JTAGV2KWBHEW",
    "when": "END_OF_CYCLE"
}'

Responses

🟢200Success
application/json
Body
object {0}
Example
{}
Modified at 2025-02-14 09:09:04
Previous
Get Customer and Subscription Details
Next
Update Subscription
Built with