Documentation Index Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
Use this file to discover all available pages before exploring further.
Subscription management
Provisioning subscriptions
When a customer subscribes to a new plan (upgrade, downgrade, or initial subscription), a subscription needs to be provisioned in Stigg.
You provide the customer ID and target plan ID. For paid subscriptions, the billing period (monthly or annually) is required. Additional optional parameters include:
Resource ID - required when a product supports multiple active subscriptions
Billable feature quantities - required for per-unit pricing
Add-ons - list of add-ons and their quantities
Promotion code - a promo code from your billing provider
Billing country code - ISO-3166-1 format, required for price localization
Checkout options - configuration for hosted checkout (success/cancel URLs, promo code collection, etc.)
Metadata - arbitrary key-value pairs
Behavior:
When payment details are required and not yet provided, Stigg redirects the customer to the billing solution’s hosted checkout page.
When no payment is required, the subscription is created immediately.
The result includes the subscription details or a checkout URL if payment is needed.
Node.js
Python
Go
Ruby
Java
.NET
const subscription = await stiggClient . provisionSubscription ({
customerId: 'customer-demo-01' ,
planId: 'plan-basic' ,
billingPeriod: 'MONTHLY' , // optional, required for paid subscriptions
resourceId: 'resource-01' , // optional, required for multiple subscriptions
billableFeatures: [{
featureId: 'feature-01-templates' ,
quantity: 2
}],
addons: [{
addonId: 'addon-extra-stuff' ,
quantity: 1 ,
}],
promotionCode: 'STIGG30' , // optional
billingCountryCode: 'DK' , // optional, required for price localization
checkoutOptions: { // optional
successUrl: "https://your-success-url.com" ,
cancelUrl: "https://your-cancel-url.com" ,
allowPromoCodes: true ,
collectBillingAddress: true ,
},
metadata: {
key: 'value' ,
}
});
{
"status" : "Success" ,
"checkoutUrl" : "https://your-success-url.com" ,
"subscription" : {
"id" : "subscription-plan-basic" ,
"planId" : "plan-basic" ,
"status" : "ACTIVE" ,
"addons" : [],
"customerId" : "customer-demo-01" ,
"resource" : {
"id" : "resource-01"
},
"metadata" : {
"lorem" : "ipsum"
},
"pricingType" : "FREE" ,
"paymentCollection" : "NOT_REQUIRED" ,
"latestInvoice" : {
"billingId" : "invoice-01" ,
"status" : "PAID"
}
}
}
A customer can have both a non-trial and a trial subscription to different plans of the same product in parallel.
When a customer with a trial subscription for plan X creates a new subscription for the same plan, it will be created as a non-trial (paid) subscription.
When a customer already has an active subscription for a product and a new one is created, the existing subscription is automatically cancelled.
You can explicitly skip the trial period by providing a skip-trial flag.
Updating subscriptions
Update an existing subscription without creating a new one, keeping the original start date and billing cycle. You can:
Update subscription metadata
Update unit quantity for per-unit pricing (e.g., adding or removing seats)
Add or remove add-ons (only if compatible with the plan)
Update the promotion code
Update the billing period
When integrated with a billing solution, modifying quantities or add-ons generates a prorated invoice.
Node.js
Python
Go
Ruby
Java
.NET
const subscription = await stiggClient . updateSubscription ({
subscriptionId: 'subscription-plan-basic' ,
billableFeatures: [{
featureId: 'feature-01-templates' ,
quantity: 3
}],
promotionCode: "STIGG30" , // optional
addons: [
{ addonId: 'extra-api-calls' , quantity: 5 }
],
metadata: {
key: 'newValue'
},
});
{
"id" : "subscription-plan-basic" ,
"planId" : "plan-basic" ,
"status" : "ACTIVE" ,
"addons" : [],
"customerId" : "customer-demo-01" ,
"resource" : {
"id" : "resource-01"
},
"metadata" : {
"key" : "newValue"
},
"pricingType" : "FREE"
}
Canceling subscriptions
Cancel a subscription by its ID. Cancellation behavior (immediate or end of billing period) is determined by the product’s configuration.
Node.js
Python
Go
Ruby
Java
.NET
await stiggClient . cancelSubscription ({
subscriptionId: 'subscription-plan-basic'
});
{
"id" : "subscription-plan-basic" ,
"planId" : "plan-basic" ,
"status" : "CANCELED" ,
"customerId" : "customer-demo-01" ,
"metadata" : {
"key" : "newValue"
},
"pricingType" : "FREE" ,
"effectiveEndDate" : "2022-09-20T10:18:06.842Z"
}
Canceling scheduled updates
Cancel all scheduled updates or pending payment updates for a given subscription.
await stiggClient . cancelSubscriptionScheduledUpdates ({
subscriptionId: 'subscription-plan-essentials' ,
status: SubscriptionScheduleStatus . Scheduled , // or SubscriptionScheduleStatus.PendingPayment
});
Listing active subscriptions
Retrieve a list of a customer’s active subscriptions. For products that support multiple active subscriptions, pass one or more resource IDs to filter by resource.
Node.js
Python
Go
Ruby
Java
.NET
const subscriptions = await stiggClient . getActiveSubscriptionsList ({
customerId: 'customer-demo-01' ,
resourceId: 'resource-01' , // optional, pass it to get subscription of specific resource
});
[
{
"subscriptionId" : "subscription-plan-pro-abc123" ,
"status" : "ACTIVE" ,
"startDate" : "2024-01-15T00:00:00.000Z" ,
"endDate" : null ,
"effectiveEndDate" : "2025-01-15T00:00:00.000Z" ,
"currentBillingPeriodStart" : "2024-01-15T00:00:00.000Z" ,
"currentBillingPeriodEnd" : "2024-02-15T00:00:00.000Z" ,
"billingPeriod" : "MONTHLY" ,
"additionalMetaData" : {
"internalTierId" : "tier-gold"
},
"customer" : {
"customerId" : "customer-demo-01" ,
"email" : "user@example.com"
},
"payingCustomer" : {
"customerId" : "customer-demo-01" ,
"email" : "user@example.com"
},
"plan" : {
"refId" : "plan-pro" ,
"displayName" : "Pro Plan" ,
"description" : "Full access to all Pro features" ,
"product" : {
"refId" : "product-main" ,
"displayName" : "Main Product" ,
"downgradePlan" : {
"refId" : "plan-free" ,
"displayName" : "Free Plan"
}
}
},
"addons" : [],
"prices" : [
{
"billingModel" : "FLAT_FEE" ,
"price" : {
"billingPeriod" : "MONTHLY" ,
"price" : {
"amount" : 99 ,
"currency" : "USD"
}
}
}
],
"totalPrice" : {
"subTotal" : {
"amount" : 99 ,
"currency" : "USD"
},
"total" : {
"amount" : 99 ,
"currency" : "USD"
}
},
"trialEndDate" : null
}
]
Getting a specific subscription
Retrieve extended details for a single subscription, including plan details, add-ons, pricing, payment collection status, and the latest invoice.
Node.js
Python
Go
Ruby
Java
.NET
const subscription = await stiggClient . getSubscription ({
subscriptionId: 'subscription-01' ,
});
Listing subscriptions with filtering
Query subscriptions with rich filtering, sorting, and cursor-based pagination. Useful for admin dashboards, audits, and reporting.
Supported filter operators include equality, inequality, inclusion, and exclusion for strings and enums, as well as comparison operators for dates. Filters support logical AND/OR composition.
Sortable fields include creation date, customer ID, environment ID, product ID, resource ID, and status.
Node.js
Python
Go
Ruby
Java
.NET
const subscriptions = await stiggClient . getSubscriptions ({
filter: {
and: [
{ customerId: { eq: "customer-demo-01" } },
{ status: { in: [ "ACTIVE" , "IN_TRIAL" ] } }
]
},
sorting: [{ field: "createdAt" , direction: "DESC" , nulls: "LAST" }],
paging: { first: 25 }
});
Subscription migration
Migrate subscriptions to the latest plan and add-on version on a subscription-by-subscription basis, to prevent SKU sprawl from grandfathering.
When the current subscription price differs from the latest published version, the customer will be charged or credited the prorated difference.
await stiggClient . migrateSubscriptionToLatest ({
subscriptionId: "subscription-id" ,
subscriptionMigrationTime: SubscriptionMigrationTime . EndOfBillingPeriod , // optional
});