Criar plano
curl --request POST \
--url https://alpa-sistema-api.onrender.com/api/subscriptions/plans \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Plano Mensal Premium",
"amountCents": 9900,
"interval": "MONTHLY",
"description": "Acesso completo com suporte prioritário",
"trialDays": 7,
"maxSubscribers": 2
}
'import requests
url = "https://alpa-sistema-api.onrender.com/api/subscriptions/plans"
payload = {
"name": "Plano Mensal Premium",
"amountCents": 9900,
"interval": "MONTHLY",
"description": "Acesso completo com suporte prioritário",
"trialDays": 7,
"maxSubscribers": 2
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Plano Mensal Premium',
amountCents: 9900,
interval: 'MONTHLY',
description: 'Acesso completo com suporte prioritário',
trialDays: 7,
maxSubscribers: 2
})
};
fetch('https://alpa-sistema-api.onrender.com/api/subscriptions/plans', 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://alpa-sistema-api.onrender.com/api/subscriptions/plans",
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([
'name' => 'Plano Mensal Premium',
'amountCents' => 9900,
'interval' => 'MONTHLY',
'description' => 'Acesso completo com suporte prioritário',
'trialDays' => 7,
'maxSubscribers' => 2
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://alpa-sistema-api.onrender.com/api/subscriptions/plans"
payload := strings.NewReader("{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
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://alpa-sistema-api.onrender.com/api/subscriptions/plans")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://alpa-sistema-api.onrender.com/api/subscriptions/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Plano Mensal",
"description": "<string>",
"amountCents": 9900,
"interval": "MONTHLY",
"trialDays": 7,
"maxSubscribers": 123,
"active": true,
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"code": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"path": "<string>",
"errors": [
{}
]
}{
"message": "<string>"
}Assinaturas
Criar plano
Cria um novo plano de assinatura recorrente
POST
/
api
/
subscriptions
/
plans
Criar plano
curl --request POST \
--url https://alpa-sistema-api.onrender.com/api/subscriptions/plans \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Plano Mensal Premium",
"amountCents": 9900,
"interval": "MONTHLY",
"description": "Acesso completo com suporte prioritário",
"trialDays": 7,
"maxSubscribers": 2
}
'import requests
url = "https://alpa-sistema-api.onrender.com/api/subscriptions/plans"
payload = {
"name": "Plano Mensal Premium",
"amountCents": 9900,
"interval": "MONTHLY",
"description": "Acesso completo com suporte prioritário",
"trialDays": 7,
"maxSubscribers": 2
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Plano Mensal Premium',
amountCents: 9900,
interval: 'MONTHLY',
description: 'Acesso completo com suporte prioritário',
trialDays: 7,
maxSubscribers: 2
})
};
fetch('https://alpa-sistema-api.onrender.com/api/subscriptions/plans', 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://alpa-sistema-api.onrender.com/api/subscriptions/plans",
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([
'name' => 'Plano Mensal Premium',
'amountCents' => 9900,
'interval' => 'MONTHLY',
'description' => 'Acesso completo com suporte prioritário',
'trialDays' => 7,
'maxSubscribers' => 2
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://alpa-sistema-api.onrender.com/api/subscriptions/plans"
payload := strings.NewReader("{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
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://alpa-sistema-api.onrender.com/api/subscriptions/plans")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://alpa-sistema-api.onrender.com/api/subscriptions/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Plano Mensal Premium\",\n \"amountCents\": 9900,\n \"interval\": \"MONTHLY\",\n \"description\": \"Acesso completo com suporte prioritário\",\n \"trialDays\": 7,\n \"maxSubscribers\": 2\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Plano Mensal",
"description": "<string>",
"amountCents": 9900,
"interval": "MONTHLY",
"trialDays": 7,
"maxSubscribers": 123,
"active": true,
"createdAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"code": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"path": "<string>",
"errors": [
{}
]
}{
"message": "<string>"
}Authorizations
Chave de API obtida através do endpoint /api/credentials. Também aceita formato Bearer Token: Authorization: Bearer <api_key>
Body
application/json
Example:
"Plano Mensal Premium"
Valor em centavos (mínimo R$ 5,00)
Required range:
x >= 500Example:
9900
Available options:
MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL Example:
"MONTHLY"
Example:
"Acesso completo com suporte prioritário"
Required range:
x >= 0Example:
7
Required range:
x >= 1⌘I

