Actualizar compra
curl --request POST \
--url https://api.bevits.com/v1/purchases/{purchase_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_status": "refunded"
}
'import requests
url = "https://api.bevits.com/v1/purchases/{purchase_id}"
payload = { "payment_status": "refunded" }
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({payment_status: 'refunded'})
};
fetch('https://api.bevits.com/v1/purchases/{purchase_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://api.bevits.com/v1/purchases/{purchase_id}",
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([
'payment_status' => 'refunded'
]),
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://api.bevits.com/v1/purchases/{purchase_id}"
payload := strings.NewReader("{\n \"payment_status\": \"refunded\"\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://api.bevits.com/v1/purchases/{purchase_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_status\": \"refunded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/purchases/{purchase_id}")
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 \"payment_status\": \"refunded\"\n}"
response = http.request(request)
puts response.read_body{
"object": "purchase",
"id": "pur_ckabc123",
"customer_id": "cus_ckabc123",
"external_id": "ord_77120",
"order_id_on_integration_platform": "ord_77120",
"order_number": "10293",
"platform": "api",
"status": "open",
"payment_status": "refunded",
"currency": "BRL",
"purchase_value_in_cents": 17990,
"subtotal_amount_in_cents": 17990,
"total_amount_in_cents": 18990,
"shipping_cost_customer_in_cents": 1000,
"coupons": [],
"created_at": "2026-11-24T14:00:00.000Z",
"updated_at": "2026-11-25T10:30:00.000Z"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"code": "test_mode_not_supported",
"message": "Purchases can't be written with a test key: they would count as real sales. Use a live key (bvt_live_…).",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "conflict",
"code": "purchase_not_editable",
"message": "Only purchases created through the API can be changed here; this one comes from a store integration, which is its source.",
"param": "purchase_id",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "validation_error",
"code": "created_at_in_future",
"message": "created_at is in the future. Send when the order was placed, or omit it for now.",
"param": "created_at",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}Compras
Actualizar compra
Cambia el estado de pago, del pedido o del envío (o el número del pedido) de una compra creada con POST /v1/purchases. Solo cambia lo que envíes. Marcarla como paid cuenta la compra como venta y la suma a los totales del cliente; refunded o voided saca una compra pagada de las ventas y de los totales. Las compras que vinieron de una integración de tienda no se pueden cambiar aquí (409 purchase_not_editable), porque la tienda es su fuente. No se inicia ningún flow ni se envía ningún mensaje. Requiere una clave API de producción (bvt_live_) con el alcance write.
POST
/
v1
/
purchases
/
{purchase_id}
Actualizar compra
curl --request POST \
--url https://api.bevits.com/v1/purchases/{purchase_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_status": "refunded"
}
'import requests
url = "https://api.bevits.com/v1/purchases/{purchase_id}"
payload = { "payment_status": "refunded" }
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({payment_status: 'refunded'})
};
fetch('https://api.bevits.com/v1/purchases/{purchase_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://api.bevits.com/v1/purchases/{purchase_id}",
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([
'payment_status' => 'refunded'
]),
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://api.bevits.com/v1/purchases/{purchase_id}"
payload := strings.NewReader("{\n \"payment_status\": \"refunded\"\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://api.bevits.com/v1/purchases/{purchase_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_status\": \"refunded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/purchases/{purchase_id}")
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 \"payment_status\": \"refunded\"\n}"
response = http.request(request)
puts response.read_body{
"object": "purchase",
"id": "pur_ckabc123",
"customer_id": "cus_ckabc123",
"external_id": "ord_77120",
"order_id_on_integration_platform": "ord_77120",
"order_number": "10293",
"platform": "api",
"status": "open",
"payment_status": "refunded",
"currency": "BRL",
"purchase_value_in_cents": 17990,
"subtotal_amount_in_cents": 17990,
"total_amount_in_cents": 18990,
"shipping_cost_customer_in_cents": 1000,
"coupons": [],
"created_at": "2026-11-24T14:00:00.000Z",
"updated_at": "2026-11-25T10:30:00.000Z"
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "authentication_error",
"message": "Invalid API key.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "permission_denied",
"code": "test_mode_not_supported",
"message": "Purchases can't be written with a test key: they would count as real sales. Use a live key (bvt_live_…).",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}{
"error": {
"type": "conflict",
"code": "purchase_not_editable",
"message": "Only purchases created through the API can be changed here; this one comes from a store integration, which is its source.",
"param": "purchase_id",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "validation_error",
"code": "created_at_in_future",
"message": "created_at is in the future. Send when the order was placed, or omit it for now.",
"param": "created_at",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
},
"retry_after": 2
}{
"error": {
"type": "authentication_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>",
"suggestion": "<string>"
}
}Autorizaciones
Encabezados
Cuerpo
application/json
Envía al menos un campo. Solo cambia lo que envíes.
Respuesta
Compra actualizada.