创建Stripe客户-无法解析符号apiKey [英] Creating Stripe Customer - cannot resolve symbol apiKey

查看:53
本文介绍了创建Stripe客户-无法解析符号apiKey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android Studio中,即使我直接从条纹文档中复制和粘贴代码,也从此行收到无法解析符号apiKey"错误:

In Android Studio, even though I'm copying and pasting the code directly from the stripe docs, I'm getting the "cannot resolve symbol apiKey" error from this line:

Stripe.apiKey = "sk_test_notmyrealapikey";

我已经将条纹线添加到我的gradle中:

I've already added the stripe line to my gradle:

compile 'com.stripe:stripe-android:+'

我已经成功地将卡信息交换为令牌,但是现在我正尝试使用该令牌来创建客户.当我删除Stripe.apiKey行时,stripe的错误消息告诉我添加它.

I'm successfully exchanging the card information for a token, but now I'm trying to use that token to create a customer. When I remove the Stripe.apiKey line, stripe's error message tells me to add it.

我以为我可能没有正确地引用条带库,但似乎唯一要做的就是将该行添加到应用程序的成绩文件中,而我确实做到了!

I thought maybe I didn't reference the stripe library correctly but it seems that the only thing I'm supposed to do is add that line to my app's grade file and I did!

我在网上没有发现其他人有这个问题,所以我很高兴听到任何想法!

I haven't found anyone else online having this problem so I'd be really happy to hear any ideas!

这是我从没有apikey的条纹中得到的错误:

Here is the error I get from stripe without the apikey:

com.stripe.exception.AuthenticationException: No API key provided. (HINT: set your API key using 'Stripe.apiKey = <API-KEY>'. 

推荐答案

您需要导入Stripe API库.大多数IDE应该自动告诉您添加它,但是如果它没有将此行添加到顶部

You need to import the Stripe API library. Most IDEs should automatically tell you to add it but in case it does not add this line to the top

import com.stripe.Stripe;

这篇关于创建Stripe客户-无法解析符号apiKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