#koks_api
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/1390351482343395469
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
hi
hey there, if you want only google pay to display (when supported) you can force the other wallet types to be disabled when you initialize the express checkout element by setting each to 'never':
https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-paymentMethods
eg:
elements.create("expressCheckout", {
paymentMethods: {
klarna: 'never'
}
});
Can you check my second question " Do i need to create Payment Intent for this use case? Is it even supported."
The express checkout element is initialized without a payment intent, but you do need one to complete payment
yes, during my test payment is not getting completed
getting message as timeout
how to handle payment intent for express checkout scenario
This guide explains collection payment with express checkout element in an advanced integration (with payment intents): https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#create-pi
Please make sure you're implemented all the non-optional steps there
this is roughly:
1/ initialize stripe.js & ECE
2/ listen to the confirm event and call your server to create a payment intent
3/ confirm the payment intent
ok thanks, let me check and come back if needed
how to listen to the confirm event?
Done with Step (1). How to listen to Confirm Event/
Hi there, stepping in as synthrider needs to step away.
ok
Did you take a look at the shared docs?
Yes
There is a code snippet in step 7 for how to use the onConfirm Event: https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#submit-the-payment
ok, I'm new to stripe and not very familiar with JS as well. Where i need to place confirm event?
Is it a separate function or within ECE mount section?
Sorry, we can't write your code for you and it would depend a lot on your own integration/architecture for where you should put it.
Overall it is a separate function, though I'm not sure what you mean by "within ECE mount section".
Gotcha then yes you can put the confrim handler within that function.
You'll need to add logs throughout your code to see what is happening
Also is there a reason you are creating a Confirmation Token here?
All you need is the client secret from the PaymentIntent that you create server-side.
i just used the same js what you shared
No the JS I shared from the docs is:
expressCheckoutElement.on('confirm', async (event) => {
const {error: submitError} = await elements.submit();
if (submitError) {
handleError(submitError);
return;
}
// Create the PaymentIntent and obtain clientSecret
const res = await fetch('/create-intent', {
method: 'POST',
});
const {client_secret: clientSecret} = await res.json();
const {error} = await stripe.confirmPayment({
// `elements` instance used to create the Express Checkout Element
elements,
// `clientSecret` from the created PaymentIntent
clientSecret,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
});
if (error) {
// This point is only reached if there's an immediate error when
// confirming the payment. Show the error to your customer (for example, payment details incomplete)
handleError(error);
} else {
// The payment UI automatically closes with a success animation.
// Your customer is redirected to your `return_url`.
}
});
So I'd try that instead and log out your clientSecret after calling your backend
You use console.log()