Search documentation

Search across BlockBee docs, API endpoints, webhooks and guides.

Create Subscription

View as Markdown

Use this endpoint to create or update a Subscription for a given user. If a Subscription Option is provided, a payment will be prepared and a checkout URL returned.

The customer will be notified before the subscription expires, so they can manually renew it.

Notes:

  • Requires a configured Subscription Service.
  • At least one cryptocurrency must be enabled in the service options to generate a payment link.

Method: GET

Path: https://api.blockbee.io/subscription/create/


Parameters

Query Parameters

apikeystring•Required

API Key provided by BlockBee's Dashboard. Unsure how to get yours? Check this tutorial.

Note: The API key can also be sent as a header named apikey.

user_idstring•Required

User identifier in your system.

Example:user_1234

user_emailstring•Required

Customer e-mail to notify before subscription expiration.

optionstring

Unique identifier for the subscription plan that the user will be charged for. This is useful when displaying subscription options on your own website or application.

Notes:

  • When a subscription plan slug is provided, the subscription_url will be converted to a direct payment link for that specific plan.
Example:pro

postnumber

Set this to 1 if you wish to receive the IPN as a POST request. If set to 0, API will default to GET.

Notes:

  • GET parameters you added to the notify_url URL will still be sent as GET.
Example:1

Returns

Returns the subscription details, including the subscription URL and a token.

statusstring

Status of the request.

tokenstring

Token associated with the created subscription.

subscription_urlstring

Subscription or payment link for the customer.

Errors

Besides the common errors (API key, IP whitelist, KYC tier, domain verification, maintenance), this endpoint can return:

ErrorHTTPCause
CSRF error, please try again403The request was sent as POST. Send it as GET.
No user id provided400user_id is missing or empty.
No user e-mail provided400user_email is missing or empty.
Subscriptions are not configured400The API key's profile has no Subscription Service set up in the Dashboard.
Notify URL is not configured in the dashboard400Your Subscription Service has no notify URL.
Redirect URL is not configured in the dashboard400Your Subscription Service has no redirect URL.
User email is not valid400user_email isn't a valid e-mail address.
Subscription Option does not exist400option matches no visible option of your Subscription Service, or that option has no price above 0.
There are no cryptocurrencies selected400No coin enabled in your Payment Settings can take the price of option.
Failing creating the subscription400We couldn't create the subscription or its payment, for example because user_id has more than 128 characters. Check your input and retry.