#ryonwhyte
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- ryonwhyte-RN-paymentSheet, 6 hours ago, 52 messages
- ryonwhyte, 3 days ago, 68 messages
Once the payment intent is declined, you can still use the same payment intent client secret to collect the new payment method. New client secret is not required
Still testing. I save the secret to a redux state but it keep being removed each time. Little bit more time to debug
It appears I cannot set any state while the payment sheet is visible. I was trying to save the client secret to a state, so I can simply check if it exists and reuse it. For some reason, the state won't set. Is this a thing, or is it me. I tried everything including restarting phone, desktop, deleting project etc. I can't save the secret to a state. I am in React Native
You should be able to set the client secret to a state. If you set other variables to the state on the same component, does it work?
I set other state, but not while the payment sheet is visible. This is the only one I need to save while the payment sheet is showing and it's not working. I tried with regular state and with redux state
Can you share the relevant code where you set the state of client secret?
Its long, but just focus on the createOrderAndIntent fucntion. This is triggered by the handleConfirmation callback. Which runs when the user enters the card and attempts to pay/add card. I am using this implementation https://stripe.com/docs/payments/accept-a-payment-deferred?platform=react-native&type=setup#ios-charge-saved-payment-method
Code here https://pastebin.com/FRtK7Gt6
Hi @subtle wing I'm taking over this thread
Hi @hidden ore . Thank you. Unfortunately I am heading to the gym in 10 mins. I guess if you discover anything, you can drop it and I will check it when I get back
Where can I find the implementation of createOrderAndIntent ?
Line 334.
It was invoked in the handleConfirmation function which was invoked by the confirmHandler callback
and what is insertOrder ? why are you returning intentSecret: false,?
It will set client_secret to false, which is not a valid client secret.
setCurrentIntentSecret(intentCreated.intentSecret);
I create a pending order in my own database to use later. Don't worry about that it does nto affect anything I tested with it removed. If the order fails to create I don't want to go forward with the process hence I set intent secret to false which will cancel the transaction (some conditions there for that). The order is being created successfully, so that's no a problem. If it was, no transaction would work.
The function call below that is where I create the intent on the server and get the intent secret initPaymentIntent. The intent secret is always returned from the server. I have a few logs there
instead of reusing intentSecret, I'd suggest you to use another varaible to indicate "Failed to create order".
Also I don't see you specify paymentIntentClientSecret when calling initPaymentSheet
Ok, so you are using the deferred flow
I can do that. But it has no bearing on the cant save state issue.
intentCreationCallback({ clientSecret: currentIntent }); this part doesn't look right to me. Is currentIntent also a clientSecret?
currentIntent is a redux state. I attempted to save the intent secret to that state when I receive it so that I can reuse it. See setCurrentIntentSecret
I am using the redux logger to follow the redux state and setCurrentIntentSecret NEVER gets triggered while the payment sheet is present. Its like the payment sheets stops everything once it pops up
and I tried with regular react state as well.
Why do you want to reuse a clientSecret?
I have this issue https://streamable.com/gyv1cv
Whenever a card payment fails, and I update the data in same instance the payment continues to fail, and it recreates a payment intent each time snufkin recommended I use the same payment intent instead of creating new one every time that will solve the duplicate intents and have updated details in the same payment sheet to process correctly.
I am confirming the payment method server side immediately
Ok, can you help me to understand exactly what problem you are trying to fix? you said "For some reason, the state won't set. ", what state you are trying to set and how you expect the paymentSheet to reflect it?
I have this issue https://streamable.com/gyv1cv
Whenever a card payment fails, and I update the data in same instance the payment continues to fail, and it recreates a payment intent each time snufkin recommended I use the same payment intent instead of creating new one every time that will solve the duplicate intents and have updated details in the same payment sheet to process correctly.
This is the root issue and I contacted Stripe today, the solution I was given is to use reuse the payment intent. However, I cannot reuse the payment intent, because I cannot save it to some sort of state while the payment sheet is present. I don't know if this is a bug in the library or what, so I messaged here again. While trying to solve the first issue using the recommended solution, I discovered another.
Initial Problem: #1183815624485503007 message
Initial Solution: #1183815624485503007 message
New problem while implementing solution: #1183938166177157290 message
If I can't set a state while the payment sheet is visible, then I cannot reuse the payment intent.
You might want to check your state management code, or you can just use a simple useState hook to save the clientSecret variable.
State hook does not work either. I tried it first and didn't work so I tried redux. I even used redux logger to track the life cycle of every redux state and it never gets triggered. Everything else works normally.
That's strange. Can you put some logs in your code to verify if the clientSecret state is set?
It's never sets. It's like it skips over that line code. The console logs work but the setCurrentIntentSecret never gets triggered. So it remains null.
My theory is that once the payment sheet pops us I can't save any state, maybe because it sort of a hosted solution or maybe a bug. I don't know. I was just hoping maybe you maybe have seen it somewhere or know something
I am outside now.
No I don't think PaymentSheet will impact the react state. I'd suggest you to check your code again, or work with someone who is more familiar with react.