#naren_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1298467563654611007
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
i asked the same question yesterday but i wasn't able to text. i had to contact stripe support
current code
After initialising payment sheet, you will need to open the payment sheet to reflect the new value
If you create the Payment Intent every time, it will hit rate limit very fast: https://docs.stripe.com/rate-limits
I'd recommend using deferred intent flow which will delay creating the payment intent until the amount is finalised: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=react-native&type=payment
This was suggested by my colleage earlier: https://discord.com/channels/841573134531821608/1296268685836816489
i tried using this flow (adding a confirmHandler) but the currency still doesn't update.
I don't see you updating the amount in intentConfiguration when there is an amount change. confirmHandler will only be called when the user clicks the the payment button in Payment Sheet
oh ok. should i use a setstate to set the amount and currency before calling presentPaymentSheet?
i just tried this and the currency hasn't changed
Where do you let the customer change the amount? You should update the amount in intentConfiguration in initializePaymentSheet when there is an amount change, and open the payment sheet again
ultimately, before the checkout button is clicked and openpaymentsheet is called, i update amount and currency with the right values. in this case, i just updated them to random values in the openpaymentsheet function (right before presenting the payment sheet)
i changed the code so that amount and currencyCode in intentconfig uses the useState variables (which i update right before click)
The amount should be updated in both the intentConfiguration in initializePaymentSheet and the amount in confirmHandler
in this code, it is, right?
This is not right. When there is a amount change, you should call the initializePaymentSheet before open the payment sheet. The setAmount and setCurrency should be done at where you detect these value changes, and initialise payment sheet again
You shouldn't set setAmount and setCurrency in open payment sheet since the initializePaymentSheet has been called with the old value
oh. but once i set amount and currency, shouldn't the useeffect hook call initializepaymentsheet with the new values?
where shoudl i set amount/currency then? i'm confused
In your useEffect, you didn't set amount or currency as the dependency
oh ok. i'll set the dependecy to currency since it's the last updated. will this be the only fix?
where shoudl i set amount/currency then?
You should have a change callback in your amount input to set the amount and currency
i'll set the dependecy to currency since it's the last updated. will this be the only fix?
In addition, you should also setAmount and setCurrency in the change input of your UI, not in open payment sheet
this works. thank you so much!!!