#cashiersprit - payment request

1 messages · Page 1 of 1 (latest)

granite topaz
#

Good question. Will look in to it. Can you tell me a bit more about what you are trying to do with this update?

lone vigil
#
public async updatePaymentIntent (payload): Promise<any> {
    let result = await postUpdatePaymentIntentPaymentElement(payload); // fetch and update price in our backend, also in backend call stripe api update_payment_intent

    if (!this.isSavedCard(payload)) {
      await this.stripeElements.fetchUpdates(); // make google pay and apple pay display latest price
      result = await (this.stripe as any).updatePaymentIntent({ elements: this.stripeElements }); // display google/apply pay ui, however, apple pay complaints show() must be called from a user gesture handler (such as a click handler, after the user clicks a button)
    }

    return this.stripePaymentMethodHandler(result, payload);
  }
#

sorry, a bit messy, in latest safari, updatePaymentIntent({ elements: this.stripeElements }) throw out error show() must be called from a user gesture handler (such as a click handler, after the user clicks a button)

#

because user can change quantity, item and etc. the price is dynamic, user click submit button, we need to pass and process data in backend. then frontend fetch latest price by this.stripeElements.fetchUpdates() ,later show apple pay ui in await (this.stripe as any).updatePaymentIntent({ elements: this.stripeElements }) . does it make sense to you?

#

but it seems apply pay would complain if after click button, not immediately show apple pay ui by await (this.stripe as any).updatePaymentIntent({ elements: this.stripeElements })

#

tech speaking, it only happen in latest version of safari, I used to use old version safari, no such issue. either for google pay. I don't like apple pay 😦

granite topaz
#

Gotcha. Thank you for the code, I was actually unaware that updatePaymentIntent did this. Checking in to how this is supposed to work and if there is something you can do to mitigate this

#

Also, when you say this happens in the latest version of Safari, does that mean you don't see it in other Safari versions or is that just to let me know which specific version you checked with?

lone vigil
#

it shows error in 15.5, previously, I use 15.3, there is no such issue

granite topaz
#

Good to know, thank you.

#

Do you have a test page on your site that I can see this on?

#

I can open my DMs if you can send a URL there