Your customers' account pages
When a project has the plans service, the portal gets an account area for signed-in customers. It needs no code from you. This page describes what each part does, so you can support your customers and know what to check when something looks wrong.
The pages
| Page | What the customer does |
|---|---|
| Plans | Compares the plans from your plans.json and subscribes |
| API keys | Creates, lists and revokes keys |
| Usage | Sees the calls made with their keys |
| Settings | Manages the account details |
The pages appear when the plans service is part of the portal. A project with identity only has sign-in but no plans, keys or usage.
Plans
The plans come from plans.json. A plan has a name, limits, and optionally a price. The customer
subscribes to a plan and may hold more than one. Unsubscribing from a plan stops that plan's keys
from working and keeps the customer's other plans.
Free plans work without any payment. For paid plans see Sell a paid plan.
Paying for a plan
A plan with a price sends the customer to Stripe's checkout page. The portal never sees the card details.
- The customer chooses the plan and pays on Stripe's page.
- Stripe returns the customer to Billing. The page says it is confirming the payment for a few seconds, because Stripe tells the portal separately. Then the plan is active and the customer can create a key for it.
- If the customer closes the checkout or goes back, the Plans page says checkout was cancelled and nothing was charged.
If a payment fails, Stripe retries it. The subscription shows as past due. When Stripe finally
cancels it, the plan ends and its keys stop working with 401. The customer is not moved to a free
plan on their own. They can subscribe to one on the Plans page.
Cancelling and refunds
- The customer cancels on the Plans page. The subscription ends in Stripe at once, the plan
ends and the customer's keys stop working with
401. - You cancel a subscription in your Stripe dashboard. Stripe tells the portal, and the plan ends the same way.
- A refund is made in your Stripe dashboard. A refund alone does not end the plan: the customer keeps the key until the subscription is cancelled. Cancel it as well if the customer should lose access. The portal has no refund screen.
What you see is in your own Stripe account: payments, customers and refunds. APItoGo does not take a share and does not issue refunds. Tax and trials are not handled by the portal.
API keys
A key is created on the API keys page. A customer who no longer has a key can create a new one and revoke the old one.
- A key works for calls to your gateway address, in the
Ocp-Apim-Subscription-Keyheader. - The limits of the plan the key belongs to apply to every call made with it.
- A revoked key stops working at once, and the next call with it is answered with
401.
Usage
The usage page shows, for a period of 24 hours, 7, 30 or 90 days:
- the number of requests
- the average latency
- the error rate
- the requests by endpoint
- the requests by status code
A call is counted when it is made with a customer's key. A call without a key, or with a wrong key, is refused by the gateway and does not appear.
Answers of 400 and above count as errors, whoever caused them. If your API answers 404 to a path
the customer calls, those calls show as errors in the usage page.
When something looks wrong
| What the customer sees | What to check |
|---|---|
401 with a key that should work | The key was revoked, or the plan was cancelled or its payment ended. Check the API keys page. |
401 on a project you set up by hand | gateway.policies.access: when it also requires a login token, a key alone is refused. |
429 | The plan's limit was reached. The rate limit renews each period; the quota carries Retry-After. |
| A customer paid but has no plan | The webhook is missing or its signing secret is wrong. Check it in Stripe and in plans.billing. |
| The usage page shows nothing after real calls | Calls only count when made with a key. Check that the gateway has been deployed with plans. |
| Calls from the portal's own pages are blocked | Run apitogo deploy again. The gateway lists the portal's address after the portal exists. |