Skip to main content
POST
Create purchase

Authorizations

Authorization
string
header
required

API key created in the organization settings.

Headers

Idempotency-Key
string

Unique key for the operation, 1 to 255 characters (a UUID, for example). Repeating the same key with the same body within 24 hours returns the original response instead of running it again.

Body

application/json

An order from your own system. Amounts are in cents, in the currency of currency.

external_id
string
required

The order's unique ID in your system. Creating a purchase with an external_id that already exists returns that purchase unchanged, with 200.

Required string length: 1 - 191
customer
object
required

Who bought, with the identifiers of the events API, matched in this order: id, external_id, tax_id, email, phone. If none matches, a new customer is created; a matched customer is not changed.

currency
string
required

ISO 4217 currency of every amount, such as BRL.

Pattern: ^[A-Za-z]{3}$
total_amount_in_cents
integer
required

What the customer paid, shipping included, in cents.

Required range: 0 <= x <= 2000000000
subtotal_amount_in_cents
integer

Products only, in cents. Default: total_amount_in_cents.

Required range: 0 <= x <= 2000000000
discount_in_cents
integer

Order discount, in cents.

Required range: 0 <= x <= 2000000000
shipping_cost_customer_in_cents
integer

Shipping paid by the customer, in cents.

Required range: 0 <= x <= 2000000000
payment_status
enum<string>
default:paid

Only paid purchases count as sales (home, Sales, revenue, RFM). refunded and voided take a paid purchase out of them.

Available options:
pending,
authorized,
paid,
refunded,
voided
status
enum<string>
default:open

The order's status in your system.

Available options:
open,
closed,
cancelled
shipping_status
enum<string>
Available options:
unfulfilled,
fulfilled,
shipped,
delivered
order_number
string

The order number the customer sees, such as 1042.

Required string length: 1 - 191
created_at
string<date-time>

When the order was placed (ISO 8601 with offset). Default: now. It is the sale date in every report; more than 1 hour in the future responds 422 created_at_in_future, and before 2000-01-01, 422 created_at_too_old.

utm_source
string
Required string length: 1 - 512
utm_medium
string
Required string length: 1 - 512
utm_campaign
string
Required string length: 1 - 512
utm_content
string
Required string length: 1 - 512
utm_term
string
Required string length: 1 - 512

Response

A purchase with this external_id already exists. It is returned as is, nothing in it changes and no webhook is sent.

object
string
required
Allowed value: "purchase"
id
string
required
Pattern: ^pur_[A-Za-z0-9_-]+$
customer_id
string
required
Pattern: ^cus_[A-Za-z0-9_-]+$
purchase_value_in_cents
integer
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
external_id
string

The order's ID in the system it came from: the store, or your own system for purchases created through the API.

order_id_on_integration_platform
string
order_number
string
platform
string
status
string
payment_status
string
shipping_status
string
currency
string
Example:

"BRL"

subtotal_amount_in_cents
integer
total_amount_in_cents
integer
discount_in_cents
integer
shipping_cost_customer_in_cents
integer
coupons
object[]
attributed_flow_ids
string[]
deprecated

Deprecated legacy field retained for compatibility. When present, always returns an empty array; execution attribution is unavailable in this field.

Pattern: ^flw_[A-Za-z0-9_-]+$
utm_source
string
utm_medium
string
utm_campaign
string
utm_content
string
utm_term
string