Criar versão de preço
curl --request POST \
--url https://api.korbit.com.br/v1/products/{id}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"amountMinor": 4503599627370496,
"gracePeriodDays": 0,
"intervalCount": 6,
"maxInstallments": 1
}
'import requests
url = "https://api.korbit.com.br/v1/products/{id}/prices"
payload = {
"amountMinor": 4503599627370496,
"gracePeriodDays": 0,
"intervalCount": 6,
"maxInstallments": 1
}
headers = {
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amountMinor: 4503599627370496,
gracePeriodDays: 0,
intervalCount: 6,
maxInstallments: 1
})
};
fetch('https://api.korbit.com.br/v1/products/{id}/prices', 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.korbit.com.br/v1/products/{id}/prices",
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([
'amountMinor' => 4503599627370496,
'gracePeriodDays' => 0,
'intervalCount' => 6,
'maxInstallments' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"idempotency-key: <idempotency-key>"
],
]);
$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.korbit.com.br/v1/products/{id}/prices"
payload := strings.NewReader("{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
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://api.korbit.com.br/v1/products/{id}/prices")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korbit.com.br/v1/products/{id}/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}"
response = http.request(request)
puts response.read_body{
"amountMinor": 4503599627370496,
"billingInterval": "MONTH",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "BRL",
"gracePeriodDays": 45,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intervalCount": 6,
"maxInstallments": 6,
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2
}{
"amountMinor": 4503599627370496,
"billingInterval": "MONTH",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "BRL",
"gracePeriodDays": 45,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intervalCount": 6,
"maxInstallments": 6,
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}Catálogo
Criar versão de preço
Cria uma nova versão de preço para o produto — o histórico de preços anteriores é preservado. Valores sempre em centavos (BRL).
POST
/
v1
/
products
/
{id}
/
prices
Criar versão de preço
curl --request POST \
--url https://api.korbit.com.br/v1/products/{id}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"amountMinor": 4503599627370496,
"gracePeriodDays": 0,
"intervalCount": 6,
"maxInstallments": 1
}
'import requests
url = "https://api.korbit.com.br/v1/products/{id}/prices"
payload = {
"amountMinor": 4503599627370496,
"gracePeriodDays": 0,
"intervalCount": 6,
"maxInstallments": 1
}
headers = {
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amountMinor: 4503599627370496,
gracePeriodDays: 0,
intervalCount: 6,
maxInstallments: 1
})
};
fetch('https://api.korbit.com.br/v1/products/{id}/prices', 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.korbit.com.br/v1/products/{id}/prices",
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([
'amountMinor' => 4503599627370496,
'gracePeriodDays' => 0,
'intervalCount' => 6,
'maxInstallments' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"idempotency-key: <idempotency-key>"
],
]);
$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.korbit.com.br/v1/products/{id}/prices"
payload := strings.NewReader("{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
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://api.korbit.com.br/v1/products/{id}/prices")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korbit.com.br/v1/products/{id}/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amountMinor\": 4503599627370496,\n \"gracePeriodDays\": 0,\n \"intervalCount\": 6,\n \"maxInstallments\": 1\n}"
response = http.request(request)
puts response.read_body{
"amountMinor": 4503599627370496,
"billingInterval": "MONTH",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "BRL",
"gracePeriodDays": 45,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intervalCount": 6,
"maxInstallments": 6,
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2
}{
"amountMinor": 4503599627370496,
"billingInterval": "MONTH",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "BRL",
"gracePeriodDays": 45,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intervalCount": 6,
"maxInstallments": 6,
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 499,
"title": "<string>",
"type": "<string>",
"code": "<string>"
}Nunca edite um preço no lugar: crie uma versão nova. Assim, pedidos antigos continuam explicáveis e o audit trail fica íntegro.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Required string length:
1 - 255Path Parameters
Body
application/json
Response
Default Response
Required range:
1 <= x <= 9007199254740991Available options:
MONTH, YEAR Available options:
BRL Required range:
0 <= x <= 90Required range:
1 <= x <= 12Required range:
1 <= x <= 12Required range:
x >= 1Was this page helpful?