#momomonkey_android-setupintent-expandpm
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/1275201984969838794
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
hi
Give me a few minutes, I think retrieving PaymentMethods can only be done server side
Okay, confirmed. When you retrieve the SetupIntent, we'll return the PaymentMethod ID but nothing else. You'll need to retrieve the SetupIntent server side and expand payment_method or directly retrieve the PaymentMethod server side if you need last 4 and exp date.
Assuming you're creating a SetupIntent for a specific customer, you could also rely on webhooks and listen for payment_method.attached ; the payload for the event will include the PaymentMethod object and the customer ID
ok, I am just a bit confused because my coworker working on iOS is able to retrieve that information client side:
func setupIntentCompletion(status: STPPaymentHandlerActionStatus, setupIntent: STPSetupIntent?, error: NSError?) {
if status == .succeeded, let paymentMethodID = setupIntent?.paymentMethodID, let card = setupIntent?.paymentMethod?.card {
let paymentCard = StripePaymentMethodCard(brand: card.brand.description,
last4: card.last4 ?? "",
expMonth: card.expMonth,
expYear: card.expYear,
countryCode: "CA")
Hi ๐
I'm jumping in because I've got a little more experience with our mobile SDKs.
Both our iOS https://stripe.dev/stripe-ios/stripepayments/documentation/stripepayments/stpsetupintent and Android https://stripe.dev/stripe-android/payments-core/com.stripe.android.model/-setup-intent/index.html SDKs define the SetupIntent.paymentMethod as a nullable object. The way the iOS SDK describes it, makes it sound like this is something you need to request
The optionally expanded PaymentMethod used in this SetupIntent.
This suggests to me that somehow this is being requested via the iOS SDK following this doc https://docs.stripe.com/expand
I do see the iOS SDK includes a hash map property in the confirm Setup Intent params called additionalAPIParameters. This could allow the passing of an expand parameter in the confirmation.
But I do not see any corresponding parameter in the Android SDK method.
https://stripe.dev/stripe-android/payments-core/com.stripe.android.model/-confirm-setup-intent-params/index.html
Button("Save Card") {
setupIntentParams.paymentMethodParams = paymentMethodParams
setupIntentParams.paymentMethodParams?.type = .card
isConfirmingSetupIntent = true
}
the iOS app uses this when saving the card
Hmmm ๐ค
Give me a couple minutes to spin up an Android repo. Shouldn't take too long
Okay I've been able to repro but I'm also getting paymentMethod=null when I retrieve the Setup intent
๐คฆโโ๏ธ
All you need to do is pass the expand parameter in the retrieveSetupIntent to get the full Payment Method
val setupIntent = stripe.retrieveSetupIntent(clientSecret, expand = listOf("payment_method"))
Log.d(TAG, "SetupIntent: $setupIntent")
This code worked for me
will try it out now
I just feel dumb for building the whole thing into my Android integration and not noticing that earlier
that works, thank you so much
Great ๐ Happy to help ๐