#gael_code

1 messages ยท Page 1 of 1 (latest)

solar chasmBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1268114311537098852

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

olive spearBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

next spruce
#

Hmm did you observe (debug) that the update function was called?

solar chasmBOT
modern shard
#

Yes it is called and does not return an error. I have the impression that the .update only works if the button is not yet rendered in the view. But I need to change the amount associated with the payment in the button page

gray leaf
#

yes update only works if the sheet is not currently open. You can't update the sheet when it's open if that's what you mean. Beyond that, I do think update should just work(I'll check) so maybe there's an issue in your integration, do you have a simple repro page anywhere?

#

here's a simple repro that shows it works https://jsfiddle.net/297yj3pu/ (you can click the button to increase the amount, then click the PRB and see the amount is different).

modern shard
#

I can send you the code used

#

In the example you add a delivery price, you do not modify the basic amount I have the impression

#

The label should be "Demonstration" and the initial amount should be updated. This doesn't work on the example either

gray leaf
#

what part of the example I showed you doesn't work?

modern shard
#

This should act on that

gray leaf
#

no, it shouldn't?

#

my code doesn't change the shippingOption

#

my code just sets the amount to +100 itself when you click the button for it, and that way when you open the sheet you see the total amount has changed. The shipping is separate.

modern shard
#

Ok I understand... Can we manage the update when clicking on the PaymentRequestButtonElement?

gray leaf
modern shard
#

I don't really see how to integrate it into react

gray leaf
#

yeah we don't really have any sample code for this, and PaymentRequestButton is replaced by ExpressCheckoutElement anyway.

in any case it should be straightforward, you have a <button> and the onClick function needs to call paymentRequest.show()

modern shard
#

This seems depreciated ๐Ÿ˜ฆ

gray leaf
#

yes that's what I mentioned earlier ("PaymentRequestButton is replaced by ExpressCheckoutElement ")

#

you can still use PaymentRequestButton though

#

overall, to step back, the update function in general does work so I suspect there's an issue in your integration. My guess would be one of your useEffect functions is running on each render and setting the pr variable to an initial state or something, I'd try to add extensive logs to debug what's happening.

solar chasmBOT