Create an order
/v1/ordersRecord a sale made outside a WhatsApp conversation (in a store, by phone, on Instagram or elsewhere) for the authenticated merchant.
Ejemplo
curl -X POST "https://api.ya.onl/v1/orders" \
-H "X-API-Key: yv_live_v1_…" \
-H "Content-Type: application/json" \
-d '{"sales_channel":"…","customer":"…","currency":"…","total_amount":"…","pending_amount":"…","payment_method":"…","items":"…"}'Parámetros
Idempotency-KeystringheaderUnique key for this sale. A retry carrying the same key returns the order already created instead of a second one, whatever its body, so never reuse a key for another sale.
Cuerpo de la petición
sales_channel"store" | "phone" | "instagram" | "other"Where the sale was made. store and phone sales may omit address; instagram and other need one.
contact_idstring | nullContact the sale belongs to. When omitted, customer.phone_number finds or creates it.
customerOrderCreateCustomerCustomer information
currencySupportedCurrencyCurrency code (ISO 4217)
total_amountnumber | stringTotal order amount including delivery fee
pending_amountnumber | stringAmount still pending payment
delivery_feenumber | string | nullDelivery fee charged to the customer
payment_termsPaymentTerms | nullPayment terms for the order (pending when omitted)
payment_methodstringPayment method used
itemsOrderCreateItem[]Line items in the order
addressOrderAddress | nullDelivery address
Respuestas
201401403orders:write scope409contact_ambiguous, with candidates), or another conflict the order cannot be recorded through422Idempotency-Key, a malformed body, or an order the store refuses (invalid_order)429502Idempotency-Key