Atualizar preço
curl --request PATCH \
--url https://besimplo.com/api/v1/prices/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {
"active": false,
"description": "Plano Mensal Atualizado",
"external_code": "price_updated_code",
"card_installments_enabled": true,
"max_card_installments": 6
}
}
'import requests
url = "https://besimplo.com/api/v1/prices/{id}"
payload = { "price": {
"active": False,
"description": "Plano Mensal Atualizado",
"external_code": "price_updated_code",
"card_installments_enabled": True,
"max_card_installments": 6
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
price: {
active: false,
description: 'Plano Mensal Atualizado',
external_code: 'price_updated_code',
card_installments_enabled: true,
max_card_installments: 6
}
})
};
fetch('https://besimplo.com/api/v1/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://besimplo.com/api/v1/prices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => [
'active' => false,
'description' => 'Plano Mensal Atualizado',
'external_code' => 'price_updated_code',
'card_installments_enabled' => true,
'max_card_installments' => 6
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://besimplo.com/api/v1/prices/{id}"
payload := strings.NewReader("{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.patch("https://besimplo.com/api/v1/prices/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://besimplo.com/api/v1/prices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "price_01h455vb4pex5vsknk084sn02q",
"object": "price",
"active": true,
"live_mode": true,
"created": 1704672000,
"currency": "brl",
"product": "prod_01h455vb4pex5vsknk084sn02q",
"type": "recurring",
"unit_amount": 2990,
"card_installments_enabled": false,
"max_card_installments": 1,
"description": "Plano Mensal Premium",
"unit_amount_decimal": "2990",
"recurring": {
"interval": "month",
"interval_count": 1
},
"external_code": "price_premium_monthly",
"effective_max_card_installments": 1,
"installment_selection_available": false
}
Preços
Atualizar preço
Atualiza um preço existente.
Campos imutáveis: unit_amount, type, recurring não podem ser alterados após criação.
Para alterar esses campos, crie um novo preço e desative o antigo.
PATCH
/
api
/
v1
/
prices
/
{id}
Atualizar preço
curl --request PATCH \
--url https://besimplo.com/api/v1/prices/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {
"active": false,
"description": "Plano Mensal Atualizado",
"external_code": "price_updated_code",
"card_installments_enabled": true,
"max_card_installments": 6
}
}
'import requests
url = "https://besimplo.com/api/v1/prices/{id}"
payload = { "price": {
"active": False,
"description": "Plano Mensal Atualizado",
"external_code": "price_updated_code",
"card_installments_enabled": True,
"max_card_installments": 6
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
price: {
active: false,
description: 'Plano Mensal Atualizado',
external_code: 'price_updated_code',
card_installments_enabled: true,
max_card_installments: 6
}
})
};
fetch('https://besimplo.com/api/v1/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://besimplo.com/api/v1/prices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => [
'active' => false,
'description' => 'Plano Mensal Atualizado',
'external_code' => 'price_updated_code',
'card_installments_enabled' => true,
'max_card_installments' => 6
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://besimplo.com/api/v1/prices/{id}"
payload := strings.NewReader("{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.patch("https://besimplo.com/api/v1/prices/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://besimplo.com/api/v1/prices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": {\n \"active\": false,\n \"description\": \"Plano Mensal Atualizado\",\n \"external_code\": \"price_updated_code\",\n \"card_installments_enabled\": true,\n \"max_card_installments\": 6\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "price_01h455vb4pex5vsknk084sn02q",
"object": "price",
"active": true,
"live_mode": true,
"created": 1704672000,
"currency": "brl",
"product": "prod_01h455vb4pex5vsknk084sn02q",
"type": "recurring",
"unit_amount": 2990,
"card_installments_enabled": false,
"max_card_installments": 1,
"description": "Plano Mensal Premium",
"unit_amount_decimal": "2990",
"recurring": {
"interval": "month",
"interval_count": 1
},
"external_code": "price_premium_monthly",
"effective_max_card_installments": 1,
"installment_selection_available": false
}
Authorizations
Path Parameters
Response
Preço atualizado
Indica se este preço permite parcelamento no cartão de crédito. Regras:
- preços avulsos podem permitir parcelamento
- recorrências diárias e semanais não podem permitir parcelamento
- recorrências mensais exigem pelo menos 2 meses para permitir parcelamento
Example:
false
Máximo de parcelas aceitas no cartão. Regras:
- quando
card_installments_enabled=false, o valor efetivo é1 - preços recorrentes não podem exceder a recorrência em meses, com limite global de
12 - o valor mínimo por parcela é
R$ 5,00
Required range:
1 <= x <= 12Example:
1

