#Scott-payment-element-amount

1 messages ยท Page 1 of 1 (latest)

pseudo totemBOT
quiet dirge
#

IntentID, incase it helps: pi_3MUYaGI1YUOItIGB18P5Mbsf

tender ermine
#

It sounds like you might be updating the Payment Intent after the Payment Element is rendered. Does that sound correct?

quiet dirge
#

That is correct, yea.

tender ermine
#

Scott-payment-element-amount

quiet dirge
#

This works fine for CC and AU BECS charges, in my experience

tender ermine
quiet dirge
#

Huh, interesting. I don't see any parameters to include amount there - does it query the intent's amount on its own end?

tender ermine
#

Yep! The Payment Element uses the client secret from the Payment Intent in order to know what amount you're creating the payment for

quiet dirge
#

Ok, awesome! Testing it out now. Thank you!

quiet dirge
#

It looks like I'm still getting the same issue :/ I see the update for the element going through without issue (it even takes the new Business Name supplied which I've gone ahead and passed the new amount into as well e.g. business llc - 12.00 ), but the amount to be charged remains untouched.

tender ermine
#

Where are you changing the amount? I was under the impression that you were fetching some server-side code that updates the Payment Intent, then reloading the Payment Element

quiet dirge
#

That is exactly what I'm doing.

#

The user adds/removes items from their cart on their end, we let the back-end server know, which notifies Stripe, then we send back the 200 if it succeeds. After I get the 200, I update the payment element with the code you just gave.

#

The JS, as a visual aid to the above ^

tender ermine
#

Hmmm, it's really hard to debug this without being able to see the page in action. Do you have a URL I can use to see the way it's working right now?

quiet dirge
tender ermine
#

I think you need to add a server-side function that listens for change to the Cart and then updates the Payment Intent only after the cart has been updated. I'm not seeing any network calls after I add something to the cart

quiet dirge
#

The calls are being made, though - here they are in Stripe from your visit

tender ermine
#

Can you send me that Payment Intent ID?

quiet dirge
#

pi_3MUZbzI1YUOItIGB1WeH1jbc

#

Sure thing

quiet dirge
tender ermine
#

Ahhh, okay I see. Let me submit the form and take a closer look

quiet dirge
#

Right so, did you click to pay with Apple Pay or with a Credit Card?

#

The issue only appears when attempting to pay with Apple Pay, unfortunately. It works perfectly fine for all other payment methods.

tender ermine
#

Ahhhhh, right. Okay. Just a moment

#

Apple Pay isn't showing up for me at all on that page

#

Does it show up for you?

quiet dirge
#

Are you on an apple device & have a card on file in an Apple Pay wallet?

#

It shows up for me without issue

tender ermine
#

Yup. I checked to make sure it was showing up in other places too. I'm on Safari on Mac

real smelt
#

๐Ÿ‘‹ I'm hopping in to take a look as well @quiet dirge give me a minute to catch up

quiet dirge
#

Thank you both!

#

not sure how to screenshot on my iphone, but here is what ive got:

#

you'll notice, as in the code, the business name includes the amount to charge (12.50, in this case), but the amount itself is off.

real smelt
#

quick update - apple pay wasn't showing up for us because you shared the http site, not the https one which is a requirement for apple pay showing up

quiet dirge
real smelt
quiet dirge
#

I was using paymentElement.update() per two-shoe's recommendation - let me swap it out with a call of elements.fetchUpdates() instead. One minute, please.

#

The new code is live, but the amount to charge is still not being updated :/ Any ideas?

real smelt
#

I see it working fine on my end

quiet dirge
#

:0

#

Weird, it still doesn't work for me.

#

You're on an iPhone or a PC?

real smelt
#

I'm on a PC

quiet dirge
#

Huh, it just started working for me too.

#

What should I do to ensure that the client doesn't get charged for $1.00 instead of the $22.15 that they are supposed to, in this scenario?

real smelt
#

If you've updated the Payment Intent I believe it's a guarantee that the amount we'll be charging is the amount set on the PI - the part that hasn't been updated is just the UI. We should still be charging the correct amount

quiet dirge
#

got it - Thank you so much! ๐Ÿ™‚