Skip to main content

Automatically Buy Subscription Plan

Overview

This endpoint allows you to buy an API key with a subscription plan automatically.

Request

--request POST 'https://stablediffusionapi.com/api/v3/buy_subscription' \
caution

Before calling this endpoint, make sure that you have enabled Subscription Auto Payment on your dashboard

Send a POST request to https://stablediffusionapi.com/api/v3/buy_subscription endpoint and pass the desired plan_name to buy in the request body.

The available plan names are: basic_monthly, basic_yearly, standard_monthly,standard_yearly,premium_monthly and premium_yearly.

Attributes

ParameterTypeDescription
keyStringYour default API Key used for request authorization
plan_nameStringThe name of the plan you want to buy (basic_monthly, basic_yearly, standard_monthly, standard_yearly, premium_monthly or premium_yearly)

Example

Body

Body Raw
{
"key":"your-default-api-key",
"plan_name":"basic_monthly"
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"plan_name":"basic_monthly"
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://stablediffusionapi.com/api/v3/buy_subscription", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"messege": "You have just bought a custom api with basic plan",
"data": {
"key": "purchased-api-key-string",
"plan": "basic_monthly"
}
}