Sipariş oluştur
POST
/api/website/orders
const url = 'https://api.petanqueai.com/api/website/orders';const options = { method: 'POST', headers: { 'x-storefront-token': '<x-storefront-token>', 'Content-Type': 'application/json' }, body: '{"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"}'};
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://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" }'Verilen sepet, alıcı ve teslimat adresi için bir sipariş oluşturur. Fiyatları Petanque AI belirler, isteğiniz değil. billing varsayılan olarak teslimat adresidir; promoCode isteğe bağlıdır.
Mağazanız kartla ödeme alıyorsa sipariş AWAITING_PAYMENT olarak döner: Ödemeyi başlat ile devam edin. Aksi halde PENDING_APPROVAL olur ve ekibiniz onu Petanque AI’da onaylar.
Kargo sabit ₺150’dir; indirimden sonra ₺2.000 ve üzeri ürün tutarında ücretsizdir. Stok burada ayrılmaz; sipariş onaylandığında düşülür. Körü körüne tekrar denemeyin: her çağrı yeni bir sipariş oluşturur.
Bir ürün, adres ya da promo kodu sorunu, alanı error.details.field ile belirten 422 alır.
Yetkilendirmeler
Bölüm başlığı “Authorizations”İstek gövdesizorunlu
Bölüm başlığı “Request Bodyrequired”object
lines
zorunlu
Array<object>
object
productId
zorunlu
string
quantity
zorunlu
integer
customer
zorunlu
object
name
zorunlu
string
email
zorunlu
string biçim: email
phone
string
shipping
zorunlu
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
billing
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
promoCode
string
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"}object
lines
zorunlu
Array<object>
object
productId
zorunlu
string
quantity
zorunlu
integer
customer
zorunlu
object
name
zorunlu
string
email
zorunlu
string biçim: email
phone
string
shipping
zorunlu
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
billing
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
promoCode
string
Example generated
lines=%7B%22productId%22%3A%22example%22%2C%22quantity%22%3A1%7D&name=example&email=hello%40example.com&phone=example&fullName=example&phone=example&email=hello%40example.com&city=example&district=example&addressLine=example&postalCode=example&fullName=example&phone=example&email=hello%40example.com&city=example&district=example&addressLine=example&postalCode=example&promoCode=exampleobject
lines
zorunlu
Array<object>
object
productId
zorunlu
string
quantity
zorunlu
integer
customer
zorunlu
object
name
zorunlu
string
email
zorunlu
string biçim: email
phone
string
shipping
zorunlu
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
billing
object
fullName
zorunlu
string
phone
zorunlu
string
email
string biçim: email
city
zorunlu
string
district
zorunlu
string
addressLine
zorunlu
string
postalCode
string
promoCode
string