#quantum1125 - Payment Request Button
1 messages · Page 1 of 1 (latest)
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?
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
You should update the paymentRequest, not the button itself: https://stripe.com/docs/js/payment_request/update
this.state.paymentRequest.update({
total: {
label: "total",
amount: Number(this.state.total)*100
}
}); ```
i am doing this, but it doesn't like it apparently
Doesn't like it? Are you getting an error?
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
The button can be showing, yeah. The payment sheet can't be showing, but the button can be.
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
Can you share all of the relevant code?