Intercode SaaS Kit
  • Welcome to SaaS Starter Kit
  • Getting Started
    • Technology stack
    • Database Setup
    • Local Environment Setup
  • Basics
    • Dependencies
    • App architecture
    • Deployment
    • App roles
    • Endpoints List
      • Auth
      • Two Factor Auth
      • Businesses
      • Demo
      • Email
      • Export Document
      • Email Files
      • Files Demo
      • Leads
      • Orders
      • Payments
      • Subscriptions
      • Teams
      • Team Memberships
      • User Admin
  • Animation and Styles
    • Framer Motion
    • Ant Design and Styles
  • Pages
    • Auth
      • Working with PassportJS
      • Two-Factor Auth
      • OAuth Providers
    • Leads
    • Businesses
    • Team management
      • Ownership
    • Profile
    • User Settings
      • App Tour
    • App Settings
      • Lead Statuses
    • Dashboard
      • Lead volume widget
      • Doughnut chart widget
      • Recent leads table widget
      • Lead count over period widget
    • Demo
  • Features
    • Impersonation
    • Subscriptions (Stripe)
    • Search
    • Sentry
    • Captcha
    • Audit Logs
    • Internationalization
  • External integrations
    • Mailer
    • Google oAuth2
    • Facebook oAuth2
    • S3 compatible storage (AWS, MinIO)
Powered by GitBook
On this page
  1. Basics
  2. Endpoints List

Subscriptions

PreviousPaymentsNextTeams

Last updated 6 months ago

GET

POST

PUT

DELETE

Retrieves all subscription tiers.

get
Responses
200
Subscription tiers retrieved successfully
application/json
500
Internal server error
application/json
get
GET /subscriptions HTTP/1.1
Host: 
Accept: */*
[
  {
    "id": 1,
    "title": "Basic",
    "price": 1000,
    "priority": 1,
    "usersLimit": 10,
    "teamsLimit": 5
  }
]

Retrieves the subscription details for the authenticated user's team.

get
Query parameters
teamIdstringRequired
Responses
200
Subscription details retrieved successfully
application/json
400
Invalid team ID
application/json
403
Access denied
application/json
404
Subscription not found
application/json
get
GET /subscriptions/me?teamId=text HTTP/1.1
Host: 
Accept: */*
{
  "teamId": "team_id",
  "subscriptionId": "sub_1F7X2Y2eZvKYlo2C0q0G5Z2e",
  "endDate": "2023-01-01T00:00:00Z",
  "price": 1000,
  "status": "active",
  "tier": "Basic",
  "priority": 1,
  "usersLimit": 10,
  "teamsLimit": 5
}

Deletes a subscription tier by its ID.

