#danboyle8637_api

1 messages ¡ Page 1 of 1 (latest)

turbid crescentBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1451678310311657689

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

twin wyvern
buoyant bear
#

let me just confirm my code to be 100%...

#

that is correct ui_mode: "custom", and that is the correct property

#

or event

twin wyvern
#

have you tried confirming the checkout (even though it's telling you that you can't)? trying to nail down whether the issue is with the event listener or with the checkout session itself

buoyant bear
#

no would this be using checkoutSession.confirm() ?

#

Where would I run that... I can't do it on form submit. So I don't really know when to call that

#

I console.log my session from the change event and everything is correct in terms of the price and product but the canConfirm is false.

twin wyvern
#

Where would I run that... I can't do it on form submit. So I don't really know when to call that

you would set up a function in your client side code (called by your "Pay" button or similar). are you following a particular guide on how to implement this?

buoyant bear
#

I followed the Stripe API docs. I have my checkout button disabled until the canConfirm is true... that way they can't accidentally tap the purchase button. But I guess I have to just test the confirm without that protection for now. Let me try that.

twin wyvern
#

yeah, I just want to see if it throws a particularly informative error that might tell you what data it thinks is missing

buoyant bear
#

okay I got an error with save payement options. That must be it. Thank you... I"ll play around and see if that works and if I bump into something I'll create a new ticket.

#

I know where I have to fix my code... I appreciate the help. it's good to know that is a way to get better error messages

twin wyvern
#

glad I could help! if you have further problems you'll be able to reply here in this thread for the next half hour or so

buoyant bear
#

okay... cool thanks

#

I do have a question. So I go like this... checkoutSession.confirm({ savePaymentMethod: savePaymentMethod }) because I have a toggle in my checkout form. But my error now indicates that I need to include saved_payment_method_options[payment_method_save]=enabled which I just did to test it. And then I get an error that I need a customer to enable save payment method. So would I just add customer_creation: "always", to my options when I create my client secret?

#

of I guess it's not if_required

twin wyvern
#

one sec while I look that up...

buoyant bear
#

i guess it's NOW if_required... sorry I just want to confirm and I can't type apparently

twin wyvern
#

I think you do need to either provide a pre-existing customer or enable customer creation to always to use that setting. can you try it and see? if not I can give it a try but it might take me a bit

buoyant bear
#

okay yeah... I just test it real fast

twin wyvern
#

just tried it and yes, setting customer_creation to always allowed the Checkout Session to be created. you can also provide a pre-existing customer ID in the customer field

buoyant bear
#

yeah I have the option to use a pre-existing customer already... have not tested that scenario yet. But I did get past that error only to find a new one... yay... haha... this one is easy though.

#

If you don't hear from me in the next 10 minutes... thank you again for all this help!