Skip to content

Troubleshooting

Common integration failures and fixes.

Which generation am I on?

BillStack has a provider-neutral v2 generation and a Stripe-first legacy (v1) one. Look at the URL to tell which you are using:

You seeGeneration
/v2/{team}/... in the dashboardv2
/dashboard/{team}/... in the dashboardLegacy
/api/billstack/v2/... in an API call, BillStackV2Client or @billstack/sdk/v2v2
/api/billstack/teams/{teamId}/projects/{projectId}/... in an API call, BillStackClient or @billstack/sdk/legacyLegacy
An MCP tool whose description starts with v2: or Legacy:That generation

The two generations have separate envelopes, identifiers and data, so do not mix them in one flow. Use the user menu in the dashboard to switch between the dashboards. Documentation pages with a legacy- slug describe the legacy generation.

No matching active price found (legacy checkout)

The requested tier and cycle do not resolve to an active project price. This applies to the legacy checkout/start route, which resolves prices by tier alias.

Check:

  • The project has a price for that tier alias.
  • The price is active.
  • The interval or billing scheme matches the requested cycle.
  • Lifetime checkout uses tier=lifetime&cycle=once.

Razorpay checkout errors

startProjectCheckout (the v1 checkout, which serves the team's default region only) throws these errors when the default region is on Razorpay. There is no fallback to Stripe: an unconfigured Razorpay project fails the checkout (see Provider selection):

ErrorCauseFix
Razorpay is not configured for this projectNo provider config row, or isActive is false.PUT a provider config with provider: "razorpay" and isActive: true via /projects/{projectId}/providers.
Razorpay key id is missingProvider config exists but has no publishableKey (the keyId field on the PUT body).Re-submit the provider config with keyId set.
Razorpay key secret is missingProvider config exists but has no encrypted secret.Re-submit the provider config with secret set.
Razorpay plan id is not configured for {tier}_{cycle}Recurring checkout requested a {tier}_{cycle} key (e.g. pro_monthly) with no matching entry in metadata.razorpayPlanIds.Add the missing key to metadata.razorpayPlanIds on the provider config.
Razorpay amount is not configured for {tier}_{cycle}One-time/lifetime checkout requested a {tier}_{cycle} key (e.g. lifetime_once) with no matching entry in metadata.razorpayAmounts.Add the missing key to metadata.razorpayAmounts on the provider config.

See Migrate from Razorpay for the full provider config shape and the {tier}_{cycle} key format.

Test and live environment errors

Code or statusCauseFix
LIVE_ENVIRONMENT_NOT_ENABLED (403)A live key (bs_live_, pk_live_) for a team that has not been promoted to live.Use a bs_test_ key, or promote the team to live in the dashboard first.
ENVIRONMENT_MISMATCH (403)A v2 mode that differs from the key's environment, for example mode: "live" with a bs_test_ key, or mode: "test" with a bs_live_ key.Omit mode (the key's environment is used) or use a key of the matching environment.
LIVEMODE_MISMATCH (400) on a webhookA Stripe event was delivered to the wrong URL: a test-mode event to /api/webhooks/stripe/{teamId} or a live-mode event to .../test.Register the endpoint in each Stripe mode at its own URL; see Providers and webhooks.
KEY_MODE_MISMATCH (400)A sk_live_ key in the Test keys slot, or a sk_test_ key in the Live keys slot.Put each key in the slot of its mode.
PAYMENT_PROVIDER_CONFLICT (400)A provider was sent that differs from the default region's provider, or a Stripe-only action was attempted on a single-region Razorpay team (for example a public payment link).Use the default payment provider, or use the v2 checkout to sell through another region. The default provider can only be changed while the team has no credentials or billing data for it.
LIVE_TEAM_LIMIT (failed check in the Promote to live dialog)The team owner is on the free plan, which includes 1 live team, and already owns a live team.Keep building in test, or contact support to raise the live team limit. Teams that are already live and re-syncing a live team are never blocked.

Region and country routing errors

Regions and country routing are v2 only. Concepts: Regions. The full lists are under Region and routing errors and Region errors.

CodeCauseFix
PROVIDER_UNAVAILABLE (409)The region that serves the customer cannot take payments (connection disconnected or disabled, no keys for the environment). Checkout is never re-routed to another provider.Fix the connection, or deactivate the region on purpose to send its countries to the default region.
PRICE_UNAVAILABLE_IN_REGION (422)The customer's region has no verified price link for the variant (Razorpay sells INR only). The country token is not spent.Send a variant the region can sell, or link the missing price.
REGION_REQUIRES_V2 (409)The customer is pinned to a non-default region and used the v1 checkout.Use the v2 checkout.
FEATURE_UNAVAILABLE_IN_REGION (409)A Stripe-only feature (public payment links, referral credit payouts, v1 Stripe cancel or resume) for a Razorpay customer in a team with more than one region.Not available for that customer.
COUNTRY_TOKEN_REQUIRED (400)A live key sent no signed country confirmation. Only test keys may send an unsigned country.Call confirmCountry and send its result as countryConfirmation.
COUNTRY_TOKEN_CUSTOMER_REQUIRED / COUNTRY_TOKEN_CUSTOMER_MISMATCH (400)customerExternalId is missing, or differs from the customer the confirmation was issued for.Send the same customerExternalId to confirmCountry and to checkout.
COUNTRY_TOKEN_INVALID / COUNTRY_TOKEN_EXPIRED (400)The confirmation is malformed, was minted before the server upgrade, or is older than one hour.Mint a new confirmation.
COUNTRY_TOKEN_ALREADY_USED (409)The confirmation already paid for another checkout.Mint a new confirmation for every checkout attempt.
CUSTOMER_PROVIDER_ACCOUNT_AMBIGUOUS (409)The v2 portal was requested for an unpinned customer with accounts at more than one provider.Send provider or regionId.
CONNECTION_ALREADY_EXISTS (409)The team already has an account for that payment provider (one per provider).Use a separate team for a second account of the same provider.

The public payment-link endpoint found a price but no payment_link_url metadata. (Internally tracked as PAYMENT_LINK_NOT_FOUND; the API response returns only the message string, not a code field.)

Fix this in BillStack by editing the price and adding the Stripe Payment Link URL.

Customer not found for portal

The customer portal endpoint requires an existing project customer for the externalId.

Create checkout first or show an upgrade CTA. Do not open a portal for users who have never touched billing.

Referral checkout loses attribution

This happens when a logged-out referred user is sent directly to an anonymous payment link.

Route referral visitors through signup/login, apply the referral by external ID, then call logged-in checkout.

Entitlement still shows free after payment

Check:

  • Provider webhook is configured to point to BillStack.
  • BillStack received the event.
  • The checkout used the correct project and external ID.
  • Your app refreshed the entitlement after checkout success.
  • Your local entitlement cache is not stale.

Product app still needs provider secrets

After cutover, provider secrets should not be required by the product app for billing.

If the app still reads provider secrets at runtime, find the remaining direct provider code path and replace it with BillStack API calls.

Public endpoint returns unauthorized

Use a publishable key on public endpoints:

Authorization: Bearer <publishable-key>

or:

?pk=<publishable-key>

Private keys are also accepted on some public-link endpoints, but browser code should use publishable keys only.