Create plan
curl --request POST \
--url https://api.lojou.app/v1/plan \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_pid": "J5bgs",
"price": 1500,
"name": "Mensal",
"description": "<string>",
"plan_id": "<string>",
"billing_interval_count": 2,
"trial_days": 1,
"is_active": true
}
'import requests
url = "https://api.lojou.app/v1/plan"
payload = {
"product_pid": "J5bgs",
"price": 1500,
"name": "Mensal",
"description": "<string>",
"plan_id": "<string>",
"billing_interval_count": 2,
"trial_days": 1,
"is_active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_pid: 'J5bgs',
price: 1500,
name: 'Mensal',
description: '<string>',
plan_id: '<string>',
billing_interval_count: 2,
trial_days: 1,
is_active: true
})
};
fetch('https://api.lojou.app/v1/plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lojou.app/v1/plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'product_pid' => 'J5bgs',
'price' => 1500,
'name' => 'Mensal',
'description' => '<string>',
'plan_id' => '<string>',
'billing_interval_count' => 2,
'trial_days' => 1,
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lojou.app/v1/plan"
payload := strings.NewReader("{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lojou.app/v1/plan")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Plan created successfully.",
"data": {
"plan_id": "8k2mZ",
"product_pid": "J5bgs",
"name": "Mensal",
"description": "Acesso a todo o conteúdo, renovado todo mês.",
"price": 1500,
"currency": "MZN",
"billing_interval": "monthly",
"billing_interval_count": 1,
"trial_days": 0,
"is_active": true,
"created_at": "2026-08-31T16:15:00.000000Z",
"updated_at": "2026-08-31T16:15:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Resource not found."
}{
"status": "error",
"message": "This product does not support plans."
}Plans
Create plan
Only for products created with type: recurring.
POST
/
v1
/
plan
Create plan
curl --request POST \
--url https://api.lojou.app/v1/plan \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_pid": "J5bgs",
"price": 1500,
"name": "Mensal",
"description": "<string>",
"plan_id": "<string>",
"billing_interval_count": 2,
"trial_days": 1,
"is_active": true
}
'import requests
url = "https://api.lojou.app/v1/plan"
payload = {
"product_pid": "J5bgs",
"price": 1500,
"name": "Mensal",
"description": "<string>",
"plan_id": "<string>",
"billing_interval_count": 2,
"trial_days": 1,
"is_active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_pid: 'J5bgs',
price: 1500,
name: 'Mensal',
description: '<string>',
plan_id: '<string>',
billing_interval_count: 2,
trial_days: 1,
is_active: true
})
};
fetch('https://api.lojou.app/v1/plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lojou.app/v1/plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'product_pid' => 'J5bgs',
'price' => 1500,
'name' => 'Mensal',
'description' => '<string>',
'plan_id' => '<string>',
'billing_interval_count' => 2,
'trial_days' => 1,
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lojou.app/v1/plan"
payload := strings.NewReader("{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lojou.app/v1/plan")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_pid\": \"J5bgs\",\n \"price\": 1500,\n \"name\": \"Mensal\",\n \"description\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"billing_interval_count\": 2,\n \"trial_days\": 1,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Plan created successfully.",
"data": {
"plan_id": "8k2mZ",
"product_pid": "J5bgs",
"name": "Mensal",
"description": "Acesso a todo o conteúdo, renovado todo mês.",
"price": 1500,
"currency": "MZN",
"billing_interval": "monthly",
"billing_interval_count": 1,
"trial_days": 0,
"is_active": true,
"created_at": "2026-08-31T16:15:00.000000Z",
"updated_at": "2026-08-31T16:15:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Resource not found."
}{
"status": "error",
"message": "This product does not support plans."
}Autorizações
Send an API key or an OAuth access token in the Authorization header
as a Bearer token. See Authentication for details.
Corpo
application/json
Exemplo:
"J5bgs"
Intervalo necessário:
x >= 0Exemplo:
1500
Exemplo:
"Mensal"
Opções disponíveis:
daily, weekly, monthly, yearly Intervalo necessário:
x >= 1Intervalo necessário:
x >= 0Resposta
Plan created
The response is of type object.
