tier connect

This command is used to grant the tier CLI access to your Stripe account, so that it the push and pull commands may be used.

A random human-readable key will be generated, along with a confirmation link to the Stripe dashboard. When the URL is loaded, the key will be displayed again on the web page for confirmation.

At the Stripe dashboard URL, ensure that the key matches, and select which Stripe account should be used with Tier.

$ tier connect
Tier connect instructions:

1. Take a mental note of the following code:

	reform-softer-jovial-usable

2. Follow this link and verify the above code:

	https://dashboard.stripe.com/stripecli/confirm_auth?t=1cL3Wp9w7l5nkchlUaofzSf4WFjyqmrE

3. Return here and continue using Tier.

Upon completion of the authorization step, new restricted livemode and testmode keys will be minted and stored in ~/.config/tier/config.json for Tier's use.

Important Caveat

The minted key is only used if the STRIPE_API_KEY is not set in the environment. If it is, then the supplied key from the environment is used, regardless of what is stored in ~/.config/tier/config.json. If you are using tier connect and it seems to still not be working, ensure that you do not have STRIPE_API_KEY set in your environment, and try again:

$ tier connect
# ...

$ tier pull
tier: {"status":401,"message":"Invalid API Key provided: pk_live_************Tier","type":"invalid_request_error"}
exit status 1

$ # ???

$ echo $STRIPE_API_KEY
pk_live_notTheKeyForTier

$ # aha

$ unset STRIPE_API_KEY

$ # now it'll work

$ tier pull
{
"plans": {
"plan:foo:bar@1": {
...

Live Mode Usage

In order to use the generated restricted key for live mode pushes, it must have additional permissions granted on the Stripe dashboard.

Go to https://dashboard.stripe.com/apikeys, and scroll to the bottom of the list to find the newly minted key.

Click the [...] button on the right-hand side, and select Edit.

Click Write for the "All Billing Resources" and "All Core Resources" sections, and click "Apply Changes" at the bottom.

More documentation about restricted key usage and permissions is available on Stripe's website.