Stykite
  1. Subscription
Stykite
  • Introduction
    • What is Stykite?
    • Who should use Stykite?
    • When Stykite isn't the right fit?
    • Key Concepts
    • Pre-requisites: Account & API Keys
  • Getting Started
    • Setup your Tracking & Billing
    • Integrate Subscription Plans & Payments
    • Setup Payments
      • Configuring Razorpay Webhooks for Stykite
  • API Reference
    • 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
        • Update Customer Meter Entitlements
      • Subscription
        • Create Subscription
          POST
        • Cancel Subscription
          POST
        • Update Subscription
          PUT
      • Checkpoint
        • Track Checkpoint Usage API
  • 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

Header Params

Body Params application/json

Example
{
    "subscription_tsid": "CSU-0JTAGV2KWBHEW",
    "when": "END_OF_CYCLE"
}

Request Code 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 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "subscription_tsid": "CSU-0JTAGV2KWBHEW",
    "when": "END_OF_CYCLE"
}'

Responses

🟢200Success
application/json
Body

Example
{}
Modified at 2025-02-14 09:09:04
Previous
Create Subscription
Next
Update Subscription
Built with