Closed ilazakis closed 3 months ago
@ilazakis We do not yet have a compose only version of our Card widgets, but have it in our backlog.
We recommend using CardFormView which can be used from compose as describe here. CardInputWidget is in maintenance mode and is not receiving new features, only major bug fixes.
Let us know if we can help any further.
Thank you @michelleb-stripe!
With regards to compose compatibility, I already had a view wrapped up like this, was just wondering about a compose equivalent; I will keep an eye on the release schedule to update it when the time comes.
With regards to the actual Stripe UI used, CardFormView
seems to only be validating cards, not creating a PaymentMethod
using that card. I would like the latter, the Android equivalent of STPAddCardViewController
, which has a payment method added
callback, not just a is this card a valid one
callback. Does that make sense?
Thanks!
CardFormView seems to only be validating cards, not creating a PaymentMethod using that card
@ilazakis CardFormView does allow you to create a PaymentMethod, you have to manually call the createPaymentMethod()
function but CardFormView collects the payment method parameters for you to pass to that function.
Thanks @aliriaz-stripe!
We recommend using CardFormView which can be used from compose as describe here.
@michelleb-stripe I used CardFormView
per your recommendation above, but it looks like that component only gives one access to CardParams
, not PaymentMethodCreateParams
, which is what createPaymentMethod()
requires, per @aliriaz-stripe's comment above.
I'd be more than happy to use CardParams
to construct the required PaymentMethodCreateParams
manually, but:
PaymentMethodCreateParams
constructor is marked as internal i.e. inaccessible to code not belonging to StripeCardInputWidget is in maintenance mode and is not receiving new features, only major bug fixes.
CardInputWidget
does provide direct access to PaymentMethodCreateParams
, so not sure how to proceed without ignoring your recommendation to not use it. Hopefully, I've just missed something 😃
EDIT: It looks like what I was missing was the publicly available factory methods of PaymentMethodCreateParams
, specifically createCard
.
That said, CardFormView
still lacks a lot of functionality until it catches up with CardInputWidget
e.g. setting up a Locale
manually and ignoring country selection / postcode inputs.
Thanks both for your help! 👍
@ilazakis Glad you were able to get that working.
I added your request for setting up the locale manually and ignoring country selection / postcode inputs to our backlog. We will provide updates as we work on it.
Thank you @michelleb-stripe! I will be monitoring this issue for updates 👍
Just want to say that I'm also looking for better out of the box support for stripe + compose. As of right now I have a bug in my project (due to downstream dependencies) that prevents us from using a composable AndroidView. We're considering just building a library that will end up wrapping it, but as of right now I am just trying to build a form by myself to collect CC info. Which isn't actually too terrible, I just don't know how to take the info from here
and convert it into a PaymentMethod
Edit: Looks like the simplest way I could figure out how to do this was like this
val paymentMethod = stripe?.createPaymentMethod(
PaymentMethodCreateParams.createCard(
CardParams(
"4242424242424242",
1,
2024,
"211",
"Name",
null,
null,
null
)
)
)
CustomerSession.getInstance().attachPaymentMethod(paymentMethod?.id.toString(), object : CustomerSession.PaymentMethodRetrievalListener
Hi @michelleb-stripe @michelleb-stripe can we get an update on where this is in the backlog?
I could have sworn that they did release some compose stuff for stripe. in my case, i just built everything by hand.
This was opened in 2021 and we still don't have a Compose version of CardInputWidget?
@ColtonIdle Thank you for sharing some information about your integration. I see in the image you posted that you are building your own payment method collection form. Have you considered using PaymentSheet? If not, could you describe why you haven't?
Unfortunately, we don't have any future plans to migrate CardInputWidget
or similar to compose at the moment.
@jameswoo-stripe I honestly didn't know that was an option. I felt like when I integrated stripe into my app over a year ago I found it tough to figure out what options were available to me. Our two contraints were: 1. we wanted it to be contained in our own activity (we took a signle activity architecture approach) 2. use jetpack compose
ill take a look at payment sheet
We don't have plans to add compose support for CardInputWidget
. We do have first class support for compose with PaymentSheet
.
Thanks! Hopefully one day I have to use stripe again and I'll have this as a starting off point 😅
Hi, I'm looking for the currently proposed way to add / update payment methods (cards) when using @Composables.
I am effectively looking for the equivalent of
STPAddCardViewController
in iOS for Compose based apps, a built-in UI that captures all info within the Stripe SDK / UI and only returns a payment method id.I think I'm looking for the Compose equivalent of
CardInputWidget
?Context: I need to capture payment info for later use, not an on-demand payment.
Something like: