Skip to main content
POST
/
api
/
v1
/
subscriptions
/
{id}
/
usage
/
charge
JavaScript
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.usage.chargeUsage('x');

console.log(response.data);
{
  "data": {
    "subscriptionId": "<string>",
    "periodStart": "2023-11-07T05:31:56Z",
    "periodEnd": "2023-11-07T05:31:56Z",
    "invoiceBillingId": "<string>",
    "usageCharged": [
      {
        "featureId": "<string>",
        "usageAmount": 123
      }
    ]
  }
}

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-API-KEY
string
required

API Key

Path Parameters

id
string
required

The unique identifier of the entity

Required string length: 1 - 255

Body

application/json

Request to immediately charge usage for a subscription.

untilDate
string<date-time>

Cutoff date for usage calculation. If not provided, the current time is used.

Response

The charge result including period, invoice ID, and usage details.

Response object

data
ChargeSubscriptionUsageResponse · object
required

Result of charging subscription usage including the billing period and charged items.