> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration with multiple billing providers

## Overview

Each Stigg environment supports integration with **multiple** billing providers.

This enables vendors to use Stigg as the single source of truth for their product catalog, customers, and subscriptions, while still billing different customers through different billing systems as needed.

When multiple billing providers are connected, Stigg automatically syncs and replicates the product catalog across all of them.

However, customers and their subscriptions can only be synced to **one billing provider at a time**.

<img src="https://mintcdn.com/stigg/ghlUDOmd1mRIOf61/images/docs/26b171acef7a9c47e7ba1cabf1975151baaf6f8f1bf834c64edd918e6bf75af9-image.png?fit=max&auto=format&n=ghlUDOmd1mRIOf61&q=85&s=4f7abe652c28dfb37abd572bb0c9e34b" alt="" width="2536" height="1959" data-path="images/docs/26b171acef7a9c47e7ba1cabf1975151baaf6f8f1bf834c64edd918e6bf75af9-image.png" />

## Use-cases

There are two primary scenarios where integrating multiple billing providers with Stigg is especially valuable:

The first is when vendors need to bill customers through different legal entities for reasons such as revenue recognition, taxation, or regional compliance. For instance, a vendor might bill EU customers through an EU-based entity, APAC customers through a Japan-based entity, and the rest of the world through a US-based entity.

The second is when vendors operate with more than one billing provider, particularly in the context of mergers and acquisitions where each entity may retain its existing billing system. For example, a vendor that acquires another company may continue using both Stripe and Zuora to serve different customer segments.

## Default billing provider

When an environment is connected to one or more billing providers, one provider is always designated as the default. This default determines where new customers and subscriptions are synced, unless a different billing provider is explicitly specified during provisioning. You can change the default provider at any time.

### View the default provider

When multiple billing providers are connected, Stigg highlights the current default provider in the app:

1. Go to **Integrations > Apps > Billing**.
2. The default provider is visually marked in the billing integrations list with a **Default** badge.

<img src="https://mintcdn.com/stigg/ghlUDOmd1mRIOf61/images/docs/1991d1c5cef4680c4b4653ab2c14606aab80849bbec9bd7bf9101ab4ab40e16a-multipleintegration_8_6.png?fit=max&auto=format&n=ghlUDOmd1mRIOf61&q=85&s=da73d7a9da517269f5d28616a105f1ff" alt="" width="2872" height="1134" data-path="images/docs/1991d1c5cef4680c4b4653ab2c14606aab80849bbec9bd7bf9101ab4ab40e16a-multipleintegration_8_6.png" />

### Change the default provider

1. Go to **Integrations > Apps > Billing**.
2. Locate the billing provider you want to set as the default.
3. Click the three-dot menu next to it.

<img src="https://mintcdn.com/stigg/cwvUR-sZ1iKIoz2m/images/docs/acecea14dbc9412a6cd4f198041dc9289a006c503c3f8c3b6a838ac3c35a8b64-multipleintegration_8_10.png?fit=max&auto=format&n=cwvUR-sZ1iKIoz2m&q=85&s=e0d719c2ab80173edfa0fcbdb8e53e95" alt="" width="2880" height="1164" data-path="images/docs/acecea14dbc9412a6cd4f198041dc9289a006c503c3f8c3b6a838ac3c35a8b64-multipleintegration_8_10.png" />

4. Select **Set as default**.
5. Confirm the action when prompted.

<Warning>
  Before removing the default billing provider, you must first set another billing provider as the default.
</Warning>

## Integration ID

When multiple billing providers are connected, each provider is assigned a unique Integration ID, which appears in its details section.

