#mork-terminal-paymentmethodid
1 messages · Page 1 of 1 (latest)
mork-terminal-paymentmethodid
Hey @west salmon can you share which doc you are following and the code you have for Android?
Also what do you plan to do with the PaymentMethod id pm_ABC? It's not what we call "re-usable"
I was following this doc here
this is my android code:
fun confirmSetupIntent() {
Terminal.getInstance().confirmSetupIntent(setupIntent!!, getConfirmSetupIntentCallback())
}
private fun getConfirmSetupIntentCallback() : SetupIntentCallback {
val self = this
return object : SetupIntentCallback {
override fun onSuccess(setupIntent: SetupIntent) {
self.setupIntent = setupIntent
context.runOnUiThread {
NativeMethodChannel.platformMessage(PlatformMessage(TerminalConstants.CONFIRM_SETUP_INTENT_SUCCESS, setupIntent.paymentMethodId!!))
}
}
override fun onFailure(e: TerminalException) {
context.runOnUiThread {
NativeMethodChannel.platformMessage(PlatformMessage(TerminalConstants.CONFIRM_SETUP_INTENT_FAIL, e.errorMessage))
}
}
}
}
we gonna send the payment method id to salesforce and salesforce will create a payment intent and processes the payment
yeah you're misunderstnading how this works. The pm_123 you get can not be used for future payments.
The way it works is that you collect a card_present PaymentMethod pm_123 and that is one-time use. In turn, Stripe will also generate a separate card PaymentMethod pm_ABC with the same card details and that one can be re-used. That one would be automatically attached to the Customer for you (which is what the doc mention)
The way it works is that server-side you can look at the SetupIntent, it has latest_attempt: 'setatt_123' that represents the most recent attempt. That will have the pm_ABC you want: https://stripe.com/docs/api/setup_attempts/object#setup_attempt_object-payment_method_details-card_present-generated_card
hum, gotcha. So I just need to get this payment method from the customer and I can proceed with my payment
yep