#Mike-7189-cors
1 messages ยท Page 1 of 1 (latest)
Hi ๐
@viral beacon could you share the exact code you're using to create the CheckoutSession and redirect to it?
one moment
Backend
Frontend (if it even matters)
currently trying to do with dummy data
yeah you can't redirect from an XHR like that
you need to either :
-
change the frontend to be a simple
<form action="create_checkout_sessionthat does a full page redirect (then the backend code works as-is) -
change the backend to return for example a 200 status instead with e.g JSON object that contains the URL, and then on the frontend, set
window.location = urlto redirect that way
alright, lemme try
yay it worked!
where do you I place product_id?
and which of these?
instead of price_data you'd put price:"price_xxx",
you don't need the product ID itself ,just the Price
Missing required param: line_items[0][currency].
you shouldn't get that error(my guess is you passed a variable for the price ID and it's null)
can you share the code?
yeah, variable is undefined
Alright, sorted it out ๐
Now some more questions:
How do I set more payment methods?
Like in docs they have google pay, apple pay and maybe some other stuff, but my checkout shows only card as an available payment method
like here: offers some different methods
and mine is just card
or if I have other questions, shall I ask in #dev-help channel so the new thread will be created? Or can we carry on in this one?
here is fine
Apple/Google Pay should just appear, if you're in a browser that supports them and that has active cards available, like you're logged into Chrome with your Google account and have Google Pay cards in your account
other payment methods are controlled by what you pass to payment_method_types when creating the Session object, basically
for completeness you might also have them turned off at https://dashboard.stripe.com/settings/checkout
though that's rare
I also need to limit list of countries for shipping, collect shipping addresses and let customers to choose the quantity (can't be higher than exists in my database)
that's good ๐ I don't mind having them. The more ways to pay the higher the chances to actually get paid ๐
I also need to limit list of countries for shipping, collect shipping addresses
https://stripe.com/docs/payments/checkout/shipping
and let customers to choose the quantity
https://stripe.com/docs/payments/checkout/adjustable-quantity
shipping_rates: ['shr_123456789'],
shipping_address_collection: {
allowed_countries: ['US', 'CA'],
},
what's this shipping_rates and where can I find the list of allowed_countries? so I don't mess with acronyms
oh sorry, I found it ๐
yep, should be covered in that link
can I get some extra shipping details? Such as phone number