Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call out where to find ENV variable values #2

Open
davidgs opened this issue Jan 30, 2024 · 2 comments
Open

Call out where to find ENV variable values #2

davidgs opened this issue Jan 30, 2024 · 2 comments

Comments

@davidgs
Copy link

davidgs commented Jan 30, 2024

The docs have this, which is helpful:

# Stripe publishable key
export STRIPE_PUBLISHABLE_KEY="YOUR_STRIPE_PUBLISHABLE_KEY"

# Stripe secret key (don't share this!)
export STRIPE_SECRET_KEY="YOUR_STRIPE_SECRET_KEY"

# The Stripe plan to subscribe new customers to
export STRIPE_PLAN_ID="YOUR_STRIPE_PLAN_ID"

# Keygen product token (don't share this!)
export KEYGEN_PRODUCT_TOKEN="YOUR_KEYGEN_PRODUCT_TOKEN"

# Your Keygen account ID
export KEYGEN_ACCOUNT_ID="YOUR_KEYGEN_ACCOUNT_ID"

# The Keygen policy to use when creating licenses for new users
# after they successfully subscribe to a plan
export KEYGEN_POLICY_ID="YOUR_KEYGEN_POLICY_ID"

But links to where to find those values, or what a sample value might look like, would be super helpful. I have what I think are the right variables, but I keep getting

An error occurred during user creation: You do not have permission to complete the request (ensure a token or license is present and valid) (double check your ENV vars)

Which leads me to believe that one (or more?) of those values are wrong. But which one?

A STRIPE_PUBLISHABLE_KEY, I think, looks like pk_test_51O...kN and can be found at https://dashboard.stripe.com/test/apikeys , as can the STRIPE_SECRET_KEY

The STRIPE_PLAN_ID is a bit harder to figure out. I think you go to https://dashboard.stripe.com/subscriptions/products/ and choose a product, but then there are a lot of IDs on that page. I have tried the one at the top-right, prod_PTH...k4 but that doesn't actually work?

I got the KEYGEN_PRODUCT_TOKEN from https://app.keygen.sh/products then clicking on the product., and I get 5X3XY89X-1234-4XYX-1234-8925XY07YZ7X (It's referred to as the ID there, though).

I got the KEYGEN_ACCOUNT_ID from https://app.keygen.sh/settings which seems like the obvious choice.

The KEYGEN_POLICY_ID from https://app.keygen.sh/policies seemed like the right choice,

In my proxy, I'm seeing

HTTP Requests                                                                                                         
-------------                                                                                                         
                                                                                                                      
POST /stripe-webhooks          200 OK                                                                                 
POST /stripe-webhooks          200 OK                                                                                 
POST /stripe-webhooks          200 OK                                                                                 
POST /stripe-webhooks          200 OK               

but you'll notice that there are no attempts from keygen. For the subscriptions, I used * but still ... nothing?

What am I missing here?

@davidgs
Copy link
Author

davidgs commented Jan 30, 2024

A little more info as I dig further into this:

  1. There is this warning:
You’re using the legacy version of Stripe Checkout.

We released a new version of Checkout in April 2019, which supports mobile wallets and other payment methods:
https://stripe.com/docs/payments/checkout

Learn how to upgrade to the new version:
https://stripe.com/docs/payments/checkout/migration

So maybe the code needs a bit of a refresh. :-)

  1. It turns out that if you have checked the protected checkbox, which seemed like a good idea, you can't create users via the API, so you can't perform license purchases.

Unchecking that box fixed it all.

davidgs added a commit to davidgs/example-stripe-integration that referenced this issue Jan 30, 2024
davidgs added a commit to davidgs/example-stripe-integration that referenced this issue Jan 30, 2024
A doc fix to address issue keygen-sh#2, just to make things a bit more clear
@davidgs
Copy link
Author

davidgs commented Jan 30, 2024

Pull request #3 addresses all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant