import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const subscription = await client.v1.subscriptions.migrate('x');
console.log(subscription.data);{
"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"
}
}
}Migrates a subscription to the latest published version of its plan or add-ons. Handles prorated charges or credits automatically.
import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const subscription = await client.v1.subscriptions.migrate('x');
console.log(subscription.data);{
"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"
}
}
}Server API Key
The unique identifier of the entity
1 - 255Migrate a subscription to the latest version of its plan or add-on. This updates pricing, entitlements, and features to match the currently published version while maintaining the subscription continuity.
When to migrate (immediate or period end)
END_OF_BILLING_PERIOD, IMMEDIATE The migrated subscription object.
Response object
Customer subscription to a plan
Show child attributes