Skip to Content
Account

Start an app subscription the Vizbl Shopify app creates through Shopify Billing — auto top-up (a usage charge with a cap the merchant approves once) or a plan assigned to the account (monthly, optionally with auto top-up), by plan_id or by the plan link the merchant came by (plan_link): returns the intent and the exact appSubscriptionCreate parameters (result=checkout), or, for a plan link that cannot be charged, result=blocked with the reason and nothing created. Charges and activates nothing; that happens only when Shopify reports the subscription approved. A store key needs developer:account:read, an account-wide key developer:billing:checkout and a store_id

POST
/developer-api/billing/subscriptions

Authorization

bearer
headerAuthorizationBearer <secret_api_key>

Use Authorization: Bearer <secret_api_key>.

Request Body

application/json
  1. body
kind*string

auto_top_up: a usage charge only (capped_amount, threshold_tokens and top_up_tokens required). plan: a plan of billing/offer.assigned_plans (plan_id required), with auto top-up beside it when the three auto top-up fields are given — or, with those three fields, the plan the store already pays for through Shopify: to add auto top-up to it, or to approve auto top-up anew beside it (a new usage charge at the token price of today).

Value in"auto_top_up""plan"
plan_id?string

kind plan only: a plan of billing/offer.assigned_plans — or, with the three auto top-up fields, the plan the store pays for through Shopify (billing/offer.shopify_subscription.plan_id). Pass this or plan_link.

Length1 <= length
plan_link?string

kind plan only: the plan link the merchant came by (the plan_link query parameter the app was opened with). The plan is the link's; when it cannot be charged the answer is result=blocked with a reason, and no intent is created. Pass this or plan_id.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
capped_amount?|

The most Shopify may charge for auto top-ups in 30 days: at least the price of one top-up, at most the account limit.

threshold_tokens?integer

Top up when the balance falls to this many tokens.

Range0 <= value <= 9007199254740991
top_up_tokens?integer

Tokens of one top-up, between token_catalog.min_tokens and max_tokens and above threshold_tokens.

Range0 < value <= 9007199254740991
store_id?string

The connected Shopify store to charge through; an account-wide key only — a store key always uses its own store.

Length1 <= length

Response Body

Invalid request

application/json
  1. response
status*number
Value in100101102103200201202203204205206207208210300301302303304307308400401402403404405406407408409410411412413414415416417418421422423424428429456500501502503504505507508
code*string

Machine-readable error id (i18n dictionary key), e.g. shopify.ERROR_ID_TOKEN_INVALID; http_error.<STATUS> when there is no specific one.

error*array<string>
retryAfterSeconds?integer
Range0 <= value <= 9007199254740991
manageUrl?string

Where this account pays instead: the Vizbl app billing page in the Shopify admin (subscription.ERROR_PAYMENTS_THROUGH_SHOPIFY_APP).

Formaturi
manage_url?stringDeprecated

Deprecated: the same as manageUrl, kept for the clients that still read it.

Formaturi
stack?string
curl -X POST 'https://api.vizbl.com/developer-api/billing/subscriptions' \  -H 'Content-Type: application/json' \  -d '{  "kind": "plan",  "plan_link": "e5f6a7b8-c9d0-4e1f-a2b3-c4d5e6f7a8b9"}'
Example Response
{  "status": 100,  "code": "string",  "error": [    "string"  ],  "retryAfterSeconds": 0,  "manageUrl": "http://example.com",  "manage_url": "http://example.com",  "stack": "string"}