#ryonwhyte

1 messages · Page 1 of 1 (latest)

candid bayBOT
#

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.

clever sundial
#

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

subtle wing
#

Let me try something.

#

Rebuilding project, just in case. Will take a little bit

subtle wing
#

Still testing. I save the secret to a redux state but it keep being removed each time. Little bit more time to debug

subtle wing
#

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

clever sundial
#

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?

subtle wing
#

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

clever sundial
#

Can you share the relevant code where you set the state of client secret?

subtle wing
hidden ore
#

Hi @subtle wing I'm taking over this thread

subtle wing
#

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

hidden ore
#

Where can I find the implementation of createOrderAndIntent ?

subtle wing
#

Line 334.
It was invoked in the handleConfirmation function which was invoked by the confirmHandler callback

hidden ore
#

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);

subtle wing
#

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

hidden ore
#

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

subtle wing
hidden ore
#

intentCreationCallback({ clientSecret: currentIntent }); this part doesn't look right to me. Is currentIntent also a clientSecret?

subtle wing
#

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.

hidden ore
#

Why do you want to reuse a clientSecret?

subtle wing
#

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

hidden ore
#

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?

subtle wing
# subtle wing I have this issue https://streamable.com/gyv1cv Whenever a card payment fails, ...

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.

hidden ore
#

You might want to check your state management code, or you can just use a simple useState hook to save the clientSecret variable.

subtle wing
#

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.

hidden ore
#

That's strange. Can you put some logs in your code to verify if the clientSecret state is set?

subtle wing
#

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.

hidden ore
#

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.