delete
Path parameters
idstringRequired
Responses
200
Subscription tier deleted successfully
application/json
ResponseanyExample: {"message":"Subscription tier deleted successfully","description":"The subscription tier has been deleted successfully."}
400
Tier not found
application/json
500
Internal server error
application/json
delete
DELETE /subscriptions/{id} HTTP/1.1
Host: 
Accept: */*
{
  "message": "Subscription tier deleted successfully",
  "description": "The subscription tier has been deleted successfully."
}
  • GET
  • GETRetrieves all subscription tiers.
  • GETRetrieves the subscription details for the authenticated user's team.
  • POST
  • POSTCreates a new subscription tier.
  • POSTRegisters a new subscription for the team.
  • POSTCancels the subscription period for the team.
  • POSTCancels the subscription immediately for the team.
  • POSTRenews the subscription period for the team.
  • PUT
  • PUTUpdates a subscription tier.
  • DELETE
  • DELETEDeletes a subscription tier by its ID.

Creates a new subscription tier.

post
Body
namestring | nullableRequiredExample: Basic
descriptionstring | nullableRequiredExample: Basic subscription tier
pricenumber | nullableRequiredExample: 1000
prioritynumber | nullableRequiredExample: 1
usersLimitnumber | nullableRequiredExample: 10
teamsLimitnumber | nullableRequiredExample: 5
isPopularboolean | nullableRequiredExample: true
Responses
201
Subscription tier created successfully
application/json
400
Tier already exists
application/json
500
Internal server error
application/json
post
POST /subscriptions HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 164

{
  "name": "Basic",
  "description": "Basic subscription tier",
  "features": [
    {
      "name": "Feature 1"
    }
  ],
  "price": 1000,
  "priority": 1,
  "usersLimit": 10,
  "teamsLimit": 5,
  "isPopular": true
}
{
  "id": 1,
  "title": "Basic",
  "price": 1000,
  "priority": 1,
  "usersLimit": 10,
  "teamsLimit": 5
}

Registers a new subscription for the team.

post
Body
priceIdstringRequiredExample: price_1F7X2Y2eZvKYlo2C0q0G5Z2e
quantitynumberRequiredExample: 1
teamIdstring | nullableRequiredExample: team_id
isTeamCreationbooleanRequiredExample: true
Responses
200
Subscription registered successfully
application/json
400
Invalid subscription parameters
application/json
403
Access denied
application/json
500
Internal server error
application/json
post
POST /subscriptions/register HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 98

{
  "priceId": "price_1F7X2Y2eZvKYlo2C0q0G5Z2e",
  "quantity": 1,
  "teamId": "team_id",
  "isTeamCreation": true
}
{
  "redirect": true,
  "url": "https://checkout.stripe.com/pay/cs_test_a1b2c3d4e5f6g7h8i9j0"
}

Cancels the subscription period for the team.

post
Body
subscriptionstringOptionalExample: sub_1F7X2Y2eZvKYlo2C0q0G5Z2e
Responses
200
Subscription period cancelled successfully
application/json
ResponseanyExample: {"message":"Subscription period cancelled successfully","description":"The subscription period has been cancelled successfully."}
400
Invalid subscription ID
application/json
403
Access denied
application/json
500
Internal server error
application/json
post
POST /subscriptions/cancel HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 47

{
  "subscription": "sub_1F7X2Y2eZvKYlo2C0q0G5Z2e"
}
{
  "message": "Subscription period cancelled successfully",
  "description": "The subscription period has been cancelled successfully."
}

Cancels the subscription immediately for the team.

post
Body
subscriptionstringOptionalExample: sub_1F7X2Y2eZvKYlo2C0q0G5Z2e
Responses
200
Subscription cancelled successfully
application/json
ResponseanyExample: {"message":"Subscription cancelled successfully","description":"The subscription has been cancelled successfully."}
400
Invalid subscription ID
application/json
403
Access denied
application/json
500
Internal server error
application/json
post
POST /subscriptions/cancel-immediately HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 47

{
  "subscription": "sub_1F7X2Y2eZvKYlo2C0q0G5Z2e"
}
{
  "message": "Subscription cancelled successfully",
  "description": "The subscription has been cancelled successfully."
}

Renews the subscription period for the team.

post
Body
subscriptionstringOptionalExample: sub_1F7X2Y2eZvKYlo2C0q0G5Z2e
Responses
200
Subscription period renewed successfully
application/json
ResponseanyExample: {"message":"Subscription period renewed successfully","description":"The subscription period has been renewed successfully."}
400
Invalid subscription ID
application/json
403
Access denied
application/json
500
Internal server error
application/json
post
POST /subscriptions/renew HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 47

{
  "subscription": "sub_1F7X2Y2eZvKYlo2C0q0G5Z2e"
}
{
  "message": "Subscription period renewed successfully",
  "description": "The subscription period has been renewed successfully."
}

Updates a subscription tier.

put
Body
namestring | nullableRequiredExample: Basic
descriptionstring | nullableRequiredExample: Basic subscription tier
pricenumber | nullableRequiredExample: 1000
prioritynumber | nullableRequiredExample: 1
usersLimitnumber | nullableRequiredExample: 10
teamsLimitnumber | nullableRequiredExample: 5
isPopularboolean | nullableRequiredExample: true
Responses
200
Subscription tier updated successfully
application/json
400
Tier not found
application/json
500
Internal server error
application/json
put
PUT /subscriptions HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 164

{
  "name": "Basic",
  "description": "Basic subscription tier",
  "features": [
    {
      "name": "Feature 1"
    }
  ],
  "price": 1000,
  "priority": 1,
  "usersLimit": 10,
  "teamsLimit": 5,
  "isPopular": true
}
{
  "id": 1,
  "title": "Basic",
  "price": 1000,
  "priority": 1,
  "usersLimit": 10,
  "teamsLimit": 5
}