#blagi.connecto
1 messages · Page 1 of 1 (latest)
Hi
When customer choose Google Pay I don't know how to validate that or just check if a Google pay chosen payment method?
When using Google Pay, what you want to validate exatcly ?
Just to avoid validation if it's Google Pay.
Can you share a sample of your code please ?
There are a lot of other js code around parts connected to Stripe.
On submit button validation is executed, and if a data are valid, including card data completness, they are submitted to server (php).
Returned data eg. return url and country code are used to call stripe.confirmPayment().
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
How are you validating the form?
This is part of bigger js that control whole form with stripe payment element:
$.ajax({ async: false, type: 'POST', url: url, data: jsonData, dataType: 'JSON', success: function(rezervacija) { if (rezervacija.hasOwnProperty('return_url') && rezervacija.return_url.length > 0) { stripePaymentElements.confirmPayment(rezervacija.return_url, rezervacija.country_code); } }, error: function(err) { console.log('error'); } });
This is confirmPayment method in other js file:
` confirmPayment: async function(returnUrl, countryCode) {
const { error } = await stripe.confirmPayment({
elements,
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.");
}
}
`
As per second error, could you provide a screenshot of where you're getting it?
Are you with me?