#oscar-android-customersheet
1 messages ยท Page 1 of 1 (latest)
The payment sheet no longer displays, it errors with the following:
"Failed(error=java.lang.IllegalStateException: PaymentSheet cannot set up a SetupIntent in status 'succeeded'."
So... I'm wondering, how do we display a PaymentSheet for existing payment methods
Hi ๐ you don't, once the Payment Methods have been created you have the ID for them and can use them directly without a Payment Sheet instance.
Hi, thanks Toby
What if I want to add another payment method, or delete an existing one
You render a new payment sheet with a new Setup Intent if the customer would like to add another payment method.
Ok that makes sense, but what if the user has multiple payment methods, how do we display a payment sheet displaying x number of payment methods, or options to delete one
I don't think you would, I don't think the Payment Sheet is intended to do that much. If you want to offer your customer a list of their payment methods that they can use to complete payment, you do so by listing the payment methods that they have available, and then displaying those in a UI component they can select from. Once they select the one to use, you can process a Payment Intent using the ID of the Payment Method.
If you want to allow them to delete Payment Methods, then you would display them similarly to how I described above, but when selected make a request to detach the payment method from the associated Customer object.
We've spiked this earlier, maybe a few months ago using XML layouts rather than jetpack compose. We were able to add payment methods using PaymentSheet(this, ::onPaymentSheetResult
This allowed us to add payment methods and view existing ones directly from the PaymentSheet
This was driven by presentWithPaymentIntent()
We'd like to mimic this experience in jetpack compose. What are our options?
Hello! I'm taking over and catching up...
Hi Rubeus
I think we have a UI component for this, I just need to find it...
Please
Oh, I think what I'm thinking of is in beta: https://stripe.com/docs/elements/customer-sheet
Sure.
We check if a user has a payment method
If there's no payment method
Display the payment sheet I implemented at the start of this conversation
If they have a payment method, display the Beta customer-sheet
If that right?
Or do we display the customer-sheet right of the bat
I believe you would display the PaymentSheet if they didn't have any Payment Methods saved.
Also, we do have this, but it only works with cards: https://stripe.com/docs/mobile/android/basic
I see
But if you look at the UI of the customer sheet, it does offer an option to add a payment
Yep.
along showing already added payment methods
Would you mind if we keep this thread open, I'd need to communicate back with my team and bring forward other questions
Might be tomorrow since it's EOD for some
We don't keep idle threads open for very long here, but you're welcome to come back tomorrow and start a new thread. You can also contact support for a longer-running, async conversation if you wish.
Ok but it wont be deleted right?
Nope, we don't delete threads.
You can bookmark the link to this thread or search for it and read it later.
Okay. ๐
Thank you Rubeus
Ok, so suppose a member has added x number of payment methods via the implementation at the start of this thread
How would the front end clients retrieve the ID's for those stored payment methods
Typically your front end code would make a request to your server and your server would provide those details. Your server can store the information in your own DB or fetch the information from the Stripe API.
That's what I thought. That information would include card number etc right? or just the ID?
It would not have the full card number, but it would have the last four digits, the ID, and some other details.
Ok perfect
Finally, what is the difference between PaymentSheetContract.Args.createSetupIntentArgs() vs PaymentSheetContract.Args.createPaymentIntentArgs()
One is for Setup Intents and one is for Payment Intents... not sure if that's the answer you're looking for though?
Let me rephrase, when adding a payment method I should use the SetupIntent. What's Payment Intent for?
Setup Intents are used to set up a Payment Method for future use without taking a payment now. Payment Intents are used to take payments, and can optionally set up a Payment Method for future use at the same time (by setting setup_future_usage on the Payment Intent).
If a member has a payment method already, and I used the payment intent, would that display their already saved payment method?
Would what display it?
the payment sheet