I'm using the set of instructions from https://stripe.com/docs/mobile/android/standard in my Android/Kotlin app, and on the final onPaymentSessionDataChanged()
callback, I get a PaymentMethod
with an id that starts with pm_
. But what I want is a card token id that starts with card_
, which is what my server requires to continue payment.
Is there a way to translate this to get the card token, or should I be using a different methodology?
If it helps, I can put some code here.
Thanks.
Here you go:
Token token = null;
final Card card = new Card(cardNumber, month, year, cvc);
final Stripe stripe = new Stripe(getApplicationContext());
try {
token = stripe.createTokenSynchronous(card, "YOUR-API-KEY");
} catch (StripeException stripeEx) {
errorMessage = stripeEx.getLocalizedMessage();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.