繁体   English   中英

在Android上从Stripe获取卡片令牌

[英]Get card token from Stripe on android

我在我的Android / Kotlin应用程序中使用https://stripe.com/docs/mobile/android/standard中的一组说明,在最后的onPaymentSessionDataChanged()回调中,我得到一个ID为开头的PaymentMethod pm_ 但我想要的是以card_开头的卡片令牌ID,这是我的服务器继续付款所需的。

有没有办法翻译这个以获得卡片令牌,或者我应该使用不同的方法?

如果它有帮助,我可以在这里放一些代码。

谢谢。

干得好:

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();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM