Detalhes do Preço
curl --request GET \
--url https://garu.com.br/api/subscription-prices/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://garu.com.br/api/subscription-prices/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://garu.com.br/api/subscription-prices/{id}', 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://garu.com.br/api/subscription-prices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://garu.com.br/api/subscription-prices/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://garu.com.br/api/subscription-prices/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/subscription-prices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 123,
"uuid": "<string>",
"productId": "<string>",
"name": "<string>",
"amount": 123,
"billingInterval": "<string>",
"trialDays": 123,
"isActive": true
}Preços de Assinatura
Detalhes do Preço
Consulte os detalhes de um preço de assinatura específico
GET
/
api
/
subscription-prices
/
{id}
Detalhes do Preço
curl --request GET \
--url https://garu.com.br/api/subscription-prices/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://garu.com.br/api/subscription-prices/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://garu.com.br/api/subscription-prices/{id}', 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://garu.com.br/api/subscription-prices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://garu.com.br/api/subscription-prices/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://garu.com.br/api/subscription-prices/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/subscription-prices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 123,
"uuid": "<string>",
"productId": "<string>",
"name": "<string>",
"amount": 123,
"billingInterval": "<string>",
"trialDays": 123,
"isActive": true
}Visão Geral
Retorna os detalhes completos de um preço de assinatura específico pelo ID.Exemplo de Requisição
curl -X GET https://garu.com.br/api/subscription-prices/456 \
-H "Authorization: Bearer sk_test_sua_chave"
const response = await fetch(
'https://garu.com.br/api/subscription-prices/456',
{
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`
}
}
);
const preco = await response.json();
console.log(`Plano: ${preco.name}`);
console.log(`Valor: R$ ${preco.amount.toFixed(2)}`);
console.log(`Intervalo: ${preco.billingInterval}`);
import requests
import os
url = "https://garu.com.br/api/subscription-prices/456"
headers = {
"Authorization": f"Bearer {os.environ['GARU_API_KEY']}"
}
response = requests.get(url, headers=headers)
preco = response.json()
print(f"Plano: {preco['name']}")
print(f"Valor: R$ {preco['amount']:.2f}")
print(f"Intervalo: {preco['billingInterval']}")
Resposta de Sucesso
number
ID interno do preço.
string
Identificador único usado no link de checkout.
string
UUID do produto pai.
string
Nome do plano.
number
Valor em Reais.
string
Intervalo de cobrança:
daily, weekly, monthly, annually.number
Dias de teste gratuito.
boolean
Se o plano está ativo para novas assinaturas.
Exemplo de Resposta (200 OK)
{
"id": "price_def456uvw",
"productId": "prod_abc123xyz",
"sellerId": 1,
"name": "Plano Mensal",
"amount": 49.90,
"currency": "BRL",
"billingInterval": "monthly",
"trialDays": 7,
"isActive": true,
"createdAt": "2024-01-15T10:35:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z"
}
Erros Comuns
404 - Preço não encontrado
404 - Preço não encontrado
{
"statusCode": 404,
"message": "Subscription price not found"
}
Próximos Passos
Atualizar Preço
Atualize um preço existente
Excluir Preço
Remova um preço
Was this page helpful?