#blagi.connecto
1 messages ยท Page 1 of 1 (latest)
Hello @subtle tangle , let's keep your details all in this thread
Is it possible to remove Google Pay popup window after clicking pay so an error can be displayed after confirmPayment?
I am not sure I understand your question, can you send me a screenshot of the popup? And what is the error that you are trying to display?
I'm getting error on confirmPayment and I'd like to display it without Google Pay pop-up window.
Interesting. I am surprised that the window is not disappearing before then. Are you using the Payment Request Button here? Or is google pay getting launched from our Payment Element?
Hi Pompey, thanks for helping me.
It's launched from Payment Element.
Can you show me your payment method code for confirming your intent?
And what is the error message that you are getting back?
` async function confirmPayment(clientSecret, returnUrl, countryCode) {
const { error } = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: returnUrl,
payment_method_data: {
billing_details: {
address: {
country: countryCode,
}
},
},
},
});
// This point will only be reached if there is an immediate error when
// confirming the payment. Otherwise, your customer will be redirected to
// your `return_url`. For some payment methods like iDEAL, your customer will
// be redirected to an intermediate site first to authorize the payment, then
// redirected to the `return_url`.
if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
if (typeof log_message_to_server === "function") {
log_message_to_server('response for potvrda_initialize_transaction error');
}
}
}
`
ShowMessage is from some of your's example samples.
Interesting, and when you get this error, the confirmPayment function has returned but the google pay sheet it still up?
Yap.
User has to click somewhere to close it. If everything is ok it's just another url.
And what is the error that you are getting?
Can you paste the full text of the error here?
Can you reproduce this on your website in test mode?
I solved that error, but want to used is as a test case for error displaying. It's:
The provided capture_method (manual) does not match the expected capture_method (automatic). Try confirming with a Payment Intent that is configured to use the same parameters as Stripe Elements
Gotcha, will try to reproduce that error and will get back to you
Ok.
For me, the google pay sheet is closed before the confirm call is called so I am not getting that error
Can you send me your client side code for setting up the payment element and confirming your intent?
I'm calling this method on submit:
` paymentOnSubmit: async function (type, transfer_json, callback) {
let stripeResponse = null;
const {error: submitError} = await elements.submit();
if (submitError) {
handleError(submitError);
return;
}
if (type === 'transfer_confirmation') {
stripeResponse = await transferConfirmationPaymentOnSubmit(transfer_json);
} else if (type === 'transfer_booking') {
stripeResponse = await transferBookingPaymentOnSubmit(callback);
}
if(stripeResponse.hasOwnProperty('return_url') && stripeResponse.return_url.length > 0) {
await confirmPayment(stripeResponse.stripe_client_secret, stripeResponse.return_url, stripeResponse.country_code);
} else {
console.log('response for potvrda_initialize_transaction error');
if (typeof log_message_to_server === "function") {
log_message_to_server('response for potvrda_initialize_transaction error');
}
}
},`
After elements.submit() I'm calling our code for submitting data to server and is' returning return_url and creates payment intent/client secret for confirmPayment
It's ajax call to server.
...
๐ Give me a moment to take a look
Server is a bit busy
Ok. Thanks hanzo for dive in.
No it's a paymentElement. Tabs with a Card and Google pay tabs, clicked on Google Pay button. PaymentIntent is creating just before confirmPayment.
I get that but is the PaymentIntent getting created with live mode API keys or test mode?
Can you share the PaymentIntent ID?
It should look something like pi_xxx
test mode.
Can you share the PaymentIntent ID?
Thin it's this one: pi_3NIAcjHyMHmjD7NO0LIoI75S
It was created more than an hour ago.
Request: req_ibzwghyPnynsIo
Can you share the code you're using to initialize PaymentElement?
async function initialize(amount) { if (amount == 0) { return false; } const options = { mode: 'payment', amount: amount, //capture_method: 'manual', currency: 'eur', }; elements = stripe.elements(options); const paymentElementOptions = { layout: "tabs", fields: { billingDetails: { address: { country: 'never', } } } }; const paymentElement = elements.create("payment", paymentElementOptions); paymentElement.mount(config.payment_element_id); paymentElement.on('change', function(event) { document.getElementById(config.payment_element_complete_id).value = event.complete ? 1 : 0; }); }
Comment capture_method to test error displaying.
If you take out the capture_method, does the flow work as expected?
Yes, payment confirmed and redirected to return_url
I'd like to have some kind of method for closing Google Pay pop-up. ๐
Hmm we don't have a specific method to override Google Pay modal behaviour as it's mostly controlled by Google once the modal is shown
Is this page live?
If so, would you mind sharing a URL?
Not yet. Should go live in a couple of days, probably at Monday. Red line with Stripe payment is working just have to test handling errors and unusual situations.
Looks like you are out of suggestions while in test. I can finish all other parts, test and will contact support when everything goes live.
yeah this is quite unusual. After confirmPayment call, the modal should dismiss automatically as Pompey mentioned earlier.
They weren't able to reproduce this behaviour either so looking at an example would help
Ok. Thanks guys for now