#dawid_error
1 messages ยท Page 1 of 1 (latest)
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.
- dawid_api, 6 days ago, 19 messages
๐ 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/1239881376178634843
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Succeeded one pi_3PGI5iLgTfxsYzuG0BTW03rC
But for failed ones we don't have PI yet
Are you able to find an example intent that that failed? Without that I can't find the root error
We actually create PI after whole payment process so we don't have ones
Any of this can help?
Can you share your ECE code
It's Id from above?
No, the code you use to initialise the ECE and handle the confirm/click events that result in the error
Not sure I understand
We initialize it like this
payment.stripe.instance.elements({
mode: 'payment',
locale: 'en',
currency: checkout.summary.totalPrice.currency.toLowerCase(),
paymentMethodTypes,
amount: formatStripeAmount(checkout.summary.totalPrice),
appearance,
loader: 'never',
fonts: getFonts(theme),
})
...
const element = paymentElements.create('expressCheckout', {
buttonHeight: 44,
buttonTheme: {
applePay: buttonColor,
googlePay: buttonColor,
},
buttonType: {
applePay: 'plain',
googlePay: 'plain',
},
layout: {
maxColumns: 0,
maxRows: 0,
overflow: 'never',
},
wallets: {
applePay: 'always',
googlePay: 'always',
},
})
expressCheckoutElement.on('confirm', handleConfirm)
The error is before modal confirm so we basically never initialize payments on our backend
OK, and what does handleConfirm function look like?
But we never reach this point for failed cases
But simplified version of this fn is
const handleConfirm = (event) => {
updatePaymentMutation.mutate(
{
....
},
{
onSuccess: async (data) => {
const paymentData = getPaymentData(data)
const paymentIntentResponse = await payment.stripe.instance?.confirmPayment({
elements: paymentElements,
clientSecret: paymentData.paymentId,
confirmParams: {
return_url: window.location.href,
shipping: getShippingDetails(paymentData),
payment_method_data: {
billing_details: getBillingDetails(paymentData),
},
},
redirect: 'if_required',
})
navigate(reverse(routes.checkout, { checkoutId, stepId: 'payment' }))
},
onError: (error) => {
cancelPaymentMutation.mutate()
event.paymentFailed()
handlePaymentError(error, false)
},
})};
OK, so which code is it that triggers the Amazon error you say? It must be on the click of the button, right? So a click handler? https://docs.stripe.com/js/elements_object/express_checkout_element_click_event
const handleClick = (event) => {
addExpressCheckoutInfoMutation.mutate({
displayedExpressMethods: displayedPaymentMethods || [],
selectedExpressMethod: event.expressPaymentType,
})
// @ts-ignore this is not typed in @types/stripe-v3
paymentElements?.update({
setupFutureUsage: getSetupFutureUsage(event.expressPaymentType),
currency: checkout?.summary?.totalPrice
? checkout?.summary?.totalPrice.currency.toLowerCase()
: undefined,
amount: checkout?.summary?.totalPrice
? formatStripeAmount(checkout.summary.totalPrice)
: undefined,
})
event.resolve({
allowedShippingCountries: countryOptions
.filter(({ disabled }) => !disabled)
.filter(({ value }) => !notSupportedExpressCheckoutCountries.includes(value))
.map(({ value }) => value),
billingAddressRequired: true,
emailRequired: true,
phoneNumberRequired: true,
shippingAddressRequired: true,
business: {
name: shopSettings?.checkout?.shop?.creatorName || '',
},
lineItems: getExpressLineItems(checkout),
shippingRates: getExpressShippingRates(checkout),
})
}
Are there any errors in the browser console?
The screenshot implies there should be an error response somewhere, I'd expect that to be in the console/network tab
My guess is that one of the parameters in the event.resolve of your click handler are invalid. Maybe business[name] can't be an empty string or something? Hard to say without seeing the actual JSON payload
Let me try to check actually json
I see nothing in console
can you open a support ticket at https://support.stripe.com/?contact=true so we can dig in further? I don't have an Amazon Pay integration set up at the moment to quickly try and replicate this