#Get Invoice API.

The following endpoint allows merchant to get invoice from their Fatora Platform account.

https://api.fatora.io/v1/invoices/{invoice_id}
curl --location --request GET 'https://api.fatora.io/v1/invoices/{invoice_id}' \ 
--header 'api_key: E4B73FEE-F492-4607-A38D-852B0EBC91C9' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fatora.io/v1/invoices/{invoice_id}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_HTTPHEADER => array(
    'api_key: E4B73FEE-F492-4607-A38D-852B0EBC91C9',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
// Define the API endpoint URL.
string apiUrl = "https://api.fatora.io/v1/invoices/{invoice_id}";

// Define the API key.
string apiKey = "E4B73FEE-F492-4607-A38D-852B0EBC91C9";

// Create a WebRequest.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);

// Set the request method to GET.
request.Method = "GET";

// Set the API key header.
request.Headers.Add("api_key", apiKey);

// Set the request content type.
request.ContentType = "application/json";

try
{
    // Get the response.
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    {
        if (response.StatusCode == HttpStatusCode.OK)
        {
            // Read the response data.
            using (var responseStream = response.GetResponseStream())
            using (var reader = new StreamReader(responseStream))
            {
                string responseContent = reader.ReadToEnd();
                Console.WriteLine("API Response: " + responseContent);
            }
        }
        else
        {
            Console.WriteLine("API Request failed with status code: " + response.StatusCode);
        }
    }
}
catch (WebException ex)
{
    Console.WriteLine("API Request failed with an exception: " + ex.Message);
}
{
    "status": "SUCCESS",
    "invoice": 
        {
            "id": 2075,
            "number": "INV567",
            "currency": "QAR",
            "terms_conditions": "Sample terms and conditions",
            "note": null,
            "due_date": "2023-11-23T10:21:04",
            "date": "2023-10-24T10:21:00.9047758+02:00",
            "status": "paid",
            "type": "Detailed invoice",
            "client": {
                "id": 1307,
                "name": "Client name",
                "address": "Client address",
                "phone": "Phone number",
                "email": "[email protected]",
                "notes": null
            },
            "title": "Sample Invoice",           
            "link": "https://example.com/sample-link",
            "items": [
                {
                    "id": 2376,
                    "description": "Sample invoice description",
                    "type": "Service Item",                    
                    "qty": 1.0,
                    "amount": 100.0
                }
            ],
            "payments": [
                {
                    "id": 942,
                    "payment_date": "2023-10-10T00:00:00",
                    "transaction_id": "TXN123",
                    "amount": 100.0,
                    "note": "external",
                    "payment_type": "Credit",
                    "status": "Paid"
                },
                {
                    "id": 943,
                    "payment_date": "2023-10-10T00:00:00",
                    "transaction_id": "TXN456",
                    "amount": 50.0,
                    "note": "external",
                    "payment_type": "PayPal",
                    "status": "Paid"
                }
            ],
            "setting": {
                "tax": false,
                "discount": 0.0,
                "discount_type": "",
                "language": "ar",
                "accepted_payment_methods": {
                    "card": true,
                    "bank_account": true,
                    "cash": true,
                    "paypal": true,
                    "e_signature": true
                }
            }
        }    
}

Try it now: Get Invoice API

Header Parameters

Header Value
api_key REQUIRED Use the valid API key of your Fatora account. Read more information about Authentication.
Content-Type REQUIRED application/json

Query Parameters

Parameter Description
invoice_id REQUIRED intUnique identifier of the invoice to retrieved.

Response

HTTP Status Code: 200 OK - The invoice information has been successfully retrieved.

Response Schema: application/json
status string the status of response.
SUCCESS
invoice object item:
  • id: int the id of item
  • number: string the invoice number
  • currency: string the currency of the invoice
  • terms_conditions: string the terms and conditions of the invoice
  • note: string the note of the invoice
  • due_date: string the due date of the invoice
  • date: string the date of the invoice
  • status: string the status of the invoice
  • type: string the type of the invoice
  • client: object the client information:
    • id: int the client id
    • name: string the client name
    • address: string the client address
    • phone: string the client phone number
    • email: string the client email
    • notes: string the client notes
  • title: string the title of the invoice
  • link: string the link URL of the invoice
  • items: array an array of items:
    • id: int the item id
    • description: string the item description
    • type: string the item type
    • qty: float the item quantity
    • amount: float the item amount
  • payments: array an array of payments:
    • id: int the payment id
    • payment_date: string the payment date
    • transaction_id: string the transaction ID
    • amount: float the payment amount
    • note: string the payment note
    • payment_type: string the payment type
    • status: string the payment status
  • setting: object the settings of the invoice:
    • tax: bool is tax enabled
    • discount: float the discount amount
    • discount_type: string the discount type
    • language: string the invoice language
    • accepted_payment_methods: object the accepted payment methods:
      • card: bool is card payment accepted
      • bank_account: bool is bank account payment accepted
      • cash: bool is cash payment accepted
      • paypal: bool is PayPal payment accepted
      • e_signature: bool is e-signature accepted

Otherwise if there was a problem with your request, you'll receive an error response such as 400 status code, and the response will include an error object describing why this request failed.

Response Schema: application/json
status string The status of response.
error object:
  • error_code string, the naumber of error: e.g: 400, For more information
    see Response Code
  • description string, the description of error: e.g: bad request
technical-support

🛠️ Technical Support