Quickstart

The e-Invoicing API is used in 3 steps:

  1. Onboard party (optional if the party is already onboarded)
  2. Submit a transaction
  3. Listen to webhook response (alternatively poll until the result is ready - not recommended)

Prerequisites

  • Your account is set up with Fonoa and an API key was provided. Check here how to setup the key on API requests.
  • Your product configuration must be set up by a Fonoa solutions engineer (logo, colours, a list of countries that the customer will use, webhook URL, …)

1. Onboard a party

Here you can find the complete onboard documentation.

This step is used for onboarding your own company and the underlying sellers in case you are running a marketplace. If the suplier is already onboarded it's not necessary to onboard it again.

Make an API call to POST api.fonoa.com/onboarding/v2/companies - there, you need to enter the information required to onboard a supplier.

Below is an example JSON body for onboarding a company using the /companies endpoint:

{
    "meta": {
        "country_code": "hu",
        "language_code": "hu",
        "external_id": "Account0001HU"
    },
    "legal_name": "Supplier ABC",
    "company_number": "69061864-2-99",
    "address": {
        "country_code": "hu",
        "city": "Budapest",
        "postal_code": "5600",
        "address_line_1": "Karlowy Tavidze"
    },
    "tax_information": {
        "tax_number": "69061864-2-99",
        "regime": "VAT"
    },
    "tax_credentials":
        {
        "certificate_base64": "",    // Signature Key from NAV
        "certificate_password": "",  // Replacement (Exchange) Key from NAV
        "username": "USERNAME",
        "password": "PASSWORD"
        }
    }

Example of the response

    "status": "success",
    "data": {
        "job_id": "9bf457f955fc451293db323e3558019d",
        "job_status_location": "https://api.fonoa.com/onboarding/v2/jobs/9bf457f955fc451293db323e3558019d"
    },
    "message": "Create company job successfully queued for execution",
    "errors": null
}

Get the supplier Identification

Make an API call to GET https://api.fonoa.com/onboarding/v2/jobs/{job_id} - where the job_id is part of the response of the previous request.

Below is an example of the body response when the party is onboarded with success.

{
    "status": "success",
    "data": {
        "id": "8d4a5c0303234432ab11a3beecdbb4c3",
        "location": "https://api.fonoa.com/onboarding/v2/companies/8d4a5c0303234432ab11a3beecdbb4c3"
    },
    "message": null,
    "errors": null
}

2. Submit a transaction

Here you can find the complete submit transaction documentation.

To submit a transaction send HTTP POST api.fonoa.com/v1/transactions with the following body containing the details of the transactions and the ID of the party onboarded.

The placeholder suplier_idmust be replaced with the value of the id received in the previous request.

{  
  "country_code": "IE",  
  "language_code": "EN",  
  "currency_code": "EUR",  
  "transaction_date": "2022-08-02T12:51:25Z",  
  "transaction_number": "000000001",  
  "transaction_id": "MY_TEST_ID_0001",  
  "items": [  
    {  
      "number": 1,  
      "name": "Chocolate cookies",  
      "quantity": 3.0,  
      "unit": "pcs",  
      "unit_price": 7570,  
      "type": "GOODS",  
      "tax_breakdowns": [  
        {  
          "rate": 25.0,  
          "regime": "VAT"  
        }  
      ]  
    }  
  ],  
  "supplier": {  
    "id": "{supplier_id}"  
  },  
  "customer": {  
    "legal_name": "John Fitzgerald Kennedy",  
    "entity_number": "011589551",  
    "address": {  
      "country_code": "IE",  
      "city": "Dublin",  
      "postal_code": "10000Z",  
      "address_line_1": "752 A, Silky roads, Split"  
    },  
    "type": "INDIVIDUAL"  
  },  
  "issuer": {  
    "legal_name": "Acme LLC",  
    "trade_name": "Acme",  
    "entity_number": "011589551",  
    "address": {  
      "country_code": "IE",  
      "city": "Dublin",  
      "postal_code": "10000Z",  
      "address_line_1": "752 A, Silky roads, Split"  
    },  
    "tax_information": {  
      "tax_number": "69061864-5-99",  
      "regime": "VAT"  
    },  
    "type": "BUSINESS"  
  },  
  "note": "This is my HTML <b>enabled</b> note.",  
  "payments": [  
    {  
      "type": "CREDIT",  
      "code": "PUE",  
      "amount": 22710  
    }  
  ]  
}

If there are no validation errors clients shall receive 202 Accepted with the following response body:

{  
	"operation_id": "4d697215-76c9-11ed-bfa7-660c4038a014"  
}

3. Get the result

There are two ways to get the results of an operation

  1. Get a notification via webhook (recommended).
  2. Polling the result only applicable when setting up a webhook is not available.

Here you can find the complete documentation about these two options.

For this quickstart page we will use the request used for polling just to illustrate the change on state of the transaction.

The transaction may be polled using the GET https://api.fonoa.com/v1/transctions/{operation_id} endpoint - where the operation_id is the id received in the response of the Submit transaction step.

Here you can find the complete documentation about the get transaction endpoint.

Below and example of response of this API:

{
    "attachments": [
        {
            "kind": "VISUAL",
            "resource_id": "018d695c026a71ffb56813da3d93f0a9",
            "resource_url": "https://api.fonoa.com/Invoicing/v1/Invoices/018d695c026a71ffb56813da3d93f0a9/pdf",
            "type": "PDF"
        }
    ],
    "business_model": "B2C",
    "country_code": "PT",
    "currency_code": "EUR",
    "direction": "SENT",
    "document_generated_at": "2024-02-02T10:27:37.7617395Z",
    "items": [
        {
            "code": "08081000",
            "description": "Maintenance parts for a device",
            "ean": "5012345678900",
            "name": "Maintenance Parts",
            "net_price": 0,
            "number": 1,
            "quantity": 120,
            "tax_breakdown": [
                {
                    "amount": 0,
                    "rate": 13,
                    "regime": "IVA",
                    "type": "PT"
                }
            ],
            "type": "GOODS",
            "unit": "pcs",
            "unit_price": 7570
        }
    ],
    "language_code": "PT",
    "operation_id": "018d695c-026a-71ff-b568-13da3d93f0a9",
    "operation_regime": "GENERAL",
    "payments": [
        {
            "amount": 25662,
            "code": "PPD",
            "type": "OTHER"
        }
    ],
    "qr_code": "A:213987465*B:999999990*C:PT*D:FT*E:N*F:20220802*G:FT XZ001/8*H:K2JFFN9C-8*I1:PT*I5:9084.00*I6:1180.92*N:1180.92*O:10264.92*Q:0T/o*R:2853",
    "reported_at": "2024-02-02T10:27:37.380400869Z",
    "status": "SUCCESS",
    "supplier": {
        "external_id": "631c2779-ef72-42f1-bfc3-fe4a2b758114"
    },
    "tax_authority_id_1": "0T/o",
    "tax_authority_id_2": "K2JFFN9C-8",
    "total_amount": 1026492,
    "total_net_amount": 908400,
    "total_tax_amount": 118092,
    "transaction_date": "2022-08-02T12:51:25Z",
    "transaction_id": "VF_RCPT_EXAMPLE_2",
    "transaction_number": "FT XZ001/8",
    "type": "FULL",
    "unique_transaction_number": "PT213987465-2022-FT XZ001/8"
}