You can run queries on real Stigg data using our GraphQL Explorer, an integrated development environment in your browser that includes docs, syntax highlighting, and validation errors.
To authenticate you need to pass the Server API key in the X-API-KEY request header.
GraphQL is introspective. This means you can query a GraphQL schema for details about itself. You can run an introspection query by passing your Server API key as a query parameter:
When a new customer is provisioned within your application (for example: as part of your registration or onboarding process), you should also provision them in Stigg.
The customer’s billing information can also be passed to Stigg when a customer is created or updated. When Stigg is integrated with additional service, this information will be propagated to the active integrations. The billing information is not persisted on Stigg’s servers.
You can optionally pass subscriptionParams to create subscription for that customer using a single operation. Doing so, will allow Stigg admins to override the requested subscription with no-code from the Stigg Console using the product’s Customer Journey configuration.
Customer information can also be updated whenever you like assuming it already exists, for example: In order to update the customer’s email, you only need to send the new email value without the rest of the customer. Due to the fact that the customer’s billing information is not persisted on Stigg’s servers, in order to update it, the entire billing information object must be passed each time.
{ "data": { "getSubscription": { "id": "7d4be2d9-ffc8-42f4-a79e-19960b631ef2", "startDate": "2022-08-24T21:00:13.000Z", "endDate": null, "trialEndDate": null, "cancellationDate": "2022-08-24T21:23:36.622Z", "effectiveEndDate": "2022-08-24T21:23:36.622Z", "status": "CANCELED", "refId": "subscription-plan-revvenu-basic-fc1e1d", "currentBillingPeriodEnd": "2023-08-24T21:00:13.000Z", "additionalMetaData": null, "prices": [], "totalPrice": null, "pricingType": "FREE", "plan": { "id": "08b249b1-5d15-4d09-a9f8-da4af00836d5", "refId": "plan-revvenu-basic", "displayName": "Basic", "description": null, "additionalMetaData": null }, "addons": [], "paymentCollection": "NOT_REQUIRED", // status of the payment collection of the subscription - can be either 'NOT_REQUIRED', 'FAILED', 'ACTION_REQUIRED' or 'PROCESSING' "latestInvoice": { "billingId": "invoice-01", // ID of the invoice of the billing provider "status": "PAID", // can be either 'OPEN', 'CANCELED' or 'PAID' "createdAt": "2023-08-22T11:27:41.000Z", "updatedAt": "2023-08-22T11:27:44.608Z", "requiresAction": false, // indicate of the payment requires action to complete the payment "paymentUrl": "https://...", // payment url that can be sent to the customer to complete the payment "paymentSecret": "secret-01", // secret to be used to initiate next action with billing provider "errorMessage": "", // optinal error message, if the status is FAILED } } }}
When a customer subscribes to a new plan (free, paid, trial, etc.), provision the subscription in Stigg.
Query
mutation CreateSubscription($input: ProvisionSubscriptionInput!) { provisionSubscription: provisionSubscriptionV2(subscription: $input) { id refId status additionalMetaData plan { id refId } addons { quantity addon { id refId } } customer { id refId } resource { resourceId } paymentCollection latestInvoice { billingId status createdAt updatedAt requiresAction paymentUrl paymentSecret errorMessage } } }
Variables
{ "input": { "customerId": "customer-id", "planId": "plan-revvenu-basic", "billingPeriod": "MONTHLY", "billingCountryCode":"DK", // optional - if multicurrency is enabled "addons": [ { "addonId": "addon-extra-stuff", "quantity": 2 } ], "additionalMetaData": { "key": "value" }, "resourceId": "resource-01" // optional, required for multiple subscription for same product } }
{ "data": { "createSubscription": { "id": "e8ca2feb-e57e-4e93-9007-f14814524944", "refId": "subscription-plan-revvenu-essentials-65768c", "status": "PAYMENT_PENDING", "additionalMetaData": { "key": "value" }, "plan": { "id": "3b0c9144-f6ea-4a39-af7b-2c9dda38a813", "refId": "plan-revvenu-essentials" }, "addons": [ { "quantity": 2, "addon": { "id": "83763342-93af-4ea7-995f-9598be7393f0", "refId": "addon-10-campaigns" } } ], "customer": { "id": "8e527bc0-9822-4b02-acbd-dadec77a01b2", "refId": "customer-9a88b4" }, "resource": { "resourceId": "resource-01" }, "paymentCollection": "NOT_REQUIRED", // status of the payment collection of the subscription - can be either 'NOT_REQUIRED', 'FAILED', 'ACTION_REQUIRED' or 'PROCESSING' "latestInvoice": { "billingId": "invoice-01", // ID of the invoice of the billing provider "status": "PAID", // can be either 'OPEN', 'CANCELED' or 'PAID' "createdAt": "2023-08-22T11:27:41.000Z", "updatedAt": "2023-08-22T11:27:44.608Z", "requiresAction": false, // indicate of the payment requires action to complete the payment "paymentUrl": "https://...", // payment url that can be sent to the customer to complete the payment "paymentSecret": "secret-01", // secret to be used to initiate next action with billing provider "errorMessage": "", // optinal error message, if the status is FAILED }, } }}
A customer can have both a non-trial (free or paid) subscription and trial subscription to different plans of the same product in parallel - this logic allows customers to trial a higher tier plan, while still paying for an existing plan.
When the customer has a trial subscription for plan X of product A and a new subscription is created for the same plan, the new subscription will be created as non-trial (paid) subscription - this logic follows an upgrade flow of a trial subscription to a paid subscription of a specific plan.
Except in the above-mentioned cases, when a customer has an active subscription for product X, and another subscription for the same product is created with start date S, the existing subscription will automatically be cancelled and the new subscription will start on start date S. It’s also possible to explicitly skip the trial period of the selected plan by providing the skipTrial: true parameter to the CreateSubscription mutation.
{ "data": { "updateOneSubscription": { "id": "e8ca2feb-e57e-4e93-9007-f14814524944", "refId": "subscription-plan-professional-4dfecf", "status": "ACTIVE", "additionalMetaData": { "key": "value" }, "plan": { "id": "3b0c9144-f6ea-4a39-af7b-2c9dda38a813", "refId": "plan-revvenu-essentials" }, "addons": [ { "quantity": 2, "addon": { "id": "83763342-93af-4ea7-995f-9598be7393f0", "refId": "addon-10-campaigns" } } ], "customer": { "id": "8e527bc0-9822-4b02-acbd-dadec77a01b2", "refId": "customer-9a88b4" }, "paymentCollection": "NOT_REQUIRED", // status of the payment collection of the subscription - can be either 'NOT_REQUIRED', 'FAILED', 'ACTION_REQUIRED' or 'PROCESSING' "latestInvoice": { "billingId": "invoice-01", // ID of the invoice of the billing provider "status": "PAID", // can be either 'OPEN', 'CANCELED' or 'PAID' "createdAt": "2023-08-22T11:27:41.000Z", "updatedAt": "2023-08-22T11:27:44.608Z", "requiresAction": false, // indicate of the payment requires action to complete the payment "paymentUrl": "https://...", // payment url that can be sent to the customer to complete the payment "paymentSecret": "secret-01", // secret to be used to initiate next action with billing provider "errorMessage": "", // optinal error message, if the status is FAILED }, } }}
The Stigg API allows you to report usage measurements for metered features. The reported usage will be used to track, limit and bill the customer’s usage of metered features.
Stigg supports metering of usage from the following data sources:
Calculated usage - usage that has been aggregated and calculated by your application. This type is useful for features, such as: seats.
Raw events - raw events from your application, which Stigg filters and aggregates aggregate to calculate customer usage. This type is useful for features, such as: monthly active users (MAUs).
More details about Stigg’s metering and aggregation capabilities can be found here:
Reporting of measurements to Stigg should be done only after the relevant resources have been provisioned in your application.
To ensure that the provisioned resources are aligned with the measurements that are reported to Stigg, ensure that customers are not allowed to allocate new resources until an acknowledgement about the processed measurement is received from the Stigg backend.
Validating that a measurement was successfully reported to Stigg is also possible in the customer details section of the relevant customer in the Stigg app.
You can also estimate the cost of updating an existing subscription using the updateSubscription method, which also returns a breakdown of the proration amounts:
Migrating subscriptions to the latest plan and add-on version
When changes to plans and add-ons are rolled out only to new subscriptions, grandfathering takes place. In order to prevent a SKU sprawl, Stigg allows you to manually migrate subscriptions to the latest plan and add-on version on a subscription-by-subscription basis.
When the current price of the subscription is different than the latest published package version, during the migration the customer will be charged or credited the prorated amount until the end of the current billing period depending on whether the latest price is more expensive or cheaper than the current subscription price.
Its PII (name and email address) will be nullified.
It will no longer appear in the Stigg app UI.
It will no longer be returned by the Stigg API and SDKs.
When Stigg is integrated with a billing solution, customers that are archived in Stigg will still exist in the billing solution to allow upcoming invoices to be finalized. Archiving customers in the billing solution can be done manually in the billing solution.