SinApp Muhasebe API - API Referansı
Bu dokümantasyon, SinApp Muhasebe API'sinde bulunan tüm endpointleri ve kullanım örneklerini içerir.
API Genel Özellikleri
SinApp Muhasebe API aşağıdaki özelliklere sahiptir:
- RESTful API tasarımı
- JSON format desteği
- Kapsamlı hata mesajları
- API anahtarı tabanlı kimlik doğrulama
API'nin taban URL'si: https://[sizin-domaininiz]/api/v1/
Kimlik Doğrulama
Tüm API isteklerinde kimlik doğrulama için HTTP başlıkları (headers) kullanılır:
X-Api-Key: YOUR_API_KEY
X-Api-Secret: YOUR_API_SECRET
Bu kimlik bilgileri olmadan yapılan istekler 401 (Unauthorized) hatası alır.
Faturalar
Fatura Oluşturma
POST
/api/v1/invoice_operations.php
Yeni bir fatura oluşturur ve ilgili tüm bilgileri (müşteri, sipariş, ödeme) kaydeder.
İstek Parametreleri
| Parametre | Tür | Açıklama |
|---|---|---|
Channel * |
Nesne | Faturanın oluşturulduğu kanal bilgileri |
Channel.website * |
String | Kanal web sitesi |
Channel.company_name * |
String | Kanal şirket adı |
fatura_bilgileri * |
Nesne | Fatura bilgileri |
fatura_bilgileri.invoice_id * |
String | Benzersiz fatura numarası (örn: inv_67e3f12d8da67) |
fatura_bilgileri.order_id |
String | Sipariş numarası (örn: SPR2025-2) |
fatura_bilgileri.invoice_type * |
String | Fatura türü (company, individual) |
fatura_bilgileri.company_name |
String | Müşteri şirket adı (invoice_type=company ise zorunlu) |
fatura_bilgileri.tax_number |
String | Vergi numarası (invoice_type=company ise zorunlu) |
fatura_bilgileri.tax_office |
String | Vergi dairesi (invoice_type=company ise zorunlu) |
fatura_bilgileri.full_name * |
String | Müşteri tam adı |
fatura_bilgileri.identity_number * |
String | TC Kimlik No |
fatura_bilgileri.contact_name * |
String | İletişim kurulacak kişinin adı |
fatura_bilgileri.contact_surname * |
String | İletişim kurulacak kişinin soyadı |
fatura_bilgileri.contact_phone * |
String | İletişim telefon numarası |
fatura_bilgileri.contact_email * |
String | İletişim e-posta adresi |
fatura_bilgileri.contact_city * |
String | İl |
fatura_bilgileri.contact_district * |
String | İlçe |
fatura_bilgileri.contact_address * |
String | Açık adres |
kisisel_bilgiler |
Nesne | Kişisel bilgiler |
kisisel_bilgiler.users_namesurname |
String | Kullanıcı adı |
kisisel_bilgiler.users_surname |
String | Kullanıcı soyadı |
kisisel_bilgiler.contact_phone |
String | Telefon numarası |
kisisel_bilgiler.contact_email |
String | E-posta adresi |
siparis_detaylari * |
Nesne | Sipariş detayları |
siparis_detaylari.order_id |
String | Sipariş numarası |
siparis_detaylari.courses * |
Dizi | Kurs bilgileri listesi |
siparis_detaylari.total_course_price * |
Number | Toplam kurs fiyatı |
siparis_detaylari.amount * |
Number | Ödenen tutar |
siparis_detaylari.payment_method |
String | Ödeme yöntemi (0: Havale/EFT, 1: Kredi Kartı) |
siparis_detaylari.bank_name |
String | Banka adı (Havale/EFT için) |
siparis_detaylari.payment_date |
String | Ödeme tarihi (Y-m-d H:i:s formatında) |
siparis_detaylari.payment_solution |
String | Ödeme çözümü (örn: iyzico, PayTR, Papara) |
siparis_detaylari.is_deleted |
Integer | Silme durumu (2: İptal edildi, 5: Silme için işaretlendi) |
Örnek İstek
{
"Channel": {
"website": "example.com",
"company_name": "Örnek Şirket"
},
"fatura_bilgileri": {
"invoice_id": "inv_67e3f12d8da67",
"order_id": "SPR2025-2",
"invoice_type": "individual",
"company_name": null,
"tax_number": null,
"tax_office": null,
"full_name": "Halit DEĞİŞTİRDİM",
"identity_number": "12152037360",
"contact_name": "Halit",
"contact_surname": "Ergül",
"contact_phone": "5053660902",
"contact_email": "halitergul18@gmail.com",
"contact_city": "Denizli",
"contact_district": "Pamukkale",
"contact_address": "Pınarkent Mahallesi Uydukent Sitesi"
},
"siparis_detaylari": {
"order_id": "SPR2025-2",
"courses": [
{
"title": "Web Geliştirme Kursu",
"price": 1000
}
],
"total_course_price": 1000,
"amount": 1000,
"payment_method": "1",
"bank_name": "Garanti",
"payment_date": "2024-03-11 14:30:00",
"payment_solution": "iyzico",
"is_deleted": 0
}
}
Yanıt
{
"success": true,
"message": "Fatura başarıyla oluşturuldu",
"invoice_id": 123,
"invoice_number": "INV-12345"
}
Fatura Güncelleme
PUT
/api/v1/invoice_operations.php
Mevcut bir faturayı günceller.
İstek Parametreleri
| Parametre | Tür | Açıklama |
|---|---|---|
invoice_id * |
String | Güncellenecek fatura ID'si (örn: inv_67e3f12d8da67) |
order_id |
String | Sipariş numarası (güvenlik için önerilir) |
status * |
String | Fatura durumu (draft, sent, paid, cancelled) |
customer |
Nesne | Müşteri bilgileri |
customer.invoice_type |
String | Fatura türü (company, individual) |
customer.company_name |
String | Müşteri şirket adı |
customer.tax_number |
String | Vergi numarası |
customer.tax_office |
String | Vergi dairesi |
customer.full_name |
String | Müşteri tam adı |
customer.identity_number |
String | TC Kimlik No |
customer.contact_name |
String | İletişim kurulacak kişinin adı |
customer.contact_surname |
String | İletişim kurulacak kişinin soyadı |
customer.contact_phone |
String | İletişim telefon numarası |
customer.contact_email |
String | İletişim e-posta adresi |
customer.contact_city |
String | İl |
customer.contact_district |
String | İlçe |
customer.contact_address |
String | Açık adres |
Örnek Güncelleme İsteği
{
"invoice_id": "inv_67e3f12d8da67",
"status": "sent",
"customer": {
"invoice_type": "individual",
"company_name": null,
"tax_number": null,
"tax_office": null,
"full_name": "Halit DEĞİŞTİRDİM",
"identity_number": "12152037360",
"contact_name": "Halit",
"contact_surname": "Ergül",
"contact_phone": "5053660902",
"contact_email": "halitergul18@gmail.com",
"contact_city": "Denizli",
"contact_district": "Pamukkale",
"contact_address": "Pınarkent Mahallesi Uydukent Sitesi"
}
}
Yanıt
{
"success": true,
"message": "Fatura başarıyla güncellendi",
"invoice_id": "INV-12345"
}
Fatura Silme
DELETE
/api/v1/invoice_operations.php
Faturayı iptal edildi olarak işaretler (fiziksel silme yapmaz).
İstek Parametreleri
| Parametre | Tür | Açıklama |
|---|---|---|
invoice_id * |
String | Fatura numarası |
order_id |
String | Sipariş numarası (güvenlik için önerilir) |
order_id parametresi güvenlik için önerilir. Eğer sağlanırsa, hem fatura numarası hem de sipariş numarası eşleşmelidir.
Yanıt
Başarılı bir silme işlemi sonucunda:
{
"success": true,
"message": "Fatura başarıyla iptal edildi olarak işaretlendi",
"invoice_id": "INV-2023-001",
"order_id": "ORD-2023-001"
}
Fatura Detayı Alma
GET
/api/v1/invoices.php?number={invoice_number}&order={order_id}
Belirtilen fatura numarası ve sipariş ID'sine ait detaylı bilgileri getirir.
Parametreler
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
| number | string | Evet | Fatura numarası |
| order | integer | Evet | Sipariş ID'si |
Örnek Yanıt
{
"status": "success",
"data": {
"invoice": {
"id": "123",
"invoice_number": "INV-2024-001",
"order_id": "456",
"invoice_date": "2024-03-15",
"status": "sent",
"currency": "TRY",
"grand_total": "1500.00",
"notes": "Örnek fatura notu",
"created_at": "2024-03-15 10:30:00",
"created_by": "admin"
},
"customer": {
"invoice_type": "company",
"company_name": "Örnek Şirket A.Ş.",
"tax_number": "1234567890",
"tax_office": "Örnek Vergi Dairesi",
"contact_name": "Ahmet",
"contact_surname": "Yılmaz",
"contact_phone": "05551234567",
"contact_email": "ornek@sirket.com",
"contact_address": "Örnek Mahallesi, Örnek Sokak No:1",
"district": "Çankaya",
"province": "Ankara"
},
"items": [
{
"id": "789",
"description": "Ürün A",
"quantity": "2",
"unit_price": "500.00",
"total_amount": "1000.00"
},
{
"id": "790",
"description": "Ürün B",
"quantity": "1",
"unit_price": "500.00",
"total_amount": "500.00"
}
],
"payment": {
"amount": "1500.00",
"payment_method": "0",
"payment_solution": "Banka Havalesi",
"bank_name": "Örnek Bank",
"payment_date": "2024-03-15 11:00:00",
"payer_name": "Ahmet Yılmaz",
"payer_email": "ornek@sirket.com"
}
}
}