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

Create Subscription

POST
/v1/company/{companyId}/country/{countryId}/payment

Create Subscription#

Endpoint#

POST /v1/company/:companyId/country/:countryId/payment

Description#

Creates a new payment transaction for a customer against a selected plan.
This endpoint is typically used to initiate a payment when a user subscribes to a plan.

Request#

Headers
KeyValueRequired
AuthorizationBearer <API_KEY>✅
Content-Typeapplication/json✅
Path Parameters
ParameterTypeDescriptionRequired
companyIdstringUnique identifier of the company✅
countryIdstringUnique identifier of the country (pricing region)✅
Body Parameters
FieldTypeDescriptionRequired
customer_identifierstringUnique identifier for the customer (e.g., email, user ID)✅
plan_idstringThe plan identifier you want to subscribe to✅
plan_typestringType of subscription plan (MONTHLY or YEARLY)✅
payment_componentstringDefines what is being charged (e.g., PLAN, ADDON)✅
Sample Request

Response#

Response Fields
FieldTypeDescription
statusbooleanIndicates if the API request was successful
value.transaction_tsidstringUnique transaction identifier for the created payment
Sample Response
{
  "status": true,
  "value": {
    "transaction_tsid": "TRN-0MSC9073DVBTK"
  }
}

Error Codes#

CodeDescription
400Missing or invalid request parameters
401Invalid or missing API key
404Company or country not found
500Internal server error

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
{
    "customer_identifier": "onkar@stykite.com",
    "plan_id": "PLV-0MD508X1S388G",
    "plan_type": "MONTHLY",
    "payment_component": "PLAN"
}

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//payment' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customer_identifier": "onkar@stykite.com",
    "plan_id": "PLV-0MD508X1S388G",
    "plan_type": "MONTHLY",
    "payment_component": "PLAN"
}'

Responses

🟢200Success
application/json
Body

Example
{}
Modified at 2025-08-29 06:45:15
Previous
Update Customer Meter Entitlements
Next
Cancel Subscription
Built with