#dawidzawada-elements-react

1 messages · Page 1 of 1 (latest)

dark valley
#

Let me check with someone who has more React experience and get back to you.

somber citrus
#

No worries, I'll be waiting there

#

It might be also some server-side config solution

subtle junco
#

👋 can you share your initPaymentSheet?

somber citrus
#

yes

#

wait a minute

subtle junco
#

Okay actually sorry the initPaymentSheet doesn't matter. I hadn't played with this in a bit but now I remember.

#

So this is based on paymentmethods attached to a Customer object

#

PaymentSheet will automatically display those attached cards.

#

I don't believe there is a way to disable this, but let me check.

#

Are you only using PaymentSheet to collect cards?

#

Or other LPMs as well?

#

So a workaround here would be to create a new Customer object every time a card is added

#

But that likely isn't great for you

#

As you would then need to link Customers and track on your end.

somber citrus
subtle junco
#

Hmm actually I might have a workaround

#

One sec

subtle junco
#

Okay so the workaround here would be to not pass the ephemeralkey to initPaymentSheet. The ephemeralkey is what gives the front-end access to the Customer details. We call this out in our docs (https://stripe.com/docs/payments/accept-a-payment?platform=react-native#react-native-add-server-endpoint) If you never save cards to a Customer and don’t allow returning Customers to reuse saved cards, you can omit the Customer and Customer Ephemeral Key objects from your integration.
However what you are going to do here will be slightly out of intended scope since you will be passing a Customer but not ephemeral key. This should work fine but I recommend thorough testing with this approach in case there is any edge-case since we usually would recommend passing both Customer + EphKey or neither.

#

I did do a quick basic test and it did work fine to save the new card to the Customer and their saved cards are not displayed.

somber citrus
#

Ok, I'm actually kind of saving cards and retrieving them trough SMS code veryfication, is this workaround will be good for this?

subtle junco
#

Hmm can you explain more about what you mean by that?

#

The route I mention above still does save the Card within Stripe. It just doesn't display saved cards in the UI.

#

So it seems to be what you were originally looking for.

somber citrus
#

As far I understand cards will be still on stripe but frontend without ephemeralkey will not receive that information

subtle junco
#

Yep

somber citrus
#

Ok that seems like a solution for me, can you not close for a minute this thread? I'll run a quick test and check if it works

subtle junco
#

Yep sure thing

#

Also you can always pop in later if the thread does get archived at some point and ask another question!

somber citrus
#

Ok, I've run a quick test and it is working, thank you for that!

subtle junco
#

🎉

#

Definitely recommend testing thoroughly... both Android and iOS (I only tested on iOS fyi).

#

But I do think it should work fine.

somber citrus
#

Sure thing, should I test also live mode?

subtle junco
#

We can't recommend testing in production as it is against card network regulations.

#

I can recommend that you test the UI in production.

#

But I can't recommend that you actually save/charge cards in production for a testing purpose.

somber citrus
#

Ok, I think test cards will be fine tho, thank u again and have a nice day!