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.delegate('x', {
targetCustomerId: 'targetCustomerId',
});
console.log(subscription.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
)
subscription = client.v1.subscriptions.delegate(
id="x",
target_customer_id="targetCustomerId",
)
print(subscription.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"),
)
subscription, err := client.V1.Subscriptions.Delegate(
context.TODO(),
"x",
stigg.V1SubscriptionDelegateParams{
TargetCustomerID: "targetCustomerId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subscription.Data)
}
package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.subscriptions.Subscription;
import io.stigg.models.v1.subscriptions.SubscriptionDelegateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionDelegateParams params = SubscriptionDelegateParams.builder()
.id("x")
.targetCustomerId("targetCustomerId")
.build();
Subscription subscription = client.v1().subscriptions().delegate(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
subscription = stigg.v1.subscriptions.delegate("x", target_customer_id: "targetCustomerId")
puts(subscription)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionDelegateParams parameters = new()
{
ID = "x",
TargetCustomerID = "targetCustomerId",
};
var subscription = await client.V1.Subscriptions.Delegate(parameters);
Console.WriteLine(subscription);stigg v1:subscriptions delegate \
--api-key 'My API Key' \
--id x \
--target-customer-id targetCustomerIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions/{id}/delegate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"targetCustomerId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions/{id}/delegate",
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([
'targetCustomerId' => '<string>'
]),
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>",
"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>",
"contractId": "<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"
}
}
}{
"message": "<string>",
"code": "BadUserInput",
"reason": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>",
"code": "IdentityForbidden"
}{
"message": "<string>",
"code": "CustomerNotFound"
}{
"message": "<string>",
"code": "RateLimitExceeded"
}Delegate subscription payment to customer
Delegates a subscription to a different customer, who becomes responsible for managing it. The original customer remains the paying customer for this subscription, unless payment was already delegated to the target customer, in which case the target customer becomes the paying customer as well.
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.delegate('x', {
targetCustomerId: 'targetCustomerId',
});
console.log(subscription.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
)
subscription = client.v1.subscriptions.delegate(
id="x",
target_customer_id="targetCustomerId",
)
print(subscription.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"),
)
subscription, err := client.V1.Subscriptions.Delegate(
context.TODO(),
"x",
stigg.V1SubscriptionDelegateParams{
TargetCustomerID: "targetCustomerId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", subscription.Data)
}
package io.stigg.example;
import io.stigg.client.StiggClient;
import io.stigg.client.okhttp.StiggOkHttpClient;
import io.stigg.models.v1.subscriptions.Subscription;
import io.stigg.models.v1.subscriptions.SubscriptionDelegateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
StiggClient client = StiggOkHttpClient.fromEnv();
SubscriptionDelegateParams params = SubscriptionDelegateParams.builder()
.id("x")
.targetCustomerId("targetCustomerId")
.build();
Subscription subscription = client.v1().subscriptions().delegate(params);
}
}require "stigg"
stigg = Stigg::Client.new(api_key: "My API Key")
subscription = stigg.v1.subscriptions.delegate("x", target_customer_id: "targetCustomerId")
puts(subscription)using System;
using Stigg.Client;
using Stigg.Client.Models.V1.Subscriptions;
StiggClient client = new();
SubscriptionDelegateParams parameters = new()
{
ID = "x",
TargetCustomerID = "targetCustomerId",
};
var subscription = await client.V1.Subscriptions.Delegate(parameters);
Console.WriteLine(subscription);stigg v1:subscriptions delegate \
--api-key 'My API Key' \
--id x \
--target-customer-id targetCustomerIdcurl --request POST \
--url https://api.stigg.io/api/v1/subscriptions/{id}/delegate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"targetCustomerId": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stigg.io/api/v1/subscriptions/{id}/delegate",
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([
'targetCustomerId' => '<string>'
]),
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>",
"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>",
"contractId": "<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"
}
}
}{
"message": "<string>",
"code": "BadUserInput",
"reason": "<string>"
}{
"message": "<string>",
"code": "Unauthenticated"
}{
"message": "<string>",
"code": "IdentityForbidden"
}{
"message": "<string>",
"code": "CustomerNotFound"
}{
"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).
Path Parameters
The unique identifier of the entity
1 - 255Body
Delegates a subscription to a different customer, who becomes responsible for managing it. The original customer remains the paying customer for this subscription, unless payment was already delegated to the target customer, in which case the target customer becomes the paying customer as well. This is useful for B2B scenarios where a different entity should manage the subscription while the original customer continues handling payment.
The unique identifier of the customer who will manage this subscription going forward. This customer must already exist in your Stigg account. The paying customer for the subscription does not change as a result of this request.
255Response
The updated subscription object.
Response object
Customer subscription to a plan
Show child attributes
Show child attributes
