在搜索了关于使用 stripe 充值卡的很多问题之后。大多数问题都是尚未回答,无法找到收费方式。
这是我在我的项目中所做的: 我能够从 strip 服务器成功获取 token 。
try {
carToSave = mCardInputWidget.getCard();
Log.d(TAG, carToSave.toString());
if (carToSave == null) {
Toast.makeText(this, "Please fill information", Toast.LENGTH_SHORT).show();
} else {
//get key from https://dashboard.stripe.com/account/apikeys
Stripe stripe = new Stripe(StripeActivity.this, "put key here");
stripe.createToken(carToSave, new TokenCallback() {
@Override
public void onError(Exception error) {
// Show localized error message
Log.d(TAG, "onError");
}
@Override
public void onSuccess(Token token) {
//do charge with token
Log.d(TAG, token.getId());//token
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
我在 Creating Charges Official docs 上花了很多时间在官方文档中,他们使用 Charge 类对卡进行收费,但该类未包含在最新文档中。
3.我关注了Official Stripe Github却空手而去。
注意:大多数文档都使用 Charge 类,但该类未包含在最新的 stripe sdk 中。
最佳答案
我也遇到了同样的问题,所以我看了一下这篇文章。 Charge 类和 Stripe.api key 都在其 Java SDK 中可用。
实现 'com.stripe:stripe-java:5.36.0'
关于java - 如何使用 Java(Android) 在 Stripe 中为卡充值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47504759/