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.provision({
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.provision(
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.Provision(context.TODO(), stigg.V1SubscriptionProvisionParams{
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.SubscriptionProvisionParams;
import io.stigg.models.v1.subscriptions.SubscriptionProvisionResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionProvisionParams params = SubscriptionProvisionParams.builder()
.customerId("customerId")
.planId("planId")
.build();
SubscriptionProvisionResponse response = client.v1().subscriptions().provision(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.subscriptions.provision(customer_id: "customerId", plan_id: "planId")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionProvisionParams parameters = new()
{
CustomerID = "customerId",
PlanID = "planId",
};
var response = await client.V1.Subscriptions.Provision(parameters);
Console.WriteLine(response);stigg v1:subscriptions provision \
--api-key 'My API Key' \
--customer-id customerId \
--plan-id planIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "<string>",
"planId": "<string>",
"id": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"addons": [
{
"id": "<string>",
"quantity": 1
}
],
"charges": [
{
"id": "<string>",
"quantity": 1
}
],
"startDate": "2023-11-07T05:31:56Z",
"cancellationDate": "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>"
}
]
},
"billingId": "<string>",
"billingCountryCode": "<string>",
"entitlements": [
{
"type": "FEATURE",
"id": "<string>",
"usageLimit": 1,
"hasUnlimitedUsage": true,
"hasSoftLimit": true,
"yearlyResetPeriodConfiguration": {
"accordingTo": "SubscriptionStart"
},
"monthlyResetPeriodConfiguration": {},
"weeklyResetPeriodConfiguration": {}
}
],
"metadata": {},
"salesforceId": "<string>",
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123
},
"priceOverrides": [
{
"amount": 123,
"featureId": "<string>",
"addonId": "<string>",
"baseCharge": true,
"billingCountryCode": "<string>",
"blockSize": 123,
"tiers": [
{
"upTo": 123
}
]
}
],
"paymentCollectionMethod": "CHARGE",
"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"
}
},
"awaitPaymentConfirmation": true,
"unitQuantity": 1
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions",
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>',
'id' => '<string>',
'payingCustomerId' => '<string>',
'resourceId' => '<string>',
'addons' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'charges' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'startDate' => '2023-11-07T05:31:56Z',
'cancellationDate' => '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>'
]
]
],
'billingId' => '<string>',
'billingCountryCode' => '<string>',
'entitlements' => [
[
'type' => 'FEATURE',
'id' => '<string>',
'usageLimit' => 1,
'hasUnlimitedUsage' => true,
'hasSoftLimit' => true,
'yearlyResetPeriodConfiguration' => [
'accordingTo' => 'SubscriptionStart'
],
'monthlyResetPeriodConfiguration' => [
],
'weeklyResetPeriodConfiguration' => [
]
]
],
'metadata' => [
],
'salesforceId' => '<string>',
'budget' => [
'limit' => 123,
'hasSoftLimit' => true
],
'minimumSpend' => [
'amount' => 123
],
'priceOverrides' => [
[
'amount' => 123,
'featureId' => '<string>',
'addonId' => '<string>',
'baseCharge' => true,
'billingCountryCode' => '<string>',
'blockSize' => 123,
'tiers' => [
[
'upTo' => 123
]
]
]
],
'paymentCollectionMethod' => 'CHARGE',
'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'
]
],
'awaitPaymentConfirmation' => true,
'unitQuantity' => 1
]),
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": {
"id": "<string>",
"subscription": {
"id": "<string>",
"customerId": "<string>",
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"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",
"metadata": {},
"currentBillingPeriodStart": "2023-11-07T05:31:56Z",
"currentBillingPeriodEnd": "2023-11-07T05:31:56Z",
"billingCycleAnchor": "2023-11-07T05:31:56Z",
"prices": [],
"addons": [],
"coupons": [],
"futureUpdates": [],
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123
},
"subscriptionEntitlements": [],
"latestInvoice": {
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"requiresAction": true,
"total": 123,
"amountDue": 123,
"currency": "<string>",
"pdfUrl": "<string>"
},
"trial": {}
},
"entitlements": [
{
"isGranted": true,
"type": "FEATURE",
"feature": {
"id": "<string>",
"displayName": "<string>"
},
"usageLimit": 1,
"hasUnlimitedUsage": true,
"currentUsage": 1,
"usagePeriodAnchor": "2023-11-07T05:31:56Z",
"usagePeriodStart": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z",
"entitlementUpdatedAt": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}
],
"checkoutBillingId": "<string>",
"checkoutUrl": "<string>",
"isScheduled": true
}
}{
"message": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Provision subscription
Creates a new subscription for an existing customer. When payment is required and no payment method exists, returns a checkout URL.
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.provision({
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.provision(
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.Provision(context.TODO(), stigg.V1SubscriptionProvisionParams{
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.SubscriptionProvisionParams;
import io.stigg.models.v1.subscriptions.SubscriptionProvisionResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionProvisionParams params = SubscriptionProvisionParams.builder()
.customerId("customerId")
.planId("planId")
.build();
SubscriptionProvisionResponse response = client.v1().subscriptions().provision(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
response = stigg.v1.subscriptions.provision(customer_id: "customerId", plan_id: "planId")
puts(response)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionProvisionParams parameters = new()
{
CustomerID = "customerId",
PlanID = "planId",
};
var response = await client.V1.Subscriptions.Provision(parameters);
Console.WriteLine(response);stigg v1:subscriptions provision \
--api-key 'My API Key' \
--customer-id customerId \
--plan-id planIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "<string>",
"planId": "<string>",
"id": "<string>",
"payingCustomerId": "<string>",
"resourceId": "<string>",
"addons": [
{
"id": "<string>",
"quantity": 1
}
],
"charges": [
{
"id": "<string>",
"quantity": 1
}
],
"startDate": "2023-11-07T05:31:56Z",
"cancellationDate": "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>"
}
]
},
"billingId": "<string>",
"billingCountryCode": "<string>",
"entitlements": [
{
"type": "FEATURE",
"id": "<string>",
"usageLimit": 1,
"hasUnlimitedUsage": true,
"hasSoftLimit": true,
"yearlyResetPeriodConfiguration": {
"accordingTo": "SubscriptionStart"
},
"monthlyResetPeriodConfiguration": {},
"weeklyResetPeriodConfiguration": {}
}
],
"metadata": {},
"salesforceId": "<string>",
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123
},
"priceOverrides": [
{
"amount": 123,
"featureId": "<string>",
"addonId": "<string>",
"baseCharge": true,
"billingCountryCode": "<string>",
"blockSize": 123,
"tiers": [
{
"upTo": 123
}
]
}
],
"paymentCollectionMethod": "CHARGE",
"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"
}
},
"awaitPaymentConfirmation": true,
"unitQuantity": 1
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions",
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>',
'id' => '<string>',
'payingCustomerId' => '<string>',
'resourceId' => '<string>',
'addons' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'charges' => [
[
'id' => '<string>',
'quantity' => 1
]
],
'startDate' => '2023-11-07T05:31:56Z',
'cancellationDate' => '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>'
]
]
],
'billingId' => '<string>',
'billingCountryCode' => '<string>',
'entitlements' => [
[
'type' => 'FEATURE',
'id' => '<string>',
'usageLimit' => 1,
'hasUnlimitedUsage' => true,
'hasSoftLimit' => true,
'yearlyResetPeriodConfiguration' => [
'accordingTo' => 'SubscriptionStart'
],
'monthlyResetPeriodConfiguration' => [
],
'weeklyResetPeriodConfiguration' => [
]
]
],
'metadata' => [
],
'salesforceId' => '<string>',
'budget' => [
'limit' => 123,
'hasSoftLimit' => true
],
'minimumSpend' => [
'amount' => 123
],
'priceOverrides' => [
[
'amount' => 123,
'featureId' => '<string>',
'addonId' => '<string>',
'baseCharge' => true,
'billingCountryCode' => '<string>',
'blockSize' => 123,
'tiers' => [
[
'upTo' => 123
]
]
]
],
'paymentCollectionMethod' => 'CHARGE',
'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'
]
],
'awaitPaymentConfirmation' => true,
'unitQuantity' => 1
]),
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": {
"id": "<string>",
"subscription": {
"id": "<string>",
"customerId": "<string>",
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"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",
"metadata": {},
"currentBillingPeriodStart": "2023-11-07T05:31:56Z",
"currentBillingPeriodEnd": "2023-11-07T05:31:56Z",
"billingCycleAnchor": "2023-11-07T05:31:56Z",
"prices": [],
"addons": [],
"coupons": [],
"futureUpdates": [],
"budget": {
"limit": 123,
"hasSoftLimit": true
},
"minimumSpend": {
"amount": 123
},
"subscriptionEntitlements": [],
"latestInvoice": {
"billingId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"requiresAction": true,
"total": 123,
"amountDue": 123,
"currency": "<string>",
"pdfUrl": "<string>"
},
"trial": {}
},
"entitlements": [
{
"isGranted": true,
"type": "FEATURE",
"feature": {
"id": "<string>",
"displayName": "<string>"
},
"usageLimit": 1,
"hasUnlimitedUsage": true,
"currentUsage": 1,
"usagePeriodAnchor": "2023-11-07T05:31:56Z",
"usagePeriodStart": "2023-11-07T05:31:56Z",
"usagePeriodEnd": "2023-11-07T05:31:56Z",
"entitlementUpdatedAt": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}
],
"checkoutBillingId": "<string>",
"checkoutUrl": "<string>",
"isScheduled": true
}
}{
"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
Provision a subscription. Returns subscription or checkout URL.
Customer ID to provision the subscription for
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$Plan ID to provision
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Unique identifier for the subscription
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Optional paying customer ID for split billing scenarios
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$Optional resource ID for multi-instance subscriptions
1 - 255^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$Billing period (MONTHLY or ANNUALLY)
MONTHLY, ANNUALLY Show child attributes
Show child attributes
Show child attributes
Show child attributes
Subscription start date
Subscription cancellation date
Show child attributes
Show child attributes
External billing system identifier
255The ISO 3166-1 alpha-2 country code for billing
255Feature entitlement configuration for a subscription
- SubscriptionFeatureEntitlementRequest
- SubscriptionCreditEntitlementRequest
Show child attributes
Show child attributes
Trial period override settings
Show child attributes
Show child attributes
Strategy for scheduling subscription changes
END_OF_BILLING_PERIOD, END_OF_BILLING_MONTH, IMMEDIATE Checkout page configuration for payment collection
Show child attributes
Show child attributes
Additional metadata for the subscription
Show child attributes
Show child attributes
Salesforce ID
255Show child attributes
Show child attributes
Minimum spend amount
Show child attributes
Show child attributes
Show child attributes
Show child attributes
How payments should be collected for this subscription
CHARGE, INVOICE, NONE Coupon configuration
Show child attributes
Show child attributes
Whether to wait for payment confirmation before returning the subscription
Unit quantity for per-unit pricing. Minimum is 0 (zero is allowed).
x >= 0Billing cycle anchor behavior for the subscription
UNCHANGED, NOW Response
The newly created subscription object.
Response object
Provisioning result with status and subscription or checkout URL.
Show child attributes
Show child attributes
