Create billing checkout
/v1/billing/checkoutThe payment page for a plan or a top-up, for a person to pay on.
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const checkout = await agental.checkout({ topUp: 500 });
- {
- "url": string | null,
- "changed": boolean,
- }
Where to send the browser: to save a card for the free plan, charging nothing; to pay for a plan; or for a top-up of credits that do not expire.
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 Where to send the browser: to save a card for the free plan, charging nothing; to pay for a plan; or for a top-up of credits that do not expire. An account that already has a plan and picks another is moved with nothing to pay on a page: url is null and changed is true, and the month's credits are each plan's for the part of the month it holds. A smaller plan is moved to at once, and a bigger one once the payment provider has charged the difference, within seconds. To go back to the free plan, cancel the plan in the billing portal.
urlchangedErrors and other answers
| 409 | billing_not_configured, already_on_plan, card_saved: a card is saved already, or |
| 409 | payment_late the plan's last payment has not gone through, so it is not changed until it has. |
| 429 | rate_limited. The account asked for too many amounts of top-up the store had no product for today. |
| 503 | billing_unavailable. The payment provider did not answer. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.