#oscar-android-customersheet

1 messages ยท Page 1 of 1 (latest)

low gardenBOT
royal flax
#

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

tawny stump
#

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.

royal flax
#

Hi, thanks Toby

#

What if I want to add another payment method, or delete an existing one

tawny stump
#

You render a new payment sheet with a new Setup Intent if the customer would like to add another payment method.

royal flax
#

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

tawny stump
#

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.

low gardenBOT
royal flax
#

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?

minor herald
#

Hello! I'm taking over and catching up...

royal flax
#

Hi Rubeus

minor herald
#

I think we have a UI component for this, I just need to find it...

royal flax
#

Please

minor herald
royal flax
#

oh ok

#

If you don't mind, can we go through this conceptually

minor herald
#

Sure.

royal flax
#

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

minor herald
#

I believe you would display the PaymentSheet if they didn't have any Payment Methods saved.

royal flax
#

I see

#

But if you look at the UI of the customer sheet, it does offer an option to add a payment

minor herald
#

Yep.

royal flax
#

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

minor herald
#

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.

royal flax
#

Ok but it wont be deleted right?

minor herald
#

Nope, we don't delete threads.

#

You can bookmark the link to this thread or search for it and read it later.

royal flax
#

Thank you

#

I have a few more questions

minor herald
#

Okay. ๐Ÿ™‚

royal flax
#

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

minor herald
#

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.

royal flax
#

That's what I thought. That information would include card number etc right? or just the ID?

minor herald
#

It would not have the full card number, but it would have the last four digits, the ID, and some other details.

royal flax
#

Ok perfect

#

Finally, what is the difference between PaymentSheetContract.Args.createSetupIntentArgs() vs PaymentSheetContract.Args.createPaymentIntentArgs()

minor herald
#

One is for Setup Intents and one is for Payment Intents... not sure if that's the answer you're looking for though?

royal flax
#

Let me rephrase, when adding a payment method I should use the SetupIntent. What's Payment Intent for?

minor herald
#

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

royal flax
#

If a member has a payment method already, and I used the payment intent, would that display their already saved payment method?

minor herald
#

Would what display it?

royal flax
#

the payment sheet

minor herald
#

I don't think so.

#

That's what the CustomerSheet is for.

royal flax
#

Ok

#

We'll attemp to get early access then

low gardenBOT