toeverything/AFFiNE · error · InvalidCheckoutParameters

invalid_checkout_parameters

invalid_checkout_parameters

Error message

Invalid checkout parameters provided.

What it means

An InvalidCheckoutParameters sentinel at the start of user subscription checkout: it fires when lookupKey names a plan other than Pro or AI, or when lookupKey.variant is non-null. These are the only individually purchasable user plans, so any other plan/variant combination is rejected before subscription or Stripe calls are made; the faulting input is the lookupKey passed to checkout.

Source

Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:99

      if (await this.isPriceAvailable(price)) {
        availablePrices.push(price);
      }
    }

    return availablePrices;
  }

  async checkout(
    lookupKey: LookupKey,
    params: z.infer<typeof CheckoutParams>,
    { user }: z.infer<typeof UserSubscriptionCheckoutArgs>
  ) {
    if (
      (lookupKey.plan !== SubscriptionPlan.Pro &&
        lookupKey.plan !== SubscriptionPlan.AI) ||
      lookupKey.variant !== null
    ) {
      throw new InvalidCheckoutParameters();
    }

    const active = await this.getVisibleSubscription({
      plan: lookupKey.plan,
      userId: user.id,
    });
    await this.assertNoActiveLocalEntitlement(user.id, lookupKey);
    if (active?.provider === 'revenuecat') {
      throw new ManagedByAppStoreOrPlay();
    }

    if (
      active &&
      !this.canCheckoutWithExistingSubscription(active.recurring, lookupKey)
    ) {
      throw new SubscriptionAlreadyExists({ plan: lookupKey.plan });
    }

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Provide a valid plan and recurring interval in the checkout request.
  2. Remove unsupported parameters and ensure required fields are present.
  3. Compare the request payload against the checkout API schema and fix mismatches.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/payment/manager/user.ts:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/f479820b9278dc0a. Report an issue: GitHub.