import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const subscriptionListResponse of client.v1.subscriptions.list()) {
console.log(subscriptionListResponse.id);
}{
"data": [
{
"id": "<string>",
"customerId": "<string>",
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"status": "PAYMENT_PENDING",
"pricingType": "FREE",
"paymentCollection": "NOT_REQUIRED",
"planId": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"endDate": "2023-11-07T05:31:56Z",
"effectiveEndDate": "2023-11-07T05:31:56Z",
"cancellationDate": "2023-11-07T05:31:56Z",
"trialEndDate": "2023-11-07T05:31:56Z",
"cancelReason": "UPGRADE_OR_DOWNGRADE",
"metadata": {},
"currentBillingPeriodStart": "2023-11-07T05:31:56Z",
"currentBillingPeriodEnd": "2023-11-07T05:31:56Z",
"paymentCollectionMethod": "CHARGE",
"billingCycleAnchor": "2023-11-07T05:31:56Z",
"prices": [],
"addons": [],
"coupons": [],
"futureUpdates": [],
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123,
"currency": "usd"
},
"subscriptionEntitlements": [],
"latestInvoice": {
"billingId": "<string>",
"status": "OPEN",
"createdAt": "2023-11-07T05:31:56Z",
"requiresAction": true,
"total": 123,
"amountDue": 123,
"currency": "<string>",
"pdfUrl": "<string>",
"billingReason": "BILLING_CYCLE"
},
"trial": {
"trialEndBehavior": "CONVERT_TO_PAID"
}
}
],
"pagination": {
"next": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prev": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Retrieves a paginated list of subscriptions, with optional filters for customer, status, and plan.
import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const subscriptionListResponse of client.v1.subscriptions.list()) {
console.log(subscriptionListResponse.id);
}{
"data": [
{
"id": "<string>",
"customerId": "<string>",
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"status": "PAYMENT_PENDING",
"pricingType": "FREE",
"paymentCollection": "NOT_REQUIRED",
"planId": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"endDate": "2023-11-07T05:31:56Z",
"effectiveEndDate": "2023-11-07T05:31:56Z",
"cancellationDate": "2023-11-07T05:31:56Z",
"trialEndDate": "2023-11-07T05:31:56Z",
"cancelReason": "UPGRADE_OR_DOWNGRADE",
"metadata": {},
"currentBillingPeriodStart": "2023-11-07T05:31:56Z",
"currentBillingPeriodEnd": "2023-11-07T05:31:56Z",
"paymentCollectionMethod": "CHARGE",
"billingCycleAnchor": "2023-11-07T05:31:56Z",
"prices": [],
"addons": [],
"coupons": [],
"futureUpdates": [],
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123,
"currency": "usd"
},
"subscriptionEntitlements": [],
"latestInvoice": {
"billingId": "<string>",
"status": "OPEN",
"createdAt": "2023-11-07T05:31:56Z",
"requiresAction": true,
"total": 123,
"amountDue": 123,
"currency": "<string>",
"pdfUrl": "<string>",
"billingReason": "BILLING_CYCLE"
},
"trial": {
"trialEndBehavior": "CONVERT_TO_PAID"
}
}
],
"pagination": {
"next": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prev": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Server API Key
Return items that come after this cursor
Return items that come before this cursor
Maximum number of items to return
1 <= x <= 100Filter by customer ID
Filter by subscription status. Supports comma-separated values for multiple statuses
Filter by plan ID
Filter by resource ID
Filter by pricing type. Supports comma-separated values for multiple types
Filter by creation date using range operators: gt, gte, lt, lte
Show child attributes