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

# Connect Stripe or Chargebee billing

> Configure the billing provider an eligible reseller or partner uses to bill downstream customers.

Billing-provider configuration is an optional reseller and partner capability. It connects a Stripe or Chargebee account to Vida so downstream customer subscriptions, plan changes, renewals, and usage charges can be managed through that provider. It is not needed for an ordinary organization that does not bill downstream customers.

Start with the provider setup guide:

* [Stripe Billing Integration](/docs/billing/stripe)
* [Chargebee Billing Integration](/docs/billing/chargebee)

## Confirm the owning account

Read `GET /api/v2/account?targetAccountId=...` and confirm that the selected account is the eligible reseller or partner that should own the billing connection. Use that account ID as `targetAccountId` on both configuration operations.

An administrator can select only an account within their authorized hierarchy. A `403` response means the requester or selected account is not eligible for this capability.

## Read the current provider

```bash theme={null}
curl -s \
  "$VIDA_API_BASE_URL/api/v2/billing/billingSystemConfig?token=$VIDA_API_KEY&targetAccountId=$TARGET_ACCOUNT_ID"
```

A configured account returns the provider type and redacted credential values. These values confirm which fields are present, but they are display-only and cannot be submitted in an update. A `404` response means no provider has been configured for the selected account.

## Configure Stripe

Create `billing-provider.json` with the complete Stripe configuration:

```json theme={null}
{
  "billingSystemType": "stripe",
  "apiKey": "<stripe-secret-key>",
  "publishableKey": "<stripe-publishable-key>",
  "webhookSigningKey": "<stripe-webhook-signing-secret>"
}
```

## Configure Chargebee

Create `billing-provider.json` with the complete Chargebee configuration:

```json theme={null}
{
  "billingSystemType": "chargebee",
  "apiKey": "<chargebee-api-key>",
  "publishableKey": "<chargebee-publishable-key>",
  "site": "acme",
  "webhookUsername": "<chargebee-webhook-username>",
  "webhookPassword": "<chargebee-webhook-password>"
}
```

`site` is the Chargebee subdomain only. For `https://acme.chargebee.com`, use `acme`.

## Store and verify the provider

```bash theme={null}
curl -s -X POST \
  "$VIDA_API_BASE_URL/api/v2/billing/billingSystemConfig?token=$VIDA_API_KEY&targetAccountId=$TARGET_ACCOUNT_ID" \
  -H 'content-type: application/json' \
  --data-binary @billing-provider.json
```

Each POST replaces the complete provider configuration. Supply every required field from the provider when changing a connection; do not combine new values with redacted values from the read response.

After a successful write:

1. Read the configuration again and confirm the expected `billingSystemType` and redacted fields are present.
2. Confirm the provider webhook uses the exact reseller or partner account ID from the setup guide.
3. Confirm each customer-facing Vida plan is mapped to the intended provider product and price.
4. Run a representative low-risk checkout with the configured provider before onboarding customers.
5. Verify the resulting customer and subscription in both the provider and Vida.

A successful configuration response proves that Vida stored the supplied values. The read-back and representative checkout prove that the complete billing workflow is connected correctly.
