Create purchase
curl --request POST \
--url https://api.bevits.com/v1/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"external_id": "ord_77120",
"order_number": "10293",
"customer": {
"external_id": "u_8842",
"email": "ana@exemplo.com.br",
"phone": "+5511988887777",
"name": "Ana Souza"
},
"currency": "BRL",
"total_amount_in_cents": 18990,
"subtotal_amount_in_cents": 17990,
"shipping_cost_customer_in_cents": 1000,
"payment_status": "paid",
"created_at": "2026-11-24T11:00:00-03:00",
"utm_source": "instagram"
}
'import requests
url = "https://api.bevits.com/v1/purchases"
payload = {
"external_id": "ord_77120",
"order_number": "10293",
"customer": {
"external_id": "u_8842",
"email": "ana@exemplo.com.br",
"phone": "+5511988887777",
"name": "Ana Souza"
},
"currency": "BRL",
"total_amount_in_cents": 18990,
"subtotal_amount_in_cents": 17990,
"shipping_cost_customer_in_cents": 1000,
"payment_status": "paid",
"created_at": "2026-11-24T11:00:00-03:00",
"utm_source": "instagram"
}
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({
external_id: 'ord_77120',
order_number: '10293',
customer: {
external_id: 'u_8842',
email: 'ana@exemplo.com.br',
phone: '+5511988887777',
name: 'Ana Souza'
},
currency: 'BRL',
total_amount_in_cents: 18990,
subtotal_amount_in_cents: 17990,
shipping_cost_customer_in_cents: 1000,
payment_status: 'paid',
created_at: '2026-11-24T11:00:00-03:00',
utm_source: 'instagram'
})
};
fetch('https://api.bevits.com/v1/purchases', 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",
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([
'external_id' => 'ord_77120',
'order_number' => '10293',
'customer' => [
'external_id' => 'u_8842',
'email' => 'ana@exemplo.com.br',
'phone' => '+5511988887777',
'name' => 'Ana Souza'
],
'currency' => 'BRL',
'total_amount_in_cents' => 18990,
'subtotal_amount_in_cents' => 17990,
'shipping_cost_customer_in_cents' => 1000,
'payment_status' => 'paid',
'created_at' => '2026-11-24T11:00:00-03:00',
'utm_source' => 'instagram'
]),
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"
payload := strings.NewReader("{\n \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/purchases")
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 \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\n}"
response = http.request(request)
puts response.read_body{
"object": "purchase",
"id": "<string>",
"customer_id": "<string>",
"purchase_value_in_cents": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"order_id_on_integration_platform": "<string>",
"order_number": "<string>",
"platform": "<string>",
"status": "<string>",
"payment_status": "<string>",
"shipping_status": "<string>",
"currency": "BRL",
"subtotal_amount_in_cents": 123,
"total_amount_in_cents": 123,
"discount_in_cents": 123,
"shipping_cost_customer_in_cents": 123,
"coupons": [
{
"id": "<string>",
"code": "<string>",
"value": 123,
"type": "<string>"
}
],
"attributed_flow_ids": [
"<string>"
],
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>"
}{
"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": "paid",
"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-24T14:00:01.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": "not_found",
"code": "customer_not_found",
"message": "No customer has this id. Remove customer.id to match by the other identifiers.",
"param": "customer.id",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "conflict",
"code": "sales_source_conflict",
"message": "This organization's sales come from its connected store. Purchases can't also be written through the API, or each sale would count twice.",
"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>"
}
}{
"error": {
"type": "service_unavailable",
"code": "temporarily_unavailable",
"message": "The request could not be confirmed right now. Retry it with the same Idempotency-Key: it is applied at most once.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}Purchases
Create purchase
Records an order from your own system, for organizations without a store integration. external_id is the order's ID in your system: if a purchase with it already exists, it is returned as is, with 200, and no webhook is sent. A new purchase is created with 201 and triggers the purchase.created webhook, with the same object as the response. The customer is matched as in events (id, external_id, tax_id, email, phone) and created when none matches; a matched customer is not changed. Only paid purchases (the default) count as sales: home, Sales screen, campaign and flow revenue, recovered carts, RFM and customer totals. No flow is started and no message is sent: for automations, also send the order event (order_placed, payment_confirmed) to POST /v1/events. Send an Idempotency-Key to retry the request safely. Requires a live API key (bvt_live_) with the write scope. The sale events sent to POST /v1/events (order_placed, payment_confirmed, charge_paid…) become purchases too, on the same external_id (the order's order_id, or charge:<charge_id> for a subscription charge): a sale reported both ways counts once. Refused with 409 sales_source_conflict when the organization has a connected store, which is the source of its sales, and with 422 test_customer_not_supported when the customer's e-mail is on a domain reserved for testing (example.com, .test).
POST
/
v1
/
purchases
Create purchase
curl --request POST \
--url https://api.bevits.com/v1/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"external_id": "ord_77120",
"order_number": "10293",
"customer": {
"external_id": "u_8842",
"email": "ana@exemplo.com.br",
"phone": "+5511988887777",
"name": "Ana Souza"
},
"currency": "BRL",
"total_amount_in_cents": 18990,
"subtotal_amount_in_cents": 17990,
"shipping_cost_customer_in_cents": 1000,
"payment_status": "paid",
"created_at": "2026-11-24T11:00:00-03:00",
"utm_source": "instagram"
}
'import requests
url = "https://api.bevits.com/v1/purchases"
payload = {
"external_id": "ord_77120",
"order_number": "10293",
"customer": {
"external_id": "u_8842",
"email": "ana@exemplo.com.br",
"phone": "+5511988887777",
"name": "Ana Souza"
},
"currency": "BRL",
"total_amount_in_cents": 18990,
"subtotal_amount_in_cents": 17990,
"shipping_cost_customer_in_cents": 1000,
"payment_status": "paid",
"created_at": "2026-11-24T11:00:00-03:00",
"utm_source": "instagram"
}
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({
external_id: 'ord_77120',
order_number: '10293',
customer: {
external_id: 'u_8842',
email: 'ana@exemplo.com.br',
phone: '+5511988887777',
name: 'Ana Souza'
},
currency: 'BRL',
total_amount_in_cents: 18990,
subtotal_amount_in_cents: 17990,
shipping_cost_customer_in_cents: 1000,
payment_status: 'paid',
created_at: '2026-11-24T11:00:00-03:00',
utm_source: 'instagram'
})
};
fetch('https://api.bevits.com/v1/purchases', 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",
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([
'external_id' => 'ord_77120',
'order_number' => '10293',
'customer' => [
'external_id' => 'u_8842',
'email' => 'ana@exemplo.com.br',
'phone' => '+5511988887777',
'name' => 'Ana Souza'
],
'currency' => 'BRL',
'total_amount_in_cents' => 18990,
'subtotal_amount_in_cents' => 17990,
'shipping_cost_customer_in_cents' => 1000,
'payment_status' => 'paid',
'created_at' => '2026-11-24T11:00:00-03:00',
'utm_source' => 'instagram'
]),
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"
payload := strings.NewReader("{\n \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bevits.com/v1/purchases")
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 \"external_id\": \"ord_77120\",\n \"order_number\": \"10293\",\n \"customer\": {\n \"external_id\": \"u_8842\",\n \"email\": \"ana@exemplo.com.br\",\n \"phone\": \"+5511988887777\",\n \"name\": \"Ana Souza\"\n },\n \"currency\": \"BRL\",\n \"total_amount_in_cents\": 18990,\n \"subtotal_amount_in_cents\": 17990,\n \"shipping_cost_customer_in_cents\": 1000,\n \"payment_status\": \"paid\",\n \"created_at\": \"2026-11-24T11:00:00-03:00\",\n \"utm_source\": \"instagram\"\n}"
response = http.request(request)
puts response.read_body{
"object": "purchase",
"id": "<string>",
"customer_id": "<string>",
"purchase_value_in_cents": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"order_id_on_integration_platform": "<string>",
"order_number": "<string>",
"platform": "<string>",
"status": "<string>",
"payment_status": "<string>",
"shipping_status": "<string>",
"currency": "BRL",
"subtotal_amount_in_cents": 123,
"total_amount_in_cents": 123,
"discount_in_cents": 123,
"shipping_cost_customer_in_cents": 123,
"coupons": [
{
"id": "<string>",
"code": "<string>",
"value": 123,
"type": "<string>"
}
],
"attributed_flow_ids": [
"<string>"
],
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_term": "<string>"
}{
"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": "paid",
"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-24T14:00:01.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": "not_found",
"code": "customer_not_found",
"message": "No customer has this id. Remove customer.id to match by the other identifiers.",
"param": "customer.id",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}{
"error": {
"type": "conflict",
"code": "sales_source_conflict",
"message": "This organization's sales come from its connected store. Purchases can't also be written through the API, or each sale would count twice.",
"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>"
}
}{
"error": {
"type": "service_unavailable",
"code": "temporarily_unavailable",
"message": "The request could not be confirmed right now. Retry it with the same Idempotency-Key: it is applied at most once.",
"request_id": "req_07f6cdc3c20249d6afcd90b4"
}
}Headers
Body
application/json
An order from your own system. Amounts are in cents, in the currency of currency.
Response
A purchase with this external_id already exists. It is returned as is, nothing in it changes and no webhook is sent.