Creating Stripe Customer - cannot resolve symbol apiKey

ぃ、小莉子 提交于 2019-12-11 19:38:19

问题


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";

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

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

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!

EDIT:

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>'. 

回答1:


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;


来源:https://stackoverflow.com/questions/31768006/creating-stripe-customer-cannot-resolve-symbol-apikey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!