Geliştirici Merkezi

TR

CreateInvoice

Belirtilen parametrelere göre yeni bir fatura oluşturun.

Method / Endpoint

POST/ {{API_URL}} Billing/CreateInvoice

İstek Parametreleri

Parametre Adı Türü Zorunlu Açıklama
user_id Integer Evet Fatura Oluşturulacak Müşterinin ID Numarası
notification Boolean Hayır Bildirim Gönderilme Durumu
notes String Hayır Fatura Notu (Personellerin görebilmesi içindir.)
status String Hayır Fatura Durumu. Alabileceği değerler: "unpaid',' "pending',' "paid',' "refunded',' "cancelled'. Varsayılan: "unpaid"
formalize Boolean Hayır Resmileştirilme Durumu
formalize_file String Hayır Resmileştirilme dosyası bir URL içermelidir.
Dahili API kullanılıyorsa bir dizin yolu da belirtebilirsiniz.

(İletilen dosya otomatik olarak sisteme kopyalanacaktır.)
created_at String Hayır Fatura Oluşturulma Tarihi. Format: YYYY-MM-DD HH:ii:ss
Varsayılan: İstek atılan tarih geçerli sayılır.
due_date String Evet Son Ödeme Tarihi. Format: YYYY-MM-DD HH:ii:ss
payment_date String Hayır Ödenme Tarihi. Format: YYYY-MM-DD HH:ii:ss
Fatura durumu: "paid" veya "pending" ise zorunludur.
refund_date String Hayır Fatura İade Tarihi. Format: YYYY-MM-DD HH:ii:ss
Fatura durumu "refunded" ise zorunludur.
currency String Evet Faturanın Para Birimi. Format: ISO 4217. Örneğin: USD, EUR, GBP, TRY
payment_method String Hayır Ödeme Yöntemi Adı
payment_method_data Object Hayır Ödeme Yöntemi Verileri
payment_method_commission Double Hayır Ödeme Yöntemi Komisyon Tutarı
payment_method_commission_rate Double Hayır Ödeme Yöntemi Komisyon Oranı
send_bill_to_address Double Hayır Adrese Fatura Gönderim Ücreti
exchange Double Hayır Mevcut Döviz Kuru
discounts Object Hayır İndirimler
discounts.type String Evet İndirim Türü ("promotion": Promosyon, "coupon": Kupon, "dealership": Bayi)
discounts.sequence Integer Evet Fatura ögesinde belirlediğiniz "sequence" bilgisi ile aynı olmalıdır.
discounts.rate Double Hayır İndirim Yüzdesi. Varsayılan: 0
discounts.amount Double Evet Uygulanan İndirim Tutarı
discounts.description String Evet İndirim Adı: Kupon kodu, Promosyon adı vb.
discounts.dkey String Hayır Eğer indirim türü "dealership" ise bayilik indiriminin hangi üründen veya ürün grubundan elde edildiğinin bilgisi.
items Object Evet Fatura Ögeleri
items.sequence Integer Evet Fatura Öge Sıra Numarası
items.description String Evet Fatura Öge Açıklaması
items.quantity Integer Hayır Fatura Öge Miktarı. Varsayılan : 1
items.amount Double Evet Fatura Öge Birim Fiyatı
items.total Double Hayır Fatura Öge Toplam Tutar. Varsayılan: Birim Fiyatı
items.order_id Integer Hayır Fatura ögesinin bağlı olduğu ürün/hizmet ID numarası. Bu bilgi, veri tabanında "users_products " tablosundaki "id" alanından elde edilebilir.
items.due_date String Hayır Fatura ögesi eğer bir ürün/hizmete bağlıysa ürün/hizmetin bitiş tarihi ile aynı olmalıdır. Format: YYYY-MM-DD HH:ii:ss
items.attributes Object Hayır Fatura ögesi eğer bir ürün/hizmete bağlıysa, bağlı olduğu ürün/hizmetin satın alımıyla veya yenilenmesiyle alakalı bilgiler yer almaktadır.

Harici Örnek

curl --location 'https://example.com/api/Billing/CreateInvoice' \
--header 'Content-Type: application/json' \
--header 'Apikey: [YOUR_API_KEY]' \
--data '{
    "user_id": 22,
    "notification": false,
    "notes": "I created this invoice with API",
    "status": "unpaid",
    "formalize": false,
    "formalize_file": null,
    "created_at": "2023-12-13 16:25:00",
    "due_date": "2023-12-20 23:59:59",
    "payment_date": null,
    "refund_date": null,
    "currency": "USD",
    "payment_method": null,
    "payment_method_data": [],
    "payment_method_commission": 0,
    "payment_method_commission_rate": 0,
    "send_bill_to_address": 0,
    "exchange": null,
    "items": [
        {
            "sequence": 1,
            "description": "test description 1",
            "quantity": 1,
            "amount": 100,
            "total": 100,
            "order_id": 0,
            "due_date": null,
            "attributes": {
                "sample1": "Example test 1"
            }
        },
        {
            "sequence": 2,
            "description": "Sample Web Hosting (#123) (example.com) (2023-11-20 - 2023-12-20)",
            "quantity": 1,
            "amount": 143.23,
            "total": 143.23,
            "order_id": 123,
            "due_date": "2023-12-20 23:59:59",
            "attributes": {
                "event": "ExtendOrderPeriod"
            }
        }
    ],
    "discounts": [
        {
            "type": "promotion",
            "description": "Test Promotion 1",
            "sequence": 1,
            "rate": 5,
            "amount": 1
        },
        {
            "type": "coupon",
            "description": "AE1Q2CDF3",
            "sequence": 2,
            "rate": 20,
            "amount": 28.646
        }
    ]
}'

Dahili Örnek

