import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const response = await client.v1.subscriptions.preview({
customerId: 'customerId',
planId: 'planId',
});
console.log(response.data);import os
from stigg import Stigg
client = Stigg(
api_key=os.environ.get("STIGG_API_KEY"), # This is the default and can be omitted
)
response = client.v1.subscriptions.preview(
customer_id="customerId",
plan_id="planId",
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/stiggio/stigg-go"
"github.com/stiggio/stigg-go/option"
)
func main() {
client := stigg.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.V1.Subscriptions.Preview(context.TODO(), stigg.V1SubscriptionPreviewParams{
CustomerID: "customerId",
PlanID: "planId",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.subscriptions.SubscriptionPreviewParams;
import io.stigg.models.v1.subscriptions.SubscriptionPreviewResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionPreviewParams params = SubscriptionPreviewParams.builder()
.customerId("customerId")
.planId("planId")
.build();
SubscriptionPreviewResponse response = client.v1().subscriptions().preview(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.subscriptions.preview(customer_id: "customerId", plan_id: "planId")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionPreviewParams parameters = new()
{
CustomerID = "customerId",
PlanID = "planId",
};
var response = await client.V1.Subscriptions.Preview(parameters);
Console.WriteLine(response);stigg v1:subscriptions preview \
--api-key 'My API Key' \
--customer-id customerId \
--plan-id planIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions/preview \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "<string>",
"planId": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"billingCountryCode": "<string>",
"unitQuantity": 1,
"billableFeatures": [
{
"featureId": "<string>",
"quantity": 1
}
],
"charges": [
{
"id": "<string>",
"quantity": 1
}
],
"addons": [
{
"id": "<string>",
"quantity": 1
}
],
"startDate": "2023-11-07T05:31:56Z",
"billingInformation": {
"taxRateIds": [
"<string>"
],
"taxPercentage": 50,
"billingAddress": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"postalCode": "<string>",
"state": "<string>"
},
"metadata": {},
"chargeOnBehalfOfAccount": "<string>",
"isBackdated": false,
"isInvoicePaid": false,
"invoiceDaysUntilDue": 123,
"integrationId": "<string>",
"taxIds": [
{
"type": "<string>",
"value": "<string>"
}
]
},
"appliedCoupon": {
"couponId": "<string>",
"billingCouponId": "<string>",
"promotionCode": "<string>",
"discount": {
"name": "<string>",
"description": "<string>",
"durationInMonths": 2,
"percentOff": 50.5,
"amountsOff": [
{
"amount": 123
}
]
},
"configuration": {
"startDate": "2023-11-07T05:31:56Z"
}
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customerId' => '<string>',
'planId' => '<string>',
'payingCustomerId' => '<string>',
'resourceId' => '<string>',
'billingCountryCode' => '<string>',
'unitQuantity' => 1,
'billableFeatures' => [
[
'featureId' => '<string>',
'quantity' => 1
]
],
'charges' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'addons' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'startDate' => '2023-11-07T05:31:56Z',
'billingInformation' => [
'taxRateIds' => [
'<string>'
],
'taxPercentage' => 50,
'billingAddress' => [
'city' => '<string>',
'country' => '<string>',
'line1' => '<string>',
'line2' => '<string>',
'postalCode' => '<string>',
'state' => '<string>'
],
'metadata' => [
],
'chargeOnBehalfOfAccount' => '<string>',
'isBackdated' => false,
'isInvoicePaid' => false,
'invoiceDaysUntilDue' => 123,
'integrationId' => '<string>',
'taxIds' => [
[
'type' => '<string>',
'value' => '<string>'
]
]
],
'appliedCoupon' => [
'couponId' => '<string>',
'billingCouponId' => '<string>',
'promotionCode' => '<string>',
'discount' => [
'name' => '<string>',
'description' => '<string>',
'durationInMonths' => 2,
'percentOff' => 50.5,
'amountsOff' => [
[
'amount' => 123
]
]
],
'configuration' => [
'startDate' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"immediateInvoice": {
"total": 123,
"subTotal": 123,
"discount": 123,
"tax": 123,
"currency": "<string>",
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"lines": [
{
"description": "<string>",
"unitPrice": 123,
"subTotal": 123,
"currency": "<string>",
"quantity": 123
}
],
"discounts": [
{
"description": "<string>",
"amount": 123,
"currency": "<string>"
}
],
"discountDetails": {
"code": "<string>",
"percentage": 123,
"fixedAmount": 123
}
},
"recurringInvoice": {
"total": 123,
"subTotal": 123,
"discount": 123,
"tax": 123,
"currency": "<string>",
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"lines": [
{
"description": "<string>",
"unitPrice": 123,
"subTotal": 123,
"currency": "<string>",
"quantity": 123
}
],
"discounts": [
{
"description": "<string>",
"amount": 123,
"currency": "<string>"
}
],
"discountDetails": {
"code": "<string>",
"percentage": 123,
"fixedAmount": 123
}
},
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"isPlanDowngrade": true,
"hasScheduledUpdates": true,
"freeItems": [
{
"id": "<string>",
"quantity": 1
}
]
}
}{
"message": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Preview Subscription
Previews the pricing impact of creating or updating a subscription without making changes. Returns estimated costs, taxes, and proration details.
import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const response = await client.v1.subscriptions.preview({
customerId: 'customerId',
planId: 'planId',
});
console.log(response.data);import os
from stigg import Stigg
client = Stigg(
api_key=os.environ.get("STIGG_API_KEY"), # This is the default and can be omitted
)
response = client.v1.subscriptions.preview(
customer_id="customerId",
plan_id="planId",
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/stiggio/stigg-go"
"github.com/stiggio/stigg-go/option"
)
func main() {
client := stigg.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.V1.Subscriptions.Preview(context.TODO(), stigg.V1SubscriptionPreviewParams{
CustomerID: "customerId",
PlanID: "planId",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.subscriptions.SubscriptionPreviewParams;
import io.stigg.models.v1.subscriptions.SubscriptionPreviewResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionPreviewParams params = SubscriptionPreviewParams.builder()
.customerId("customerId")
.planId("planId")
.build();
SubscriptionPreviewResponse response = client.v1().subscriptions().preview(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.subscriptions.preview(customer_id: "customerId", plan_id: "planId")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionPreviewParams parameters = new()
{
CustomerID = "customerId",
PlanID = "planId",
};
var response = await client.V1.Subscriptions.Preview(parameters);
Console.WriteLine(response);stigg v1:subscriptions preview \
--api-key 'My API Key' \
--customer-id customerId \
--plan-id planIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions/preview \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "<string>",
"planId": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"billingCountryCode": "<string>",
"unitQuantity": 1,
"billableFeatures": [
{
"featureId": "<string>",
"quantity": 1
}
],
"charges": [
{
"id": "<string>",
"quantity": 1
}
],
"addons": [
{
"id": "<string>",
"quantity": 1
}
],
"startDate": "2023-11-07T05:31:56Z",
"billingInformation": {
"taxRateIds": [
"<string>"
],
"taxPercentage": 50,
"billingAddress": {
"city": "<string>",
"country": "<string>",
"line1": "<string>",
"line2": "<string>",
"postalCode": "<string>",
"state": "<string>"
},
"metadata": {},
"chargeOnBehalfOfAccount": "<string>",
"isBackdated": false,
"isInvoicePaid": false,
"invoiceDaysUntilDue": 123,
"integrationId": "<string>",
"taxIds": [
{
"type": "<string>",
"value": "<string>"
}
]
},
"appliedCoupon": {
"couponId": "<string>",
"billingCouponId": "<string>",
"promotionCode": "<string>",
"discount": {
"name": "<string>",
"description": "<string>",
"durationInMonths": 2,
"percentOff": 50.5,
"amountsOff": [
{
"amount": 123
}
]
},
"configuration": {
"startDate": "2023-11-07T05:31:56Z"
}
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customerId' => '<string>',
'planId' => '<string>',
'payingCustomerId' => '<string>',
'resourceId' => '<string>',
'billingCountryCode' => '<string>',
'unitQuantity' => 1,
'billableFeatures' => [
[
'featureId' => '<string>',
'quantity' => 1
]
],
'charges' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'addons' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'startDate' => '2023-11-07T05:31:56Z',
'billingInformation' => [
'taxRateIds' => [
'<string>'
],
'taxPercentage' => 50,
'billingAddress' => [
'city' => '<string>',
'country' => '<string>',
'line1' => '<string>',
'line2' => '<string>',
'postalCode' => '<string>',
'state' => '<string>'
],
'metadata' => [
],
'chargeOnBehalfOfAccount' => '<string>',
'isBackdated' => false,
'isInvoicePaid' => false,
'invoiceDaysUntilDue' => 123,
'integrationId' => '<string>',
'taxIds' => [
[
'type' => '<string>',
'value' => '<string>'
]
]
],
'appliedCoupon' => [
'couponId' => '<string>',
'billingCouponId' => '<string>',
'promotionCode' => '<string>',
'discount' => [
'name' => '<string>',
'description' => '<string>',
'durationInMonths' => 2,
'percentOff' => 50.5,
'amountsOff' => [
[
'amount' => 123
]
]
],
'configuration' => [
'startDate' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"immediateInvoice": {
"total": 123,
"subTotal": 123,
"discount": 123,
"tax": 123,
"currency": "<string>",
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"lines": [
{
"description": "<string>",
"unitPrice": 123,
"subTotal": 123,
"currency": "<string>",
"quantity": 123
}
],
"discounts": [
{
"description": "<string>",
"amount": 123,
"currency": "<string>"
}
],
"discountDetails": {
"code": "<string>",
"percentage": 123,
"fixedAmount": 123
}
},
"recurringInvoice": {
"total": 123,
"subTotal": 123,
"discount": 123,
"tax": 123,
"currency": "<string>",
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"lines": [
{
"description": "<string>",
"unitPrice": 123,
"subTotal": 123,
"currency": "<string>",
"quantity": 123
}
],
"discounts": [
{
"description": "<string>",
"amount": 123,
"currency": "<string>"
}
],
"discountDetails": {
"code": "<string>",
"percentage": 123,
"fixedAmount": 123
}
},
"billingPeriodRange": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"isPlanDowngrade": true,
"hasScheduledUpdates": true,
"freeItems": [
{
"id": "<string>",
"quantity": 1
}
]
}
}{
"message": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Authorizations
Server API Key
Headers
Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.
Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).
Body
Preview subscription pricing and invoice details before provisioning. Returns calculated totals, line items, taxes, and discounts based on the provided subscription configuration.
Customer ID
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$Plan ID
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Paying customer ID for delegated billing
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$Resource ID for multi-instance subscriptions
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Billing period (MONTHLY or ANNUALLY)
MONTHLY, ANNUALLY ISO 3166-1 country code for localization
255Unit quantity for per-unit pricing. Minimum is 0 (zero is allowed).
x >= 0Billable features with quantities
Show child attributes
Show child attributes
One-time or recurring charges
Show child attributes
Show child attributes
Addons to include
Show child attributes
Show child attributes
Subscription start date
Billing and tax configuration
Show child attributes
Show child attributes
When to apply subscription changes
END_OF_BILLING_PERIOD, END_OF_BILLING_MONTH, IMMEDIATE Coupon or discount to apply
Show child attributes
Show child attributes
Trial period override settings
Show child attributes
Show child attributes
Billing cycle anchor behavior for the subscription
UNCHANGED, NOW Response
The subscription preview with pricing breakdown.
Response object
Pricing preview with invoices
Show child attributes
Show child attributes
