#ryonwhyte-RN-paymentSheet

1 messages ยท Page 1 of 1 (latest)

copper pebbleBOT
#

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.

analog leaf
#

Hi ๐Ÿ‘‹

Sorry I really don't follow any of that. Can you try explaining shorter pieces of what is going on here.

  1. The App you are building, what SDK are you using?
  2. What is the action the customer completes?
  3. What error do you see and at what step does it occur?
plucky quest
#
  1. Using Stripe React native SDK

If the user enters an incorrect card information and attempts to pay, there is an error shown whichg is good. BUT if they then corrects it in the payment sheet with a good card, there is still an error (something went wrong). Video of me doing it: https://streamable.com/gyv1cv.

I am using this implementation: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=react-native&type=setup#ios-charge-saved-payment-method

Here is my server side code: https://pastebin.com/eSdVkW44

Here is my client side code: https://pastebin.com/q5cP29VC

It may be a bug in the library or my implementation. I don't know which one as my code seems to be correct as I followed the docs.

analog leaf
#
  1. What version?
#

I appreciate you providing your code but I don't have the time on this server to review all of it for you.

plucky quest
#

0.35.0

analog leaf
#

HOw are you catching & logging the errors that are returned by the Payment Sheet?

plucky quest
analog leaf
#

Okay so what are you logging when you get this error?

plucky quest
#

I don't log anything. The stripe payment sheet just displays it automatically to the user. Maybe I don't understand what you're asking?

analog leaf
#

I don't log anything

Okay well that is the first thing you should change

#

You should be logging all the details of any error returned either by the Stripe RN SDK or the Stripe APIs

plucky quest
#

Ooh. The error would be server side. Its just the traditional card decline error. Nothing special. I just pass the relevant parts ot the stripe sdk to display. Its just that after an eror it just stops working

#

Should I send a sample?

analog leaf
#

What is the state of the Setup Intent at that point?

plucky quest
#

Let me make a new PI so you can see it and the error

analog leaf
#

Okay thanks

plucky quest
#

Well, well well. To my surprise, it appears a client secret is returned to the app even with a card that will be declined. You are right I should have been logging lol.

However, that now means I have nothing to do with the error that shows up. It's completely display by the Stripe library.
PI: pi_3OMDllJgUVsS8tQc0fN3keiN

analog leaf
#

client secret is returned to the app even with a card that will be declined
I don't know what you mean by that

#

Okay so this payment intent is in a state of requires_action.

plucky quest
#

I meant. I thought that since that card would be declined the server would receive an error from stripe when creating the intent. Thsi is the response https://pastebin.com/uhFicyth

OK. So what do I need to do in the app? This is the card I used 4000000000000119

Also, 3DS is working quite fine. Certain of it, as I can use any working 3ds test cards. I am specifically testing cards that will fail/be declined here, and after the payment sheet error is displayed I just can't add a new card data to the same payment sheet instance.

analog leaf
#

OK. So what do I need to do in the app?
I don't know what you mean

#

You keep sending a bunch of code snippets and API responses but it isn't clear what you are trying to do

copper pebbleBOT
plucky quest
#

OK. Let me step back.
I am having one issue: https://streamable.com/gyv1cv.

When I use a test card, that will be declined and the payment sheet shows the error. I can not update the card details (to a correct card) in the same payment sheet instance without getting an error, even though the new details are correct.

What we have learned so far in this convo is that I am not the one generating the initial card decline, error, but the stripe library is doing it.

My assumption is maybe the payment sheet crashed after displaying the first error but I am not sure

analog leaf
#

I'm curious, what happens if you use card number 4000000000000002?

#

What is the state of the payment intent afterwards and does the payment sheet allow you to retest?

plucky quest
#
  1. Goes to 3ds
  2. Card declined error shown
  3. Changed card to 424242.. in same sheet instance
  4. Error: something went wrong

Intent state of 4000000000000002 attempt requires_action

analog leaf
#

Can you share the Payment Intent?

plucky quest
#

pi_3OMEBYJgUVsS8tQc00rKaDzx

analog leaf
#

It doesn't go to 3DS since it's just a generic decline

#

Are you testing in iOS or Android?

plucky quest
#

The 3ds screen sorta just blipped. Android

analog leaf
#

Okay so I just tested in my Android implementation and that part worked fine. Let me get my RN integration running

plucky quest
#

I see something. In Stripe there are actually 2 transactions.

The one for 4000000000000002 is pi_3OMEAkJgUVsS8tQc0DsDtipw

And the second attempt with 4242 is pi_3OMEBYJgUVsS8tQc00rKaDzx

analog leaf
#

I used

  1. 4000000000000002 - generic decline, payment sheet says up
  2. 4242424242424242 - payment succeeds
plucky quest
#

The 4242 transaction is actually 3ds incomplete. The payment sheet cannot trigger 3ds on the second attempt, it seems

analog leaf
#

Okay then it looks like your server is doing something odd. You need to understand why it's creating a second payment intent.

#

The payment sheet cannot trigger 3ds on the second attempt, it seems

You would need to re-initialize the payment sheet with the client secret for that new payment intent

#

I think your integration is causing a duplicate payment intent to be created

#

You should review your app and your server so that you only use the one payment intent

#

I was able to test the Payment Sheet in my integration and, as long as I was attempting to confirm the same payment intent, I could use a failing card and then a successful one without a problem

plucky quest
#

Aaaah. You are right, good Sir. That's exactly what happening. Makes perfect sense.

One question. If the user exits the payemnt sheet and reopens it. Is that reason to create new intent?

analog leaf
#

That would depend on how your code is set up

plucky quest
#

Hmm. I guess I could watch if the user makes changes that affect the order. Maybe i'll need new ephermal key though, right?

analog leaf
#

It's a good idea to create a new one along with the payment intent. They go stale fast and you don't know how long the customer will take to get back to the payment sheet

plucky quest
#

Hmm. Thank you for that advice. I think I am good to go figure this out, now. I just need to restructure the code to use the same intent.

analog leaf
#

It's a good plan. It will also make it easier to debug your logs later on (not a bunch of duplicate intents).

plucky quest
#

Agreed. Thanks again ๐Ÿ™

analog leaf
#

Happy to help ๐Ÿ™‚