Criar Oferta
curl --request POST \
--url https://api.example.com/products/{hash}/offers \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"amount": 123,
"cover": "<string>"
}
'import requests
url = "https://api.example.com/products/{hash}/offers"
payload = {
"api_token": "<string>",
"title": "<string>",
"amount": 123,
"cover": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_token: '<string>', title: '<string>', amount: 123, cover: '<string>'})
};
fetch('https://api.example.com/products/{hash}/offers', 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.example.com/products/{hash}/offers",
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([
'api_token' => '<string>',
'title' => '<string>',
'amount' => 123,
'cover' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/products/{hash}/offers"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/products/{hash}/offers")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{hash}/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"201": {},
"400": {},
"401": {},
"404": {},
"422": {},
"500": {}
}Produtos
Criar Oferta
Cadastra uma nova oferta para um produto específico
POST
/
products
/
{hash}
/
offers
Criar Oferta
curl --request POST \
--url https://api.example.com/products/{hash}/offers \
--header 'Content-Type: application/json' \
--data '
{
"api_token": "<string>",
"title": "<string>",
"amount": 123,
"cover": "<string>"
}
'import requests
url = "https://api.example.com/products/{hash}/offers"
payload = {
"api_token": "<string>",
"title": "<string>",
"amount": 123,
"cover": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_token: '<string>', title: '<string>', amount: 123, cover: '<string>'})
};
fetch('https://api.example.com/products/{hash}/offers', 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.example.com/products/{hash}/offers",
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([
'api_token' => '<string>',
'title' => '<string>',
'amount' => 123,
'cover' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/products/{hash}/offers"
payload := strings.NewReader("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/products/{hash}/offers")
.header("Content-Type", "application/json")
.body("{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products/{hash}/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_token\": \"<string>\",\n \"title\": \"<string>\",\n \"amount\": 123,\n \"cover\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"201": {},
"400": {},
"401": {},
"404": {},
"422": {},
"500": {}
}Visão Geral
Ofertas são configurações específicas de preço e condições para um produto. Um produto pode ter múltiplas ofertas com valores e promoções diferentes.Endpoint
POST https://api.klivopay.com.br/api/public/v1/products/{hash}/offers
Parâmetros
Hash identificador único do produto
Seu token de autenticação da API KlivoPay
Título da oferta (ex: “Promoção de Lançamento”, “Black Friday”)
Valor da oferta em centavos. Exemplo: R$ 199,00 =
19900URL da imagem de capa da oferta
Exemplo de Requisição
curl -X POST 'https://api.klivopay.com.br/api/public/v1/products/prod123abc/offers' \
-H 'Content-Type: application/json' \
-d '{
"api_token": "seu_token_aqui",
"title": "Promoção de Lançamento",
"amount": 19900,
"cover": "https://exemplo.com/oferta.jpg"
}'
const productHash = 'prod123abc';
const response = await fetch(
`https://api.klivopay.com.br/api/public/v1/products/${productHash}/offers`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_token: 'seu_token_aqui',
title: 'Promoção de Lançamento',
amount: 19900,
cover: 'https://exemplo.com/oferta.jpg'
})
}
);
const data = await response.json();
console.log(data);
import requests
product_hash = 'prod123abc'
url = f'https://api.klivopay.com.br/api/public/v1/products/{product_hash}/offers'
payload = {
'api_token': 'seu_token_aqui',
'title': 'Promoção de Lançamento',
'amount': 19900,
'cover': 'https://exemplo.com/oferta.jpg'
}
response = requests.post(url, json=payload)
print(response.json())
<?php
$productHash = 'prod123abc';
$url = "https://api.klivopay.com.br/api/public/v1/products/{$productHash}/offers";
$data = [
'api_token' => 'seu_token_aqui',
'title' => 'Promoção de Lançamento',
'amount' => 19900,
'cover' => 'https://exemplo.com/oferta.jpg'
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
print_r(json_decode($result));
?>
Resposta de Sucesso
201 Created
{
"success": true,
"data": {
"hash": "offer123",
"title": "Promoção de Lançamento",
"amount": 19900,
"cover": "https://exemplo.com/oferta.jpg",
"product_hash": "prod123abc",
"created_at": "2025-01-20T10:15:00Z"
}
}
Códigos de Resposta
Oferta criada com sucesso
Dados inválidos na requisição
Token de API inválido ou ausente
Produto não encontrado
Erro de validação nos dados enviados
Erro interno do servidor
Use o
hash da oferta criada no parâmetro offer_hash ao criar transações.⌘I