Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions supabase/functions/billing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ Deno.serve(async (req) => {
const session = await stripe.checkout.sessions.create({
customer: customerId,
mode: "subscription",
// Force English. Stripe's "auto" locale combines Accept-Language with
// IP geolocation, which served a zh checkout even on English browsers.
// Our UI is English-only, so the checkout should match.
locale: "en",
line_items: [{ price: priceId, quantity: 1 }],
success_url: `${frontendUrl}/settings?checkout=success`,
cancel_url: `${frontendUrl}/settings?checkout=canceled`,
Expand All @@ -137,6 +141,10 @@ Deno.serve(async (req) => {
const session = await stripe.billingPortal.sessions.create({
customer: profile.stripe_customer_id,
return_url: `${frontendUrl}/settings`,
// Same reason as checkout above. Note this also overrides the
// Billing Portal configuration's default language set in the Stripe
// Dashboard, which would otherwise win over Accept-Language.
locale: "en",
})

return jsonResponse({ url: session.url }, req, { status: 200 })
Expand Down
Loading