#asim_1
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- asim_1, 1 day ago, 91 messages
It is common to save the ID in assosciation with the customer on your side
Otherwise you can list related payment methods https://stripe.com/docs/api/payment_methods/list#list_payment_methods-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or set it as the default payment method for the customer and retrive the customer later https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
In this flow, on the Android side, when the stripe form submits and reponds 'success', does it return the chosen card ID for the customer anywhere?
Why would I set some account as default? The payment sheet UI allows the user to select one particular account that he wants to get charged.
I should have clarified that I'm using Android + Web for this integration.
The customer choose a payment method on the Android app. I want that payment's ID so I can use it with a payment intent later.
Good question, checking in to this and will get back to you
you can do like this
private fun onPaymentSheetResult(paymentSheetResult: PaymentSheetResult) {
when(paymentSheetResult) {
is PaymentSheetResult.Canceled -> {
// ...
}
is PaymentSheetResult.Failed -> {
// ...
}
is PaymentSheetResult.Completed -> {
stripe.retrieveSetupIntent(
clientSecret,
callback = object : ApiResultCallback<SetupIntent> {
override fun onSuccess(result: SetupIntent) {
var id = result.paymentMethodId
if (id != null) {
Log.d("paymentMethodId", id)
}
// ...
}
override fun onError(e: Exception) {
error("Could not retrieve SetupIntent, $e\n")
// ...
}
}
)
// ...
}
}
}
or access .payment_method on the SetupIntent in the backend while handlng webhooks or so on.
And you will also likely want to listen for the payment_method.attached event as things can go wrong with your client trying to tell your server about that ID