Criar Produto
curl --request POST \
--url https://garu.com.br/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"image": "<string>",
"value": 123,
"description": "<string>",
"pix": true,
"creditCard": true,
"boleto": true,
"pixAutomatic": true,
"installments": 123,
"tags": [
"<string>"
],
"returnUrl": "<string>",
"returnUrlButtonText": "<string>",
"pixelFB": "<string>",
"isSubscription": true
}
'import requests
url = "https://garu.com.br/api/v1/products"
payload = {
"name": "<string>",
"image": "<string>",
"value": 123,
"description": "<string>",
"pix": True,
"creditCard": True,
"boleto": True,
"pixAutomatic": True,
"installments": 123,
"tags": ["<string>"],
"returnUrl": "<string>",
"returnUrlButtonText": "<string>",
"pixelFB": "<string>",
"isSubscription": 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({
name: '<string>',
image: '<string>',
value: 123,
description: '<string>',
pix: true,
creditCard: true,
boleto: true,
pixAutomatic: true,
installments: 123,
tags: ['<string>'],
returnUrl: '<string>',
returnUrlButtonText: '<string>',
pixelFB: '<string>',
isSubscription: true
})
};
fetch('https://garu.com.br/api/v1/products', 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/v1/products",
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' => '<string>',
'image' => '<string>',
'value' => 123,
'description' => '<string>',
'pix' => true,
'creditCard' => true,
'boleto' => true,
'pixAutomatic' => true,
'installments' => 123,
'tags' => [
'<string>'
],
'returnUrl' => '<string>',
'returnUrlButtonText' => '<string>',
'pixelFB' => '<string>',
'isSubscription' => 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://garu.com.br/api/v1/products"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": 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://garu.com.br/api/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/v1/products")
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 \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": true\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"pix": true,
"creditCard": true,
"boleto": true,
"pixAutomatic": true,
"installments": [
{}
],
"isActive": true,
"isSubscription": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}Produtos
Criar Produto
Aprenda a criar produtos para vendas avulsas ou assinaturas via API
POST
/
api
/
v1
/
products
Criar Produto
curl --request POST \
--url https://garu.com.br/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"image": "<string>",
"value": 123,
"description": "<string>",
"pix": true,
"creditCard": true,
"boleto": true,
"pixAutomatic": true,
"installments": 123,
"tags": [
"<string>"
],
"returnUrl": "<string>",
"returnUrlButtonText": "<string>",
"pixelFB": "<string>",
"isSubscription": true
}
'import requests
url = "https://garu.com.br/api/v1/products"
payload = {
"name": "<string>",
"image": "<string>",
"value": 123,
"description": "<string>",
"pix": True,
"creditCard": True,
"boleto": True,
"pixAutomatic": True,
"installments": 123,
"tags": ["<string>"],
"returnUrl": "<string>",
"returnUrlButtonText": "<string>",
"pixelFB": "<string>",
"isSubscription": 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({
name: '<string>',
image: '<string>',
value: 123,
description: '<string>',
pix: true,
creditCard: true,
boleto: true,
pixAutomatic: true,
installments: 123,
tags: ['<string>'],
returnUrl: '<string>',
returnUrlButtonText: '<string>',
pixelFB: '<string>',
isSubscription: true
})
};
fetch('https://garu.com.br/api/v1/products', 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/v1/products",
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' => '<string>',
'image' => '<string>',
'value' => 123,
'description' => '<string>',
'pix' => true,
'creditCard' => true,
'boleto' => true,
'pixAutomatic' => true,
'installments' => 123,
'tags' => [
'<string>'
],
'returnUrl' => '<string>',
'returnUrlButtonText' => '<string>',
'pixelFB' => '<string>',
'isSubscription' => 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://garu.com.br/api/v1/products"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": 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://garu.com.br/api/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://garu.com.br/api/v1/products")
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 \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"value\": 123,\n \"description\": \"<string>\",\n \"pix\": true,\n \"creditCard\": true,\n \"boleto\": true,\n \"pixAutomatic\": true,\n \"installments\": 123,\n \"tags\": [\n \"<string>\"\n ],\n \"returnUrl\": \"<string>\",\n \"returnUrlButtonText\": \"<string>\",\n \"pixelFB\": \"<string>\",\n \"isSubscription\": true\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"pix": true,
"creditCard": true,
"boleto": true,
"pixAutomatic": true,
"installments": [
{}
],
"isActive": true,
"isSubscription": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}Visão Geral
O endpoint de criação de produtos permite que você crie produtos para vendas avulsas (one-time purchases) ou assinaturas (recurring billing). Cada produto criado recebe umuuid único que é usado para gerar o link de pagamento.
Requisição
Campos Obrigatórios
string
required
Nome do produto. Será exibido na página de pagamento.
string
required
URL da imagem do produto.
number
required
Preço do produto em Reais (BRL decimal, ex:
297.00), nunca em centavos.0cria um produto sem preço. É aceito, mas o produto não vende pelo link de pagamento: a cobrança de R$ 0,00 é recusada. Use para um produto que você cobra de outro jeito, como por cobranças agendadas.- Qualquer outro preço precisa ser de **pelo menos R5,00∗∗,oprec\comıˊnimodaplataforma.DeR 0,01 a R$ 4,99, ou um valor negativo, a API responde
400. - Em um produto de assinatura (
isSubscription: true), o preço fica nos preços de assinatura e este campo não é verificado. Envie0.
Campos Opcionais
string
default:""
Descrição do produto. Ajuda o cliente a entender o que está comprando.
boolean
default:"false"
Habilita pagamento via PIX.
boolean
default:"false"
Habilita pagamento via cartão de crédito.
boolean
default:"false"
Habilita pagamento via boleto bancário.
boolean
default:"true"
Habilita o Pix Automático (débito recorrente do Pix) no checkout de assinatura do produto. Vem ligado por padrão — envie
false para não oferecer. Produtos que não são assinatura ignoram o campo.number
default:"1"
Número máximo de parcelas permitidas (1-12).
string[]
Tags para categorizar o produto.
string
URL para redirecionar o cliente após o pagamento.
string
Texto do botão de redirecionamento (máximo 100 caracteres).
string
ID do Facebook Pixel para rastreamento.
boolean
default:"false"
Define se o produto é de assinatura (cobrança recorrente). Para produtos de assinatura, o preço é definido nos preços de assinatura, não no campo
value.name, image e value são obrigatórios. Os métodos de pagamento vêm desligados por padrão: envie pix, creditCard e boleto com true para os que você quer aceitar.Exemplo de Requisição
Exemplo Mínimo
Crie um produto à venda com os campos obrigatórios e o PIX ligado:curl -X POST https://garu.com.br/api/v1/products \
-H "Authorization: Bearer sk_test_sua_chave_api" \
-H "Content-Type: application/json" \
-d '{
"name": "Meu Produto",
"image": "https://meusite.com/imagens/meu-produto.jpg",
"value": 49.90,
"pix": true
}'
const response = await fetch('https://garu.com.br/api/v1/products', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Meu Produto',
image: 'https://meusite.com/imagens/meu-produto.jpg',
value: 49.90,
pix: true
})
});
const product = await response.json();
console.log(`Link de pagamento: https://garu.com.br/pay/${product.uuid}`);
import requests
import os
response = requests.post(
"https://garu.com.br/api/v1/products",
headers={"Authorization": f"Bearer {os.environ['GARU_API_KEY']}"},
json={
"name": "Meu Produto",
"image": "https://meusite.com/imagens/meu-produto.jpg",
"value": 49.90,
"pix": True
}
)
product = response.json()
print(f"Link de pagamento: https://garu.com.br/pay/{product['uuid']}")
Exemplo Completo
Personalize todas as opções do produto:curl -X POST https://garu.com.br/api/v1/products \
-H "Authorization: Bearer sk_test_sua_chave_api" \
-H "Content-Type: application/json" \
-d '{
"name": "Curso de Marketing Digital",
"description": "Aprenda marketing digital do zero ao avançado",
"image": "https://meusite.com/imagens/curso-marketing.jpg",
"value": 297.00,
"pix": true,
"creditCard": true,
"boleto": true,
"installments": 12
}'
const response = await fetch('https://garu.com.br/api/v1/products', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Curso de Marketing Digital',
description: 'Aprenda marketing digital do zero ao avançado',
image: 'https://meusite.com/imagens/curso-marketing.jpg',
value: 297.00,
pix: true,
creditCard: true,
boleto: true,
installments: 12
})
});
const product = await response.json();
console.log(`Link de pagamento: https://garu.com.br/pay/${product.uuid}`);
import requests
import os
url = "https://garu.com.br/api/v1/products"
headers = {
"Authorization": f"Bearer {os.environ['GARU_API_KEY']}",
"Content-Type": "application/json"
}
payload = {
"name": "Curso de Marketing Digital",
"description": "Aprenda marketing digital do zero ao avançado",
"image": "https://meusite.com/imagens/curso-marketing.jpg",
"value": 297.00,
"pix": True,
"creditCard": True,
"boleto": True,
"installments": 12
}
response = requests.post(url, json=payload, headers=headers)
product = response.json()
print(f"Link de pagamento: https://garu.com.br/pay/{product['uuid']}")
<?php
$url = 'https://garu.com.br/api/v1/products';
$apiKey = getenv('GARU_API_KEY');
$payload = [
'name' => 'Curso de Marketing Digital',
'description' => 'Aprenda marketing digital do zero ao avançado',
'image' => 'https://meusite.com/imagens/curso-marketing.jpg',
'value' => 297.00,
'pix' => true,
'creditCard' => true,
'boleto' => true,
'installments' => 12
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {$apiKey}",
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($payload)
]);
$response = curl_exec($ch);
$product = json_decode($response, true);
echo "Link de pagamento: https://garu.com.br/pay/{$product['uuid']}\n";
Exemplo para Assinatura
Para produtos com cobrança recorrente, definaisSubscription: true e envie value: 0. O preço será configurado depois, nos preços de assinatura, que também seguem o mínimo de R$ 5,00:
curl -X POST https://garu.com.br/api/v1/products \
-H "Authorization: Bearer sk_test_sua_chave_api" \
-H "Content-Type: application/json" \
-d '{
"name": "Plano Premium",
"description": "Acesso completo a todos os recursos",
"image": "https://meusite.com/imagens/plano-premium.jpg",
"value": 0,
"isSubscription": true
}'
const response = await fetch('https://garu.com.br/api/v1/products', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GARU_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Plano Premium',
description: 'Acesso completo a todos os recursos',
image: 'https://meusite.com/imagens/plano-premium.jpg',
value: 0,
isSubscription: true
})
});
const product = await response.json();
// Próximo passo: criar preços de assinatura com o UUID do produto
console.log(`Produto criado: ${product.uuid}`);
import requests
import os
response = requests.post(
"https://garu.com.br/api/v1/products",
headers={"Authorization": f"Bearer {os.environ['GARU_API_KEY']}"},
json={
"name": "Plano Premium",
"description": "Acesso completo a todos os recursos",
"image": "https://meusite.com/imagens/plano-premium.jpg",
"value": 0,
"isSubscription": True
}
)
product = response.json()
# Próximo passo: criar preços de assinatura com o UUID do produto
print(f"Produto criado: {product['uuid']}")
Após criar um produto de assinatura, você precisa criar preços de assinatura para definir os planos (mensal, anual, etc.) e seus valores.
Resposta de Sucesso
string
Identificador único usado para o link de pagamento.
string
Nome do produto.
string
Descrição do produto.
number
Preço do produto em Reais.
0 indica um produto sem preço.boolean
Se PIX está habilitado.
boolean
Se cartão de crédito está habilitado.
boolean
Se boleto está habilitado.
boolean
Se o Pix Automático (débito recorrente) está habilitado.
array
Lista de parcelas com valores calculados.
boolean
Status do produto.
boolean
Se o produto é de assinatura (cobrança recorrente).
string
Data de criação (ISO 8601).
string
Data da última atualização (ISO 8601).
Exemplo de Resposta (201 Created)
{
"name": "Curso de Marketing Digital",
"description": "Aprenda marketing digital do zero ao avançado",
"value": 297.00,
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"pix": true,
"creditCard": true,
"boleto": true,
"installments": [
{ "quantity": 1, "value": 297.00 },
{ "quantity": 2, "value": 153.45 },
{ "quantity": 3, "value": 104.94 },
{ "quantity": 4, "value": 80.69 },
{ "quantity": 5, "value": 66.15 },
{ "quantity": 6, "value": 56.52 },
{ "quantity": 7, "value": 49.68 },
{ "quantity": 8, "value": 44.55 },
{ "quantity": 9, "value": 40.59 },
{ "quantity": 10, "value": 37.42 },
{ "quantity": 11, "value": 34.85 },
{ "quantity": 12, "value": 32.72 }
],
"isActive": true,
"isSubscription": false,
"createdAt": "2024-12-24T10:30:00.000Z",
"updatedAt": "2024-12-24T10:30:00.000Z"
}
Erros Comuns
400 - Preço abaixo do mínimo
400 - Preço abaixo do mínimo
{
"statusCode": 400,
"timestamp": "2026-09-30T21:00:00.000Z",
"path": "/api/v1/products",
"message": "O preço mínimo de um produto é R$ 5,00. Use R$ 0,00 para um produto sem preço."
}
value de pelo menos 5.00, ou 0 para um produto sem preço. De R0,01aR 4,99 o produto é recusado, e um valor negativo também.400 - Campo obrigatório ausente
400 - Campo obrigatório ausente
Solução:
name, image e value são obrigatórios. A mensagem de erro indica qual campo faltou.401 - Não autorizado
401 - Não autorizado
{
"statusCode": 401,
"message": "API key is required"
}
Authorization está correto.Próximos Passos
Link de Pagamento
Aprenda a usar e compartilhar o link de pagamento
Listar Produtos
Consulte seus produtos existentes
Criar Preço de Assinatura
Configure planos de preço para produtos de assinatura
Guia de Assinaturas
Aprenda a configurar cobrança recorrente
Was this page helpful?