[GH-ISSUE #3616] lookupKey alone is not sufficient with Stripe integration, Price ID is required #9665

Closed
opened 2026-04-13 05:16:46 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @aniravi24 on GitHub (Jul 25, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3616

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Create a stripe subscription plan with only a lookupKey and name set. Try completing checkout of a subscription.

You will see the subscription is left in status incomplete, silently.

Current vs. Expected behavior

Current:

When completing checkout, the subscription will stay incomplete as the webhook is ignored.

When receiving the webhook, the internal getPlanByPriceId assumes a price id always exists instead of falling back to the lookup key.

Expected:

PriceId/lookupKey translation occurs properly when receiving webhooks. That or the documentation needs to be updated indicating priceId is always required.

What version of Better Auth are you using?

1.3.3

Provide environment information

- OS: Linux
- Browser: Chrome

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

export const auth = betterAuth({
  plugins: [
    stripe({
      createCustomerOnSignUp: true,
      stripeClient,
      stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
      subscription: {
        enabled: true,
        plans: [
          {
            lookupKey: 'something-premium',
            name: 'things premium',
          },
        ],
      },
    }),
  ],
});

Additional context

No response

Originally created by @aniravi24 on GitHub (Jul 25, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3616 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Create a stripe subscription plan with only a `lookupKey` and `name` set. Try completing checkout of a subscription. You will see the subscription is left in status `incomplete`, silently. ### Current vs. Expected behavior Current: When completing checkout, the subscription will stay incomplete as the webhook is ignored. When receiving the webhook, the internal `getPlanByPriceId` assumes a price id always exists instead of falling back to the lookup key. Expected: `PriceId`/`lookupKey` translation occurs properly when receiving webhooks. That or the [documentation](https://www.better-auth.com/docs/plugins/stripe#plan-configuration) needs to be updated indicating `priceId` is always required. ### What version of Better Auth are you using? 1.3.3 ### Provide environment information ```bash - OS: Linux - Browser: Chrome ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript export const auth = betterAuth({ plugins: [ stripe({ createCustomerOnSignUp: true, stripeClient, stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET, subscription: { enabled: true, plans: [ { lookupKey: 'something-premium', name: 'things premium', }, ], }, }), ], }); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 05:16:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 25, 2025):

You're correct—right now, Better Auth v1.3.3 requires a priceId for Stripe plan identification in webhooks. The current implementation does not fall back to lookupKey, so if you define plans using only lookupKey, the subscription will remain incomplete and the webhook will be ignored. This is a known limitation and doesn't match the intended behavior described in the docs, which suggest lookupKey should be a valid alternative to priceId.

A fix is already in progress: PR #3351 adds logic to resolve lookupKey to priceId during webhook handling, but it's not yet released in v1.3.3. Until that lands in a release, the only reliable workaround is to include priceId in your plan definitions. If that's not possible, you'd need to patch your local code to resolve lookupKey to priceId before plan lookup in the Stripe plugin files.

You can follow the progress on that PR or keep an eye on the changelog for when the fix is released. Once it's merged and published, plans defined with only lookupKey should work as expected in webhooks.
Reference

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3119976914 --> @dosubot[bot] commented on GitHub (Jul 25, 2025): <!-- Answer --> You're correct—right now, Better Auth v1.3.3 requires a priceId for Stripe plan identification in webhooks. The current implementation does not fall back to lookupKey, so if you define plans using only lookupKey, the subscription will remain incomplete and the webhook will be ignored. This is a known limitation and doesn't match the intended behavior described in the docs, which suggest lookupKey should be a valid alternative to priceId. A fix is already in progress: [PR #3351](https://github.com/better-auth/better-auth/pull/3351) adds logic to resolve lookupKey to priceId during webhook handling, but it's not yet released in v1.3.3. Until that lands in a release, the only reliable workaround is to include priceId in your plan definitions. If that's not possible, you'd need to patch your local code to resolve lookupKey to priceId before plan lookup in the Stripe plugin files. You can follow the progress on that PR or keep an eye on the changelog for when the fix is released. Once it's merged and published, plans defined with only lookupKey should work as expected in webhooks. [Reference](https://github.com/better-auth/better-auth/issues/3537) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d5f98ebd-c823-4063-9a27-1a07839a006e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/3616)
Author
Owner

@aniravi24 commented on GitHub (Jul 25, 2025):

Whoops this is a duplicate, sorry!

<!-- gh-comment-id:3120021787 --> @aniravi24 commented on GitHub (Jul 25, 2025): Whoops this is a duplicate, sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9665