curl --request POST \
--url https://v4pay-api.vercel.app/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Consultoria mensal",
"price": 499.9,
"description": "Acompanhamento mensal de marketing",
"image_url": "https://exemplo.com/produto.png",
"active": true,
"sku": "CAMISETA-P-AZUL"
}
'import requests
url = "https://v4pay-api.vercel.app/products"
payload = {
"name": "Consultoria mensal",
"price": 499.9,
"description": "Acompanhamento mensal de marketing",
"image_url": "https://exemplo.com/produto.png",
"active": True,
"sku": "CAMISETA-P-AZUL"
}
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: 'Consultoria mensal',
price: 499.9,
description: 'Acompanhamento mensal de marketing',
image_url: 'https://exemplo.com/produto.png',
active: true,
sku: 'CAMISETA-P-AZUL'
})
};
fetch('https://v4pay-api.vercel.app/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://v4pay-api.vercel.app/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' => 'Consultoria mensal',
'price' => 499.9,
'description' => 'Acompanhamento mensal de marketing',
'image_url' => 'https://exemplo.com/produto.png',
'active' => true,
'sku' => 'CAMISETA-P-AZUL'
]),
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://v4pay-api.vercel.app/products"
payload := strings.NewReader("{\n \"name\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\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://v4pay-api.vercel.app/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v4pay-api.vercel.app/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\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Consultoria mensal",
"description": "<string>",
"price": 499.9,
"image_url": "<string>",
"active": true,
"sku": "CAMISETA-P-AZUL",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>"
}
}{
"error": "Token JWT ou chave de API ausente"
}{
"error": {
"message": "<string>",
"codigo": "SKU_DUPLICADO"
}
}Criar um novo produto
curl --request POST \
--url https://v4pay-api.vercel.app/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Consultoria mensal",
"price": 499.9,
"description": "Acompanhamento mensal de marketing",
"image_url": "https://exemplo.com/produto.png",
"active": true,
"sku": "CAMISETA-P-AZUL"
}
'import requests
url = "https://v4pay-api.vercel.app/products"
payload = {
"name": "Consultoria mensal",
"price": 499.9,
"description": "Acompanhamento mensal de marketing",
"image_url": "https://exemplo.com/produto.png",
"active": True,
"sku": "CAMISETA-P-AZUL"
}
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: 'Consultoria mensal',
price: 499.9,
description: 'Acompanhamento mensal de marketing',
image_url: 'https://exemplo.com/produto.png',
active: true,
sku: 'CAMISETA-P-AZUL'
})
};
fetch('https://v4pay-api.vercel.app/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://v4pay-api.vercel.app/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' => 'Consultoria mensal',
'price' => 499.9,
'description' => 'Acompanhamento mensal de marketing',
'image_url' => 'https://exemplo.com/produto.png',
'active' => true,
'sku' => 'CAMISETA-P-AZUL'
]),
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://v4pay-api.vercel.app/products"
payload := strings.NewReader("{\n \"name\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\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://v4pay-api.vercel.app/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v4pay-api.vercel.app/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\": \"Consultoria mensal\",\n \"price\": 499.9,\n \"description\": \"Acompanhamento mensal de marketing\",\n \"image_url\": \"https://exemplo.com/produto.png\",\n \"active\": true,\n \"sku\": \"CAMISETA-P-AZUL\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Consultoria mensal",
"description": "<string>",
"price": 499.9,
"image_url": "<string>",
"active": true,
"sku": "CAMISETA-P-AZUL",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>"
}
}{
"error": "Token JWT ou chave de API ausente"
}{
"error": {
"message": "<string>",
"codigo": "SKU_DUPLICADO"
}
}Authorizations
Token JWT obtido em /auth/login, enviado no cabeçalho Authorization no formato Bearer <token>.
Body
Dados para criação ou atualização de um produto.
Nome do produto.
"Consultoria mensal"
Preço em reais (maior que zero).
499.9
"Acompanhamento mensal de marketing"
URL da imagem do produto (http:// ou https://; outros esquemas e texto solto são recusados com 400). Vazio ou nulo limpa o campo.
"https://exemplo.com/produto.png"
Produtos inativos não aparecem no checkout.
true
Código do produto no seu estoque (opcional, até 64 caracteres; espaços das pontas são removidos). Vazio ou nulo limpa o sku. Repetido entre os seus produtos do mesmo ambiente é recusado com 409 e codigo: SKU_DUPLICADO.
64"CAMISETA-P-AZUL"
Response
Produto criado com sucesso.
Objeto representando um produto do catálogo.
Show child attributes
Show child attributes