Siparişten fatura oluşturma
Belirli bir sipariş kaydına bağlı olarak fatura oluşturma ile aynı doğrulama kurallarına uyan gövdeyi POST edersiniz. Başarılı yanıtta siparişin invoice_id alanı güncellenir.
İstek
POST /api/order/{id}/invoice
Accept: application/json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{id} paneldeki sipariş kaydı ID’sidir. İstek gövdesi POST /api/invoices ile aynı yapıdadır; ayrıntılı alan tablosu için bkz. Fatura oluşturma.
Örnek istekler
- 💻 cURL
- 🐘 PHP
curl -X POST "https://app.faturaentegrator.com/api/order/1/invoice" \
-H "Accept: application/json" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
-d @fatura-govdesi.json
<?php
$body = json_decode(file_get_contents('fatura-govdesi.json'), true);
$ch = curl_init('https://app.faturaentegrator.com/api/order/1/invoice');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_HTTPHEADER => ['Accept: application/json', 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
ipucu
Dikkat: Bu endpoint yolu /api/order/{id}/invoice şeklindedir; listeleme için kullandığınız /api/orders ile karıştırmayın.