Skip to content

Place an order

POST
/api/website/orders
curl --request POST \
--url https://api.petanqueai.com/api/website/orders \
--header 'Content-Type: application/json' \
--header 'x-storefront-token: <x-storefront-token>' \
--data '{ "lines": [ { "productId": "example", "quantity": 1 } ], "customer": { "name": "example", "email": "hello@example.com", "phone": "example" }, "shipping": { "fullName": "example", "phone": "example", "email": "hello@example.com", "city": "example", "district": "example", "addressLine": "example", "postalCode": "example" }, "billing": { "fullName": "example", "phone": "example", "email": "hello@example.com", "city": "example", "district": "example", "addressLine": "example", "postalCode": "example" }, "promoCode": "example" }'

Creates an order for the given basket, buyer and delivery address. Prices are set by Petanque AI, never by your request. billing defaults to the delivery address; promoCode is optional.

If your shop takes card payment, the order comes back AWAITING_PAYMENT: continue with Start payment. Otherwise it is PENDING_APPROVAL and your team approves it in Petanque AI.

Shipping is a flat ₺150, free from ₺2,000 of products after discount. Stock is not reserved here; it is deducted when the order is approved. Do not retry blindly: every call creates a new order.

A problem with a product, the address or the promo code answers 422 with error.details.field naming the field.

object
lines
required
Array<object>
>= 1 items
object
productId
required
string
>= 1 characters
quantity
required
integer
>= 1
customer
required
object
name
required
string
>= 2 characters <= 120 characters
email
required
string format: email
<= 200 characters
phone
string
>= 7 characters <= 30 characters
shipping
required
object
fullName
required
string
>= 5 characters <= 120 characters
phone
required
string
>= 10 characters <= 20 characters
email
string format: email
<= 254 characters
city
required
string
>= 2 characters <= 60 characters
district
required
string
>= 2 characters <= 60 characters
addressLine
required
string
>= 10 characters <= 250 characters
postalCode
string
<= 10 characters
billing
object
fullName
required
string
>= 5 characters <= 120 characters
phone
required
string
>= 10 characters <= 20 characters
email
string format: email
<= 254 characters
city
required
string
>= 2 characters <= 60 characters
district
required
string
>= 2 characters <= 60 characters
addressLine
required
string
>= 10 characters <= 250 characters
postalCode
string
<= 10 characters
promoCode
string
>= 1 characters <= 40 characters

Example generated

{
"lines": [
{
"productId": "example",
"quantity": 1
}
],
"customer": {
"name": "example",
"email": "hello@example.com",
"phone": "example"
},
"shipping": {
"fullName": "example",
"phone": "example",
"email": "hello@example.com",
"city": "example",
"district": "example",
"addressLine": "example",
"postalCode": "example"
},
"billing": {
"fullName": "example",
"phone": "example",
"email": "hello@example.com",
"city": "example",
"district": "example",
"addressLine": "example",
"postalCode": "example"
},
"promoCode": "example"
}