#quantum1125 - Payment Request Button

1 messages · Page 1 of 1 (latest)

haughty surge
#

Hello! It sounds like you're trying to adjust the options on the <PaymentRequestButtonElement /> after it's been created, which is not allowed.

#

Do you have code that's modifying that property?

modern anchor
#

interesting, I am trying to refresh the button upon updates to my cart to reflect the new price after people +/- quantities in the cart, but the <PaymentRequestButtonElement /> still displays the old total amount from the originally created paymentRequest

haughty surge
modern anchor
#
this.state.paymentRequest.update({
            total: {
              label: "total",
              amount: Number(this.state.total)*100
            }
        }); ```
#

i am doing this, but it doesn't like it apparently

haughty surge
#

Doesn't like it? Are you getting an error?

modern anchor
#

not an error, but a warning and it does not reflect the new price

#

if the button is already showing and I call this .update function, it's supposed to update the paymentRequest? it seems that the paymentRequest once passed to the button cannot be updated, which defeats the purpose of the update function

haughty surge
#

The button can be showing, yeah. The payment sheet can't be showing, but the button can be.

modern anchor
#

yeah - my button is showing, I update the quantities in my cart and call the update function, but the payment sheet still shows the old price

#

and that warning pops up in my console

haughty surge
#

Can you share all of the relevant code?