#suba_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/1364663062438739969
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, are you asking if we have a document to collect payment method details without accepting a payment using React Native?
Hello.
I'm asking how can I, based on a stripe customerId, add a card to that customer. Does Stripe have some sort of Element UI that I can use to allow the user to add the card in there?
And, after having that client stripe cards, I will list them and allow the user to select one to proceed to the payment. My question here is, how can I proceed the payment using the card he selected
Are you asking how to surface the saved card in the UI to offer the option to pay with that card?
Yes.
And how to add a new card to a customer
I think you'd want to review https://docs.stripe.com/elements/customer-sheet?platform=react-native . The Customer Sheet is a prebuilt UI component that lets your customers manage their saved payment methods. As for collecting the payment method details without a payment, you'd want to look here: https://github.com/stripe/stripe-react-native/blob/master/example/src/screens/PaymentSheetWithSetupIntent.tsx
Let me know what specific questions you may have
The thing is that using the Customer Sheet I can't really add other payment elements there that are not relative to stripe.
So, Ideally I would have a process in my checkout where the user can do something very similar, by seleting already added cards and, have the option, to add a new card
Hi there 👋 I'm jumping in as my teammate needed to step away.
So you want to have your own UI that you build that you can call Stripe related functions from? (It's a little hard to make a recommendation without having a good grasp of the requirements of your project, which is why we're trying to ask clarifying questions to get a better understanding of what it is you're trying to do)
Hello.
Yes, I think you got it right.
To try to explain it a bit, it's something very similar to the screen shot attached from airbnb (I think it's an older version, but it's still the right example).
In our app, once reaching the checkout page, to proceed with the payment, ideally, we would have a screen very similar to the screen shot, where we can:
- Select a card we already have used (I assume this has to be a call where we retrieve the customer saved payment methods and display them)
- Create a new card - This is the part where I have most trouble understanding.
Is there any way in stripe that, upon using the option to create a new card, for stripe to provide UI Elements (very similar to the ones when payming using stripe elements), that has the inputs for the user to add a new card?
TLDR:
- Allow my users to create cards (stripe)
- Fetch user cards and allow the selection on them
- Proceed/finish the payment with the previously selected card information
When a user is adding a new card, do you want to always use that new card to process a payment? Or do you intend to give your users the option to:
- Check their saved cards
- Add a new card
- Check their saved cards
- Either use an existing one for a payment or add a new card
- the user can step through the last two steps repeatedly and add a bunch of cards to their wallet without ever paying
My thinking when adding a new card, is that you'd use our flow for processing a payment and saving the payment method for future usage:
https://docs.stripe.com/payments/mobile/save-during-payment?platform=react-native&mobile-ui=payment-element
likely using our (legacy) Card Element rather than the Payment Element if you want our element to reside alongside elements from other payment providers:
https://docs.stripe.com/payments/card-element?platform=react-native
But if you want to let your customer choose what card they use after they add one, then you'll need a different appraoch than that
Exactly what you described in the bullet points
At this moment we are evaluating development time for both options.
I do think the first one you suggested seems easier to implement, but I also wanted to know what I would have to do to have the exact behaviour that you describer in the bullet points
Because that same behaviour can also later be used in the user profile, where he has his payment methods and he can add new ones there (not even relative to the checkout page)
Then you'd follow our guide for setting up a payment method for future usage (but again, probably not using the Payment Element):
https://docs.stripe.com/payments/mobile/set-up-future-payments
This flow uses Setup Intents rather than Payment Intents.
I'm a bit confused.
So, in this approach, we use the 'initPaymentSheet' so that the user can add a card. This: " After the customer completes setting up their payment method for future use, the sheet is dismissed and the promise resolves with an optional StripeError<PaymentSheetError>."
If I got it right, I think the part where the user adds cards is fine.
I'm confused about the part where we finish the payment (checkout process).
In the 'Charge the saved payment method later' it states the following: "When you’re ready to charge your customer off-session, use the Customer and PaymentMethod IDs to create a PaymentIntent. To find a payment method to charge, list the payment methods associated with your customer. This example lists cards but you can list any supported type"
So, this means that, in our app (the case I already explain), this would translate to:
- Show the user stripe cards as select options, where each card has it's 'PaymentMethod ID', and, when we click to proceed, we use that payment method ID and customer ID to create the payment intent and finish paying?
Sorry for writing too much
So, in this approach, we use the 'initPaymentSheet' so that the user can add a card. This: " After the customer completes setting up their payment method for future use, the sheet is dismissed and the promise resolves with an optional StripeError<PaymentSheetError>."
You'll need to modify what that guide shows you, unless you are okay with using the Payment Sheet, which it sounded like you didn't want to previously. You'll need to combine the information from these two guides if you want to use a Card Element instead:
- https://docs.stripe.com/payments/mobile/set-up-future-payments
- https://docs.stripe.com/payments/card-element?platform=react-native
So, this means that, in our app (the case I already explain), this would translate to:
Show the user stripe cards as select options, where each card has it's 'PaymentMethod ID', and, when we click to proceed, we use that payment method ID and customer ID to create the payment intent and finish paying?
Yup. Once you have the Customer ID and Payment Method ID you can process a Payment Intent using those. Since it sounds like your customer will still be in your app, you'll likely want to process those payments as on-session payments, by either explicitly settingoff_sessiontofalseor omitting that parameter entirely.
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-off_session
Depending on the region where you plan to release your app, you may need to be prepared to handle 3DS authentication being required. It's required very frequently when operating in the EU, and is increasing in popularity within the US.
You'll know that's required by the Payment Intent going into a requires_action state:
https://docs.stripe.com/payments/paymentintents/lifecycle
You can use handleNextAction, client-side, from our SDK to then trigger showing the authentication challenge to the customer for them to complete.
Could you please provide some docs information about this 'handleNextAction'? Just so I can see how it works. I'm not very familiar with it but I'm aware of 3DS
Whoops, I had pulled up a link to it in our React Native SDK ref, but forgot to paste it in my message. Here you go:
https://stripe.dev/stripe-react-native/api-reference/functions/handleNextAction.html
Perfect, thank you.
I'll take some time implementing this new approach, but I think I got the info I needed.
Have a good one!