#clement78710
1 messages · Page 1 of 1 (latest)
Hi there 👋 can you tell me more about the integration path that you're planning to leverage? Are you building your own UI/flow for this, or (since you're asking about shipping_options) are you planning to use Checkout Sessions?
I'm pretty sure, this wouldn't be supported by Checkout, as that flow doesn't allow dynamic shipping rates that are based on customer address details. You're correct that those options are all displayed and a customer is allowed to select which one they'd like to use.
Thx for that fast awnser,
Yes, i'm Using a checkout API call in Node.js with these informations :
const session = await stripe.checkout.sessions.create({
submit_type: "pay",
mode: "payment",
payment_method_types: ['card'],
line_items: lineItems,
discounts: isValidCouponCode
? [
{
coupon: couponCode,
},
]
:[],
phone_number_collection: {
enabled: true,
},
shipping_address_collection: {
allowed_countries: ['FR']
},
shipping_options: [
{
shipping_rate_data: {
type: 'fixed_amount',
fixed_amount: {
amount: 0,
currency: 'EUR',
},
display_name: 'Livraison France métropolitaine',
},
},
{
shipping_rate_data: {
type: 'fixed_amount',
fixed_amount: {
amount: 1500,
currency: 'EUR',
},
display_name: 'Livraison Internationale',
},
},
],
billing_address_collection: "auto",
success_url: `${origin}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${origin}/cart`
})
Their is maybe an other way to do something like that ?
It's possible, but I don't think it would be the smoothest flow if you tried to keep using Checkout. You could restrict the Shipping Rates you provide when creating the Checkout Session, but in order to do that well you would have to already know the customer's shipping address which means you would have already needed to collect that somehow.
Yeah I understand I don’t collect the address before the checkout. Maybe I can use the geolocation to know if the device is in France or no
That's one option, but I'd be concerned with how likely it is that you'll have someone buying from their computer/phone in France, but ask you to ship outside of the country.