#tomrider_code
1 messages ¡ Page 1 of 1 (latest)
đ 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/1344661859252437002
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
I'm not sure I understand the flow here, sorry
We would like to display express payment buttons (Apple Pay and Google Pay) on our product details page. When someone clicks on one of these buttons, we would like initiate a checkout session on the backend side and then continue with the selected express payment. Is it possible using the Express Checkout Element?
Why not simply using Express Checkout Elements and accept the payment ?
I tried to use the Express Checkout Elements, but I don't know how to initiate the checkout session on backend side when someone click e.g. the Google Pay button
Why you need to use Checkout Session ?
Express Checkout Elements is using Intents to accept payments
so no need for Checkout Session
I don't need Checkout Session. I can use Intents but still I probably have to create the Intent before continue with the express payment?
I would like to create an Intent when a user wants to buy this product by clicking on Google Pay
I don't want to create intent every time a user sees a product but only if he want purchase
I can use Intents but still I probably have to create the Intent before continue with the express payment?
Yes you can using Confirmation Tokens:
https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#create-ct
And here the full guide:
https://docs.stripe.com/payments/build-a-two-step-confirmation
Okey, so the express payment should look as follow:
- init stripe with amount and currency of displayed product
- the main logic should be handled in the
onConfirmcallback from ExpressCheckoutElement after user accept payment - create Confirmation Token in Stripe
- create Intent on backed side using the Confirmation Token and return
clientSecretto frontend - use
clientSecretto accept payment on frontend side
You can choose whether you want to confirm client side or server side
if you want to confirm client side, you don't need the confirmation town unless you want to split your flow into two steps (provide details, review & confirm order summary eg).
If you want to just complete the payment when th customer completes the wallet payment interface, you can get the payment intent client secret from your server in the confirm handler and use it to call stripe.confirmPayment() -- no need for the confirmation token.
I want to confirm the payment on the server side and add business logic that this product has been purchased. As I understand, the business logic should be implemented while creating the Intent on server side with provided Confirmation Token from client. At the end, I should confirmPayment on client side using the clientSecret from server
I want to confirm the payment on the server side
you can do that, but then you wouldnt using stripe.confirmPayment or the client secret
If you want to confirm on your server with some business logic, thats fine, then you do want to use the createConfirmationToken flow, and you pass that confirmation token to your server and use it to confirm the payment server side
no need to pass the client secret back to the client unless its needs eg to complete 3DS authentication
Okey, so the code from documentation await stripe.confirmPayment is not necessary using Confirmation Tokens? https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#create-ct