DurkoMatko
DurkoMatko

Reputation: 5834

Make email in Stripe Checkout for already existing customer read-only

I'm creating a Stripe checkout session (server-side) for already existing customer. According to Stripe documentation, I should pass customer Id as a customer parameter. Stripe internally gets the customer object and fills his email addess in the checkout UI. It works, but the email field is editable and I don't want users to be able to change their billing email. Is it possible to make this field read-only? Here my code:

await stripe.checkout.sessions.create({
     line_items: [{ price: stripePriceId, quantity: 1 }],
     customer: stripeCustomerId,  // here I fill the stripe customer ID of the user
     mode: 'subscription',
     payment_method_types: ['card'],
     allow_promotion_codes: true,
     success_url: `${process.env.FRONTEND_URL}/premium-payment-success`,
     cancel_url: `${process.env.FRONTEND_URL}/premium-payment-failure`
});

I'd really like to prevent users changing their Stripe checkout email, because knowing each user has the same billing email in Stripe would make things much easier.

Side note: When the user buys something for the first time, instead of customer parameter, I pass customer_email and the email is in this scenario read-only.

Any help is appreciated!

Upvotes: 4

Views: 643

Answers (1)

Justin Michael
Justin Michael

Reputation: 6475

This is not currently possible, but I believe it's something Stripe is considering adding.

Upvotes: 4

Related Questions