Skip to content

Add params passthrough to createCheckoutSession#27

Open
advaitpaliwal wants to merge 1 commit intoget-convex:masterfrom
advaitpaliwal:feat/flexible-checkout-sessions
Open

Add params passthrough to createCheckoutSession#27
advaitpaliwal wants to merge 1 commit intoget-convex:masterfrom
advaitpaliwal:feat/flexible-checkout-sessions

Conversation

@advaitpaliwal
Copy link
Contributor

Summary

  • createCheckoutSession previously only exposed a fixed set of Stripe Checkout parameters, forcing users to bypass the component entirely for common needs
  • Adds an optional params field that accepts any Stripe.Checkout.SessionCreateParams and merges them into the session config
  • mode is excluded from overrides to prevent inconsistency with the component's internal routing
  • Fully backward compatible — existing code works unchanged

Use cases unlocked

// Promotion codes
await stripeClient.createCheckoutSession(ctx, {
  priceId: "price_...",
  mode: "subscription",
  successUrl: "...",
  cancelUrl: "...",
  params: {
    allow_promotion_codes: true,
  },
});

// Multiple line items
await stripeClient.createCheckoutSession(ctx, {
  priceId: "price_...",
  mode: "payment",
  successUrl: "...",
  cancelUrl: "...",
  params: {
    line_items: [
      { price: "price_basic", quantity: 1 },
      { price: "price_addon", quantity: 2 },
    ],
  },
});

// Billing address + custom fields
await stripeClient.createCheckoutSession(ctx, {
  priceId: "price_...",
  mode: "payment",
  successUrl: "...",
  cancelUrl: "...",
  params: {
    billing_address_collection: "required",
    phone_number_collection: { enabled: true },
  },
});

Test plan

  • Verify existing createCheckoutSession calls without params work unchanged
  • Verify params values override constructed defaults (e.g. custom line_items)
  • Verify mode cannot be overridden via params
  • Verify allow_promotion_codes, billing_address_collection, and other Stripe params work when passed

🤖 Generated with Claude Code

createCheckoutSession previously only exposed a fixed set of Stripe
Checkout parameters, forcing users to bypass the component and call
the Stripe SDK directly for common needs like promotion codes, billing
address collection, shipping, custom fields, or multiple line items.

Adds an optional `params` field that accepts any
Stripe.Checkout.SessionCreateParams and merges them into the session
config. The `mode` field is excluded from overrides to prevent
inconsistency with the component's internal routing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant