【发布时间】:2017-06-15 04:14:03
【问题描述】:
我在我的 Android 应用中使用 Stripe 作为支付处理器,并尝试按照文档中的描述从卡中扣款:https://stripe.com/docs/charges
我的问题具体是它无法解决Stripe.apiKey或can not resolve symbol apiKey
我从文档中实现的代码:
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_********************";//this is where i hit a wall
// Token is created using Stripe.js or Checkout!
// Get the payment token submitted by the form:
String token = request.getParameter("stripeToken");
// Charge the user's card:
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 1000);
params.put("currency", "usd");
params.put("description", "Example charge");
params.put("source", token);
Charge charge = Charge.create(params);
我还在文件顶部导入了import com.stripe.android.*;。
在我的 Gradle 文件中,我已经导入了 Stripe 库:
compile 'com.stripe:stripe-android:2.0.2'
为什么 Android 无法解析 Stripe.apiKey?
【问题讨论】:
-
确保你使用了
com.stripe.Stripe而不是其他一些包