Create an order

post
https://api.clakta.com/v1/orders

Record a new order for a project. The owning project is resolved from the `projectId` field in the request body. Orders count towards your team's monthly order limit.

The required fields are `projectId`, `orderId`, `paymentMethod`, `status`, `totalPrice` and `products`. Everything else, including `platform`, the whole `customer` object and the whole `tracking` object, is optional. Every field inside `customer` is optional too, so send what your storefront actually captured. Send `customer.id` or `customer.email` to attach the order to a known customer; otherwise it is attached to an anonymous visitor. An order with no `tracking` is recorded as unattributed, and one with no `platform` is stored and returned with `platform: null`.

Projects using the `privacy_friendly` tracking mode must omit every personal field from `customer`. They may send `ip` and `userAgent` to resolve the anonymous visitor from a server-computed daily session hash, or omit `customer` entirely to attribute the order from the browser's purchase event.

Send `totalPrice` and each product `price` as a decimal in the order currency (`10.4` for $10.40). Clakta stores and returns them in the smallest unit of that currency, so `10.4` USD comes back as `1040`, while a zero-decimal currency such as JPY is kept whole: `1040` in, `1040` out.

For subscriptions, send every charge, the first purchase and each renewal, as its own order with its own `orderId` and the same `subscription.id`. Each charge counts towards the monthly order limit. A renewal sent without `tracking` inherits the attribution of the subscription's first charge, and ad revenue counts only that first charge unless the project is set to count renewals.

Authentication

Send your API key as a bearer token in the Authorization header.

See Authentication for how to create and scope an API key.

Bodyapplication/json

projectIdstringrequired

The project ID (e.g. proj_xxx) or slug that owns the order

orderIdstringrequired

The order ID in your system

platformstring | nulloptional

The platform (e.g. shopify, woocommerce, etc.). Optional: an order sent without it is recorded with no platform

paymentMethodenum<string>required

The payment method

Allowed values:credit_carddebit_cardpixboletopaypalapple_paygoogle_paysamsung_paystripe_linkother

statusenum<string>required

The status

Allowed values:paidpendingrejectedrefundedcanceled

currencystring | nulloptional

The currency in ISO 4217 format (e.g. USD, EUR, BRL, etc.) - defaults to the project currency if not provided

totalPricenumberrequired

The total order price in floating point number (e.g. 10.4 for $10.40). Send the amount as a person would read it. Clakta stores it in the smallest unit of the order currency, so zero-decimal currencies such as JPY are kept whole (1040 stays 1040, not 104000)

productsobject[]required
trackingobjectoptionaldefault: {}

The attribution parameters captured on your storefront. Every parameter is optional. An order sent without them is recorded as unattributed

subscriptionobject | nulloptional

Send this when the order is a subscription charge. Send every charge (the first purchase and each renewal) as its own order with its own orderId. Renewals sent without tracking inherit the attribution of the subscription's first charge

createdAtdate-time | nulloptional

The order created at, defaults to the current date

approvedDatedate-time | nulloptional

The order approved date

refundedAtdate-time | nulloptional

The order refunded at

customerobjectoptionaldefault: {}

The customer. The object and every field are optional: send `id` or `email` to attach the order to a known customer, or omit them to attach it to an anonymous visitor resolved from the browser session

Response

The created order

messagestringrequired

A confirmation message.

dataobjectrequired