To [explicitly route ](#routing-customers-and-subscriptions-to-the-correct-billing-provider)a customer or subscription to a specific billing provider, include this Integration ID when provisioning or updating via the Stigg API or SDKs.

<img src="https://mintcdn.com/stigg/cwvUR-sZ1iKIoz2m/images/docs/abe56fab851c450af44bac46f23a8e82bb80acec74c0e17ac6141d3187d4510b-Plan_info_8.png?fit=max&auto=format&n=cwvUR-sZ1iKIoz2m&q=85&s=d4554b41bb3c892944fd8ce94d47e7af" alt="" width="1501" height="750" data-path="images/docs/abe56fab851c450af44bac46f23a8e82bb80acec74c0e17ac6141d3187d4510b-Plan_info_8.png" />

To change this ID, hover over it, click the **Edit** action, and confirm the change.

<img src="https://mintcdn.com/stigg/8tviKNnHCor59SIf/images/docs/fc33821260f3439f92354fbd64d4617d826330567b3284f8a946072d6f4d41e4-Plan_info_10.png?fit=max&auto=format&n=8tviKNnHCor59SIf&q=85&s=d79fc66a83979d08833b1b2abfe2548d" alt="" width="1501" height="766" data-path="images/docs/fc33821260f3439f92354fbd64d4617d826330567b3284f8a946072d6f4d41e4-Plan_info_10.png" />

<Note>
  For maximum flexibility, it's recommended to store the relevant integration IDs as environment variables.
</Note>

## Setup

To set up multiple billing providers in the Stigg app:

1. Go to **Integrations > Apps**.
2. Add the integration with your first billing provider. This provider will be automatically set as the default.
3. Add the integration with your second billing provider.

<Note>
  Each time a new billing integration is added, Stigg automatically syncs the product catalog with it.
</Note>

## Sync status

### Product catalog

When multiple billing providers are integrated with Stigg, each product catalog entity displays the number of billing providers it is synced with, along with the sync status for each provider.

Clicking on the number of instances will open a side panel, in which users can view the sync status of the entity in each billing provider. Clicking on the billing ID also serves as a deep link to the entity in the relevant billing provider.

<img src="https://mintcdn.com/stigg/vKl0Sj1YLcCT0yUv/images/docs/37096df8c8d923f401d45e06b30b0bebe8dc8f37c9b0ef5aa4f7bd265b995863-customer_2.png?fit=max&auto=format&n=vKl0Sj1YLcCT0yUv&q=85&s=064d273e619bdb625eb0480059a7eaa1" alt="" width="2880" height="1708" data-path="images/docs/37096df8c8d923f401d45e06b30b0bebe8dc8f37c9b0ef5aa4f7bd265b995863-customer_2.png" />

### Customers and subscriptions

Since customers and subscriptions can only be synced to a single billing provider, the associated billing provider will be shown under the **Billing ID** field of the relevant entity:

<img src="https://mintcdn.com/stigg/ghlUDOmd1mRIOf61/images/docs/2a3b28d0aeda8038c9be9c13082de7af8b7eea1eb008486c2742948cdf7110d7-customer_3.png?fit=max&auto=format&n=ghlUDOmd1mRIOf61&q=85&s=56c937af8469a37e8f23449e974e8e63" alt="" width="2880" height="1312" data-path="images/docs/2a3b28d0aeda8038c9be9c13082de7af8b7eea1eb008486c2742948cdf7110d7-customer_3.png" />

## Routing customers and subscriptions to the correct billing provider

### Using the Stigg app

You can manage customer payment methods and route subscriptions to different billing providers directly from the Stigg user interface.

#### When adding a payment method for the customer

1. Go to **Customers**.
2. Select an existing customer.

<img src="https://mintcdn.com/stigg/tWlJkHU9GfoKBEmJ/images/docs/561909fd6dd1f9d5b0867612f8f074c245fd394d01b988b79b87bd6659402dcc-customer_3.png?fit=max&auto=format&n=tWlJkHU9GfoKBEmJ&q=85&s=6d64b9036e634a00399464fa2a3a4aa5" alt="" width="1440" height="938" data-path="images/docs/561909fd6dd1f9d5b0867612f8f074c245fd394d01b988b79b87bd6659402dcc-customer_3.png" />

1. Click **Add payment method** in the **Customer details** section.
2. Select the billing provider that the payment will be added to.

<img src="https://mintcdn.com/stigg/vKl0Sj1YLcCT0yUv/images/docs/34716ec0978e2ed62396dd289b7e2bb3249ede9ea65cb3c87fc9d2d7b107d115-add_payment_method.png?fit=max&auto=format&n=vKl0Sj1YLcCT0yUv&q=85&s=03acef3e17edb0cf78aea8de7e50ec9d" alt="" width="527" height="394" data-path="images/docs/34716ec0978e2ed62396dd289b7e2bb3249ede9ea65cb3c87fc9d2d7b107d115-add_payment_method.png" />

3. Fill out the payment details and click **Add**.

<img src="https://mintcdn.com/stigg/fP4soQQ7PxwZeQ0V/images/docs/e5c868aaebfdddd7947d0ff6e6f6578420e4e73c79aa2d584913346e25496e20-Modal.png?fit=max&auto=format&n=fP4soQQ7PxwZeQ0V&q=85&s=f477af6d4bb0970b5ec41db94cfb559c" alt="" width="1056" height="1371" data-path="images/docs/e5c868aaebfdddd7947d0ff6e6f6578420e4e73c79aa2d584913346e25496e20-Modal.png" />

#### When creating a subscription

1. Go to **Customers**.
2. Select an existing customer.
3. Scroll down to the **Subscriptions** section.
4. Click **+Add**.
5. Enter the subscription details, for example: plan, add-ons, etc.
6. If the customer is already synced to a billing provider, the billing provider will be pre-selected. Otherwise, click the **Billing provider** dropdown menu.

<img src="https://mintcdn.com/stigg/zZAY_sXPTSVMcwio/images/docs/c3c72d3aa19af723cdbc48f5eaafde7a7ed69a7c0622d0181dfe20e18480d551-subscription_details_1.png?fit=max&auto=format&n=zZAY_sXPTSVMcwio&q=85&s=f7234e65a3aeae6f1534721faadc22e3" alt="" width="2880" height="3014" data-path="images/docs/c3c72d3aa19af723cdbc48f5eaafde7a7ed69a7c0622d0181dfe20e18480d551-subscription_details_1.png" />

7. Select the desired billing provider.
8. If the payment method for this billing provider exists, click **Create**. Otherwise, fill out the payment details, click **Add** and click **Create**.

### Using the Stigg API and SDKs

#### When updating customers

To associate a specific billing provider with a customer, pass the [integration ID](#integration-id) as `billingInformation.integrationId` when calling `updateCustomer`.

<CodeGroup>
  ```javascript Node.js theme={null}
  const customer = await stiggClient.updateCustomer({  
    customerId: 'customer-test-id',  

    // To force sync with a specific billing provider, include integrationId 
    // AND additional required billing parameters (e.g., payment method, address)
    billingInfo: {
      integrationId: 'integration-id',
      // Include required fields to complete billing sync
      paymentMethod: { /* ... */ },
      billingAddress: { /* ... */ }
    },  
  })
  ```

  ```python Python (Sidecar) theme={null}
  from stigg.generated import UpdateCustomerInput, BillingInfoInput

  resp = await stigg.api.update_customer(UpdateCustomerInput(
      customer_id='customer-test-id',
      billing_info=BillingInfoInput(
          integration_id='integration-id'
          # Add required fields to force sync
      )
  ))
  ```

  ```python Python theme={null}
  from stigg.generated.models import UpdateCustomerInput, BillingInformationInput

  data = await stigg.api.update_customer(UpdateCustomerInput(
      ref_id="customer-test-id",
      billing_information=BillingInformationInput(
          integration_id="integration-id"
          # Include other required fields here to force sync
      )
  ))
  ```

  ```ruby Ruby theme={null}
  resp = client.request(Stigg::Mutation::UpdateCustomer, {
    input: {
      customerId: "customer-test-id",
      billingInformation: {
        integrationId: "integration-id" # Include other required fields to force sync
      }
    }
  })
  ```

  ```go Go theme={null}
  result, err := client.UpdateCustomer(context.Background(), stigg.UpdateCustomerInput{
    CustomerID: Ptr("customer-test-id"),
    BillingInformation: &stigg.CustomerBillingInfo{
      IntegrationID: Ptr("integration-id"),
      // Include other required fields (e.g., payment method, billing address) to force sync
    },
  })
  ```

  ```java Java theme={null}
  var response = stigg.mutation(
      UpdateCustomerMutation.builder()
          .input(UpdateCustomerInput.builder()
              .customerId("customer-test-id")
              .billingInformation(CustomerBillingInfo.builder()
                  .integrationId("integration-id") // Include other fields to force sync
                  // .paymentMethod(...), .billingAddress(...)
                  .build()
              )
              .build()
          )
          .build()
  )
  ```

  ```csharp csharp theme={null}
  var response = await stigg.UpdateCustomer.ExecuteAsync(new UpdateCustomerInput()
  {
      CustomerId = "customer-test-id",
      BillingInformation = new CustomerBillingInfoInput()
      {
          IntegrationId = "integration-id"
          // Include other required fields to force sync (e.g., payment method, billing address)
      }
  })
  ```
</CodeGroup>

#### When provisioning subscriptions

To route the subscription to a specific billing provider, pass the [integration ID](#integration-id)of the relevant provider to `billingInformation.integrationId` when calling the [Provision Subscription](/api-and-sdks/api-reference/rest/subscriptions-create) endpoint.

<CodeGroup>
  ```javascript Node.js theme={null}
  const customer = await stiggClient.provisionSubscription({  
    customerId: 'customer-test-id',
    planId: 'plan-id',
    billingPeriod: 'MONTHLY',
    // To force sync with a specific billing provider, include integrationId 
    // AND additional required billing parameters (e.g., payment method, billing address)
    billingInfo: {
      integrationId: 'integration-id',
      paymentMethod: { /* ... */ },
      billingAddress: { /* ... */ }
    },  
  })
  ```

  ```python Python (Sidecar) theme={null}
  from stigg.generated import ProvisionSubscriptionInput, BillingPeriod

  resp = await stigg.api.provision_subscription(ProvisionSubscriptionInput(
      customer_id='customer-test-id',
      plan_id='plan-id',
      billing_period=BillingPeriod.MONTHLY,
      billing_information={
          "integrationId": "integration-id",
          # Include additional fields like payment_method and billing_address to force sync
      }
  ))
  ```

  ```python Python theme={null}
  from stigg.generated.models import ProvisionSubscriptionInput

  resp = await stigg.api.provision_subscription(ProvisionSubscriptionInput(
      customer_id="customer-test-id",
      plan_id="plan-id",
      billing_period="MONTHLY",
      billing_information={
          "integrationId": "integration-id",
          # Include additional fields like payment_method and billing_address to force sync
      }
  ))
  ```

  ```ruby Ruby theme={null}
  resp = client.request(Stigg::Mutation::ProvisionSubscription, {
    input: {
      customerId: "customer-test-id",
      planId: "plan-id",
      billingPeriod: "MONTHLY",
      billingInformation: {
        integrationId: "integration-id", # Include additional fields to force sync (e.g., paymentMethod, billingAddress)
      }
    }
  })
  ```

  ```java Java theme={null}
  var resp = stigg.mutation(
    ProvisionSubscriptionMutation.builder()
      .input(ProvisionSubscriptionInput.builder()
        .customerId("customer-test-id")
        .planId("plan-id")
        .billingPeriod(BillingPeriod.MONTHLY)
        .billingInformation(CustomerBillingInfo.builder()
          .integrationId("integration-id") // optional
          .build())
        .build())
      .build()
  )
  ```

  ```go Go theme={null}
  const customer = await stiggClient.provisionSubscription({  
    customerId: 'customer-test-id',
    planId: 'plan-id',
    billingPeriod: 'MONTHLY',
    billingInfo: {
      integrationId: 'integration-id'
    }
  })
  ```

  ```csharp csharp theme={null}
  var response = await stigg.ProvisionSubscription.ExecuteAsync(new ProvisionSubscriptionInput()
  {
      CustomerId = "customer-test-id",
      PlanId = "plan-id",
      BillingPeriod = BillingPeriod.Monthly,
      BillingInformation = new CustomerBillingInfoInput()
      {
          IntegrationId = "integration-id" // optional
      }
  })
  ```
</CodeGroup>

## Migrating customers and subscriptions between billing providers

Customers and subscriptions can currently only be synced to one billing provider at a time.

To migrate a customer and their subscriptions from Billing Provider A to Billing Provider B, follow the steps below:

<Steps>
  <Step title="Cancel existing subscriptions">
    Go to the **Customers** section and select the customer you want to migrate.

    In the **Subscriptions** panel, cancel each active subscription by clicking the three-dot menu and selecting **Cancel subscription**.

    Confirm when prompted.
  </Step>

  <Step title="Remove the current payment method">
    In the **Customer details** panel, locate the existing payment method and click the bin icon.

    Then click **Remove** to delete the billing configuration associated with Provider A.
  </Step>

  <Step title="Add a new payment method for Provider B">
    Click **Add payment method**.

    In the opened modal, select **Billing Provider B**.

    Fill in the payment details.

    Click **Add**.
  </Step>

  <Step title="Recreate the subscriptions">
    Scroll down to the **Subscriptions** section and click **+Add**.

    Select the original plan, set the **start date** to match the previously canceled subscription.

    Choose **Billing Provider B** from the dropdown.

    Click **Create** to finish.
  </Step>
</Steps>

<Note>
  This will create a backdated subscription in **Provider B**, ensuring that the customer is billed by **Provider B** starting from the next billing period.
</Note>

The procedure can also be executed programmatically using the Stigg API and SDKs.
