Receive an invoice
A-Cube is a great tool to fetch all incoming invoices from various sources. Because KSeF is by it's nature created to accept structured invoices only, we can use it as a hub collecting invoices from suppliers.
A-Cube provides solution to fetch invoices by NIP number of the authorized recipient and notify customer's systems.
All incoming invoices will be listed on the account of the LegalEntity in the Dashboard
--> Incoming Invoices
section. On top of it, a webhook is triggered to the recipient of the invoice.
{
"legalEntityUuid": "8b8b8755-5850-4ead-9c68-8243f4ac2748",
"invoiceUuid": "371591a0-8ac9-47c7-883f-349293baaf87",
"status": "received",
"message": null,
"ksefReferenceNumber": "8431324763-20221007-F95571-88922F-C2",
"acquisitionTimestamp": "2022-10-07 11:51:46"
}
Webhook Notification
If there is a webhook defined for legal-entity-invoice-receiver
you will get notification about incoming invoice.
{
"legalEntityUuid": "8b8b8755-5850-4ead-9c68-8243f4ac2748",
"invoiceUuid": "279dc911-d34e-463f-85fb-f86528ac7965",
"status": "received",
"message": null,
"ksefReferenceNumber": "8431324763-20221010-43ACEA-E61FF7-A3",
"acquisitionTimestamp": "2022-10-10 12:34:10"
}
Having this in place, using A-Cube REST API, it is easy to fetch details about invoice to own system.
Knowing invoiceUuid
we can request details of the invoice like:
curl -i -X GET \
'http://pl-sandbox.api.acubeapi.com/invoices/{uuid}' \
-H 'Authorization: YOUR_API_KEY_HERE'
It is also possible to fetch the source of structured invoice as an XML file.
curl --header 'Accept: application/xml' --header 'Authorization: Bearer TOKEN' http://pl-sandbox.api.acubeapi.com/invoices/UUID