#antoine_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1261303499493343282
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
@severe pasture is a developer who works with me on this subject
Hello, here is some screenshot for you to understand better
If you wanna try something on the website, you can try out here: https://valuemycar.fr/
mountPaymentInput: async (
elementWrapper: HTMLElement,
amount: number,
companyProfile: EStripePublicKeyEnv
): Promise<TPaymentSubmitFunction> => {
const stripeJs = await StripeHelper.getStripeJs(companyProfile)
const elements: StripeElements = stripeJs.elements({
mode: 'payment',
currency: 'eur',
payment_method_types: ['card'],
amount: amount,
setup_future_usage: 'on_session'
})
const paymentElement: StripePaymentElement = elements.create('payment')
paymentElement.mount(elementWrapper)
//This function need to be called to validate and submit card informations
return StripeHelper.getPaymentSubmitFunction(elements, stripeJs)
},
public static getPaymentSubmitFunction(elements: StripeElements, stripeJs: Stripe) {
return async (clientSecret: string, alert?: IAlertControl) => {
// Check if card informations are filled properly
const { error: submitError } = await elements.submit()
if (submitError) {
const errorObj: IRequestError = {
status: 400,
message: submitError.message || 'Une erreur est survenue'
}
useAlertStore().handleRequestResult(alert, errorObj)
return { data: null, error: errorObj }
}
const confirmResult = await stripeJs.confirmPayment({
elements: elements,
clientSecret: clientSecret || '',
redirect: 'if_required',
confirmParams: {
return_url: window.location.href
}
})
if (confirmResult.error) {
const errorObj: IRequestError = {
status: 400,
message: confirmResult.error.message || 'Erreur lors de la confirmation de la carte'
}
useAlertStore().handleRequestResult(alert, errorObj)
return {
data: null,
error: errorObj
}
}
useAlertStore().handleRequestResult(alert)
return {
data: true,
error: null
}
}
}
Can you share the steps to check out?
<template>
<section class="payment-container">
<div ref="paymentElementDOM" class="payment-element"></div>
</section>
</template>
Do you wanna do it yourself on the website, or are you talking about the code ?
I want to do it on the website to see
- Use an android system
- Go here: https://valuemycar.fr/centres/reservation/
- Choose a date and hour, see the screenshot to be sure you did well
- Click on the blue button "RÉSERVEZ"
- Select Google Pay
- Click again on "RÉSERVEZ"
Note: If someone pays with his card, everything is fine with the price. Just google pay is grumpy
Ah, forgot about this step, it's not possible atm :/
I'm gonna create an account for you to test
Cool thanks
Here is @gritty swan
....
Ok thanks looking
For security reason, I deleted them from the thread 😅
Sure no worries
Can you send just the email again though?
I'll delete after I copy
Thanks
I don't want to sound impatient or even unpleasant, but have you any news ? 😅
Alright thank you 🙂
Hey there, I'm helping @gritty swan look at this
Thanks for sharing those snippets here
I was looking for the stripeJs.elements() call in your site and couldn't find that
But that aside, can you log out the options you're providing there? I suspect amount is getting double-multiplied by 100
The amount is correct when I log in the mountPaymentInput
amount: 1490
we are trying something right now
Btw, We also suspected the double multiplication, but if that were the case, why would it only happen on google pay?
@austere elm @gritty swan That's it, it was a double multiplication problem. We were able to solve the problem, thank you very much for your time and expertise!
Quite welcome!
why would it only happen on google pay?
It would affect other payment methods, but in more subtle ways. The wallet methods are the only ones with browser-controlled UI that shows this amount. And that amount is not tied to what you actually charge, which is why you saw the correct amount actually charged when you confirmed payment.
Ohh, so I imagine that if we'd added apple pay, we'd probably have had the same problem!
If you had configured min/max amounts for some payment methods (ie, show bank debit options only over 1000 euro) then the incorrect high amount would have revealed or hidden those options.
Yep, the Apple Pay UI would have also shown the 1490.00 amount
Otherwise the customer never sees that amount value directly