#kyle_heat_engineer
1 messages · Page 1 of 1 (latest)
export const createCheckoutSession = async (
customerId: string,
priceId: string[],
mode: string,
currency: 'gbp' | 'eur',
locale: Language
) => {
const line_items = (
await stripeClient.prices.list({
lookup_keys: priceId,
})
).data.map((price) => ({ price: price.id, quantity: 1 }));
const session = await stripeClient.checkout.sessions.create({
customer: customerId,
payment_method_types: ['card'],
line_items,
mode: mode as any,
success_url: `${process.env.WEB_APP_ROOT_URL}/payment/success`,
cancel_url: `${process.env.WEB_APP_ROOT_URL}/payment/failed`,
billing_address_collection: 'required',
automatic_tax: { enabled: true },
customer_update: {
address: 'auto',
},
currency,
locale,
});
return session;
};
I was not aware that that could happen with Checkout
Thank you, taking a look
Oh I think we show the Customer's default payment method in subscription mode
Will see if that can be disabled.
Is the user still able to edit the card field in Checkout?
Yeah your right. If we could disable it that would be really useful.
Unfortunately I am not seeing a way to do that at the moment. As a workaround, you may be able to unset their default payment to null and then create the checkout session https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.