Helper::Load("Api");
try {
    $result = Api::Billing()->CreateInvoice([
        'user_id'                        => 22,
        'notification'                   => false,
        'notes'                          => 'I created this invoice with API',
        'status'                         => 'unpaid',
        'formalize'                      => false,
        'formalize_file'                 => NULL,
        'created_at'                     => '2023-12-13 16:25:00',
        'due_date'                       => '2023-12-20 23:59:59',
        'payment_date'                   => NULL,
        'refund_date'                    => NULL,
        'currency'                       => 'USD',
        'payment_method'                 => NULL,
        'payment_method_data'            => [],
        'payment_method_commission'      => 0,
        'payment_method_commission_rate' => 0,
        'send_bill_to_address'           => 0,
        'exchange'                       => NULL,
        'items'                          => [
            [
                'sequence'    => 1,
                'description' => 'test description 1',
                'quantity'    => 1,
                'amount'      => 100,
                'total'       => 100,
                'order_id'    => 0,
                'due_date'    => NULL,
                'attributes'  => [
                    'sample1' => 'Example test 1',
                ],
            ],
            [
                'sequence'    => 2,
                'description' => 'Sample Web Hosting (#123) (example.com) (2023-11-20 - 2023-12-20)',
                'quantity'    => 1,
                'amount'      => 143.22999999999999,
                'total'       => 143.22999999999999,
                'order_id'    => 123,
                'due_date'    => '2023-12-20 23:59:59',
                'attributes'  => [
                    'event' => 'ExtendOrderPeriod',
                ],
            ],
        ],
        'discounts'                      => [
            [
                'type'        => 'promotion',
                'description' => 'Test Promotion 1',
                'sequence'    => 1,
                'rate'        => 5,
                'amount'      => 1,
            ],
            [
                'type'        => 'coupon',
                'description' => 'AE1Q2CDF3',
                'sequence'    => 2,
                'rate'        => 20,
                'amount'      => 28.646000000000001,
            ],
        ],
    ]);
    print_r($result);
}
catch (Exception $e)
{
    echo 'Error: '.$e->getMessage();
}

Örnek JSON Yanıtı

{
    "status": "successful",
    "data": {
        "id": 468,
        "number": "#468",
        "user": {
            "id": 22,
            "lang": "en",
            "type": "corporate",
            "identity": "11111111111",
            "company_name": "ABC LLC",
            "company_tax_number": "12345",
            "company_tax_office": "XTESTX",
            "name": "Mark",
            "surname": "Roberson",
            "full_name": "Mark Roberson",
            "email": "[email protected]",
            "phone": "19142426349",
            "address": {
                "country_code": "US",
                "country_name": "United States",
                "city": "New York",
                "state": "Mount Kisco",
                "detail": "1159 Lake Forest Drive",
                "zipcode": "10549"
            }
        },
        "taxation_type": "exclusive",
        "notes": "I created this invoice with API",
        "created_at": "2023-12-13 16:25:00",
        "due_date": "2023-12-20 23:59:59",
        "payment_date": "0000-00-00 00:00:00",
        "refund_date": "0000-00-00 00:00:00",
        "status": "unpaid",
        "formalize": false,
        "local": false,
        "taxfree": false,
        "formalize_file": null,
        "exchange_rate": 1,
        "currency": "USD",
        "tax_rate": 0,
        "subtotal": 243.229999999999989768184605054557323455810546875,
        "tax": 0,
        "total": 213.58400000000000318323145620524883270263671875,
        "payment_method": "None",
        "payment_method_data": [],
        "payment_method_commission": 0,
        "payment_method_commission_rate": 0,
        "send_bill_to_address": 0,
        "share": {
            "token": "bGI1UlRBVXpPL3lmZThpTmM1Zy9pdXhoZldFa3E1cUdNQmRSVWJCV0ROMD0=",
            "link": "https://example.com/en/invoice?token=bGI1UlRBVXpPL3lmZThpTmM1Zy9pdXhoZldFa3E1cUdNQmRSVWJCV0ROMD0="
        },
        "discounts": [
            {
                "type": "coupon",
                "item_id": 571,
                "rate": 20,
                "description": "AE1Q2CDF3",
                "amount": 28.6460000000000007958078640513122081756591796875
            },
            {
                "type": "promotion",
                "item_id": 570,
                "rate": 5,
                "description": "Test Promotion 1",
                "amount": 1
            }
        ],
        "items": [
            {
                "id": 570,
                "owner_id": 468,
                "description": "test description 1",
                "quantity": 1,
                "tax_exempt": false,
                "amount": 100,
                "total": 100,
                "order_id": 0,
                "due_date": "2023-12-20 23:59:59",
                "attributes": {
                    "sample1": "Example test 1"
                }
            },
            {
                "id": 571,
                "owner_id": 468,
                "description": "Sample Web Hosting (#123) (example.com) (2023-11-20 - 2023-12-20)",
                "quantity": 1,
                "tax_exempt": false,
                "amount": 143.229999999999989768184605054557323455810546875,
                "total": 143.229999999999989768184605054557323455810546875,
                "order_id": 123,
                "due_date": "2023-12-20 23:59:59",
                "attributes": {
                    "event": "ExtendOrderPeriod"
                }
            }
        ]
    }
}

Yanıt Parametreleri

Parametre Adı Türü Açıklama
status String Eylem Durumu "successful" veya "error"
message String Eylem Durumu "error" gelmişse, hata mesajı
data Object "getInvoice" ile aynı verileri iletmektedir.
GetInvoices UpdateInvoice

Bir Sorunuz mu Var?

Bize yazmaktan çekinmeyin. En kısa sürede yanıt göndereceğiz.
Bize Ulaşın.
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top