#antoine_code

1 messages · Page 1 of 1 (latest)

mighty cometBOT
#

👋 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.

glass zinc
#

@severe pasture is a developer who works with me on this subject

severe pasture
#

Hello, here is some screenshot for you to understand better

glass zinc
#
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
      }
    }
  }
gritty swan
#

Can you share the steps to check out?

glass zinc
#
<template>
  <section class="payment-container">
    <div ref="paymentElementDOM" class="payment-element"></div>
  </section>
</template>
severe pasture
gritty swan
#

I want to do it on the website to see

severe pasture
#
  • 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

gritty swan
#

Ah seems i have to create an account first

#

Would rather not if possible

severe pasture
#

Ah, forgot about this step, it's not possible atm :/
I'm gonna create an account for you to test

gritty swan
#

Cool thanks

severe pasture
#

Here is @gritty swan
....

gritty swan
#

Ok thanks looking

severe pasture
#

For security reason, I deleted them from the thread 😅

gritty swan
#

Sure no worries

#

Can you send just the email again though?

#

I'll delete after I copy

#

Thanks

severe pasture
#

I don't want to sound impatient or even unpleasant, but have you any news ? 😅

gritty swan
#

We're investigating right now

#

Sorry in multiple threads

severe pasture
#

Alright thank you 🙂

austere elm
#

Hey there, I'm helping @gritty swan look at this

austere elm
#

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

glass zinc
#

The amount is correct when I log in the mountPaymentInput

amount: 1490

glass zinc
glass zinc
#

@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!

austere elm
#

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.

glass zinc
austere elm
#

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.

austere elm
#

Otherwise the customer never sees that amount value directly