Start a Stripe Checkout to upgrade.
const url = 'https://api.opdns.io/v1/account/billing/checkout';const options = { method: 'POST', headers: { cookie: '__Host-opdns_session=<__Host-opdns_session>', 'Content-Type': 'application/json' }, body: '{"plan":"personal","interval":"yearly"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.opdns.io/v1/account/billing/checkout \ --header 'Content-Type: application/json' \ --cookie __Host-opdns_session=<__Host-opdns_session> \ --data '{ "plan": "personal", "interval": "yearly" }'The organisation owner’s session only. Returns the URL of a Stripe Checkout
session for one subscription to plan billed interval; the dashboard sends the
browser there. Checkout collects the card and the billing address, and Stripe Tax
adds the sales tax (GST/HST and QST in Canada) the buyer owes; Solutions Opero Inc
is the seller and Stripe issues the invoice in its name. The organisation is one
Stripe customer (created at its first checkout, with the owner’s email). When the
payment completes, Stripe’s webhook moves the organisation to the plan (source
billing) and the browser returns to the dashboard’s Account page
(?billing=success; the checkout’s back link is ?billing=cancelled). An
organisation with a live subscription
changes or cancels it in the portal instead (409 subscription_exists). A plan
and interval without a price on this deployment is 422 validation_failed.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "plan": "personal", "interval": "yearly"}Responses
Section titled “Responses”The Checkout URL.
object
Where the dashboard sends the browser (Stripe’s page, short-lived).
Example
{ "url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3"}Malformed request.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "We couldn't read the request because its JSON isn't valid (unexpected end of JSON input). Please fix it and try again.", "request_id": "5f2c9a0e7b1d4c38"}Not authenticated.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/unauthenticated", "title": "Unauthorized", "status": 401, "code": "unauthenticated", "detail": "You're not signed in, or your sign-in has ended. Please sign in again to continue.", "request_id": "5f2c9a0e7b1d4c38"}Authenticated but not allowed: insufficient_scope, session_required, csrf_rejected, reauth_required (sign in again within five minutes), account_pending_deletion (the account is in its deletion cooling-off), email_unverified (creating a profile before the email address is verified).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/insufficient_scope", "title": "Forbidden", "status": 403, "code": "insufficient_scope", "detail": "This API token isn't allowed to do this: it needs the profiles:write scope. Create a token that includes it, then try again.", "required_scope": "profiles:write", "request_id": "5f2c9a0e7b1d4c38"}Conflict. On POSTs with an Idempotency-Key: idempotency_key_reused (the key was used with a different request) or idempotency_in_progress (the first request with it is still running; retry after Retry-After).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/idempotency_key_reused", "title": "Conflict", "status": 409, "code": "idempotency_key_reused", "detail": "This Idempotency-Key was already used with a different request. Please use a new key for each new request.", "request_id": "5f2c9a0e7b1d4c38"}Headers
Section titled “Headers”Field validation failed (validation_failed, unknown_list), or the organisation’s plan does not allow the write (plan_limit, naming the limit in limit).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/validation_failed", "title": "Unprocessable Content", "status": 422, "code": "validation_failed", "detail": "Some of what you sent needs fixing. The list of errors says what to change.", "errors": [ { "field": "settings.block_mode", "message": "one of nxdomain, refused, null, block-page" } ], "request_id": "5f2c9a0e7b1d4c38"}The payment provider (Stripe) failed or did not answer.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/billing_provider_error", "title": "Bad Gateway", "status": 502, "code": "billing_provider_error", "detail": "Our payment provider isn't responding right now. This isn't a problem with your account. Please try again in a minute."}Billing is not available on this deployment (no payment keys yet).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/billing_unavailable", "title": "Service Unavailable", "status": 503, "code": "billing_unavailable", "detail": "Payments aren't available yet, so plans can't be bought or changed right now. Please check back later."}