POST /v1/orders
POST
/v1/orders
const url = 'https://seu-endereco-da-api/v1/orders';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"idempotencyKey":"example","customerName":"example","customerPhone":"example","fulfillment":"delivery","zoneId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","address":{"street":"example","number":"example","complement":"example","reference":"example"},"items":[{"productId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","variantId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","quantity":1,"note":"example"}],"paymentMethod":"pix","changeForCents":1,"document":"example","notes":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://seu-endereco-da-api/v1/orders \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "idempotencyKey": "example", "customerName": "example", "customerPhone": "example", "fulfillment": "delivery", "zoneId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "address": { "street": "example", "number": "example", "complement": "example", "reference": "example" }, "items": [ { "productId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "variantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quantity": 1, "note": "example" } ], "paymentMethod": "pix", "changeForCents": 1, "document": "example", "notes": "example" }'Permissão que a Chave de acesso precisa: Criar e atualizar pedidos (orders:manage).
Authorizations
Seção intitulada “Authorizations”Request Bodyrequired
Seção intitulada “Request Bodyrequired”Media typeapplication/json
object
idempotencyKey
required
string
customerName
required
string
customerPhone
required
string
fulfillment
required
string
zoneId
string format: uuid
address
object
street
required
string
number
required
string
complement
string
reference
string
items
required
Array<object>
object
productId
required
string format: uuid
variantId
string format: uuid
quantity
required
number
note
string
paymentMethod
required
string
changeForCents
number
document
string
notes
string
Responses
Seção intitulada “Responses”Media typeapplication/json
object
id
required
string
number
required
number
status
required
string
totalCents
required
Total in centavos
number
paymentMethod
required
string
source
required
string
token
required
Opaque token of the public tracking page
string
trackingUrl
required
Link the customer opens to follow the order and pay
string
pix
required
Pix code, present when the order is paid with Pix
object
state
required
string
code
Copy-and-paste Pix code, present when ready
string
invoiceUrl
string
expiresAt
string
reason
Why the code could not be generated, present when unavailable
string
Example
{ "source": "operator", "pix": { "state": "ready" }}The store is not activated or the idempotency key already belongs to another order