/api/v1/invoice/cancel/{id}
Requires authentication
Rate limited by the `api-global` limiter
v1
Send a bearer token in the Authorization header.
Anulon faturen dhe krijon regjistrim fiskal anulimi ne sistemin e tatimeve.
I plote ose i pjesshem#
| Trupi | Cfare ndodh |
|---|---|
| bosh | Anulohet e gjithe fatura |
me lines |
Anulohet vetem pjesa e derguar, vetem per faturat Cash |
Rregullat e anulimit te pjesshem#
- cdo rresht duhet te ekzistoje ne faturen origjinale me te njejtin
product_codedheproduct_name; - sasia mund vetem te ulet ose te mbetet e njejte;
- produktet qe nuk i dergoni mbeten te shitura;
- kur i njejti produkt eshte faturuar ne dy rreshta me cmime te ndryshme, shtoni
priceper te zgjedhur rreshtin; - nje fature me zbritje mbi te gjithe faturen (
invoice_discount_type) nuk anulohet dot pjeserisht. Zbritja eshte shperndare mbi te gjitha normat e TVSH-se se dokumentit, keshtu qe nje pjese e rreshtave nuk e mban dot pjesen e vet pa e gabuar TVSH-ne. Dergoni kerkesen palinesqe te anulohet e plote.
Fatura origjinale mbetet e hapur per anulime te metejshme derisa ato ta mbulojne te gjithen, dhe vetem atehere shenohet si e anuluar.
Full URL: https://fature.al/api/v1/invoice/cancel/{id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | ID e fatures ne fature.al. |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
| lines | array | no | Rreshtat qe anulohen. Pa te anulohet e gjithe fatura; me te anulohet vetem pjesa e derguar, e mundur vetem per faturat Cash. Cdo rresht duhet te ekzistoje ne faturen origjinale me te njejtin `product_code` dhe `product_name`, dhe sasia mund vetem te ulet. Nje fature qe u leshua me zbritje mbi te gjithe faturen nuk pranon anulim te pjesshem: dergojeni kerkesen pa `lines` qe te anulohet e plote. |
| lines[].product_name | string | yes | |
| lines[].product_code | string | yes | |
| lines[].quantity | number | yes | |
| lines[].price | number, nullable | no |
Responses
201 Created
| Field | Type | Description |
|---|---|---|
| status | boolean | |
| data | object | |
| data.invoice | object | |
| data.invoice.id | integer | Fatureal invoice id. Store it next to your own internalId |
| data.invoice.number | string, nullable | Fiscal invoice number |
| data.invoice.iic | string, nullable | IIC / NSLF |
| data.invoice.fic | string, nullable | FIC / NIVF. Null while the invoice waits for a deferred fiscalisation |
| data.invoice.tcrCode | string, nullable | TCR code of the fiscal device that issued it |
| data.invoice.businessCode | string, nullable | Business unit code the invoice was issued under |
| data.invoice.operatorCode | string, nullable | Operator code the invoice was issued under |
| data.invoice.fiscalizedAt | string | Creation timestamp (YYYY-MM-DD HH:MM:SS) |
| data.invoice.verifyURL | string, nullable | Government verification URL, the one behind the QR code |
| data.invoice.pdf | string | Direct download URL for the document. On an e-invoice that already has an EIC this points at the official e-invoice PDF instead of ours |
| data.invoice.eic | string, nullable | EIC. The key is present only on an e-invoice that already has one, so treat it as absent rather than null on every other invoice |
404 Fatura nuk u gjet, ose nuk i perket kompanise suaj.
| Field | Type | Description |
|---|---|---|
| status | boolean | Always false. A successful response carries `status: true` and a `data` object instead |
| message | string | The exception message. Empty when the failure carries no exception of its own |
| errors | array | Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message` |
422 Fatura nuk mund te anulohet ne gjendjen e saj aktuale.
| Field | Type | Description |
|---|---|---|
| status | boolean | Always false. A successful response carries `status: true` and a `data` object instead |
| message | string | The exception message. Empty when the failure carries no exception of its own |
| errors | array | Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message` |
429 Kufiri i anulimeve u arrit. Pergjigja kthen vetem `message` bashke me header-in `Retry-After`.
| Field | Type | Description |
|---|---|---|
| message | string |
500 Gabim i papritur ne server. Perfshin rastin kur anulimi nuk u regjistrua ne fiskalizim.
| Field | Type | Description |
|---|---|---|
| status | boolean | Always false. A successful response carries `status: true` and a `data` object instead |
| message | string | The exception message. Empty when the failure carries no exception of its own |
| errors | array | Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message` |
Example request
curl -X POST 'https://fature.al/api/v1/invoice/cancel/403' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'X-Client-Id: YOUR_CLIENT_ID' \
-H 'X-Client-Secret: YOUR_CLIENT_SECRET' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"lines": [
{
"product_name": "Jane Doe",
"product_code": "product code",
"quantity": 2,
"price": 1999
}
]
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Authorization' => 'Bearer YOUR_TOKEN',
'X-Client-Id' => 'YOUR_CLIENT_ID',
'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->post('https://fature.al/api/v1/invoice/cancel/403', [
'lines' => [
[
'product_name' => 'Jane Doe',
'product_code' => 'product code',
'quantity' => 2,
'price' => 1999,
],
],
]);
$data = $response->json();
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'https://fature.al/api/v1/invoice/cancel/403', [
'headers' => [
'Authorization' => 'Bearer YOUR_TOKEN',
'X-Client-Id' => 'YOUR_CLIENT_ID',
'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'lines' => [
[
'product_name' => 'Jane Doe',
'product_code' => 'product code',
'quantity' => 2,
'price' => 1999,
],
],
],
]);
$data = json_decode((string) $response->getBody(), true);
const response = await fetch('https://fature.al/api/v1/invoice/cancel/403', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Client-Id': 'YOUR_CLIENT_ID',
'X-Client-Secret': 'YOUR_CLIENT_SECRET',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"lines": [
{
"product_name": "Jane Doe",
"product_code": "product code",
"quantity": 2,
"price": 1999
}
]
})
});
const data = await response.json();
Example response
{
"status": true,
"data": {
"invoice": {
"id": 1,
"number": "number",
"iic": "iic",
"fic": "fic",
"tcrCode": "tcrCode",
"businessCode": "businessCode",
"operatorCode": "operatorCode",
"fiscalizedAt": "fiscalizedAt",
"verifyURL": "https://example.com",
"pdf": "pdf",
"eic": "eic"
}
}
}
{
"status": true,
"message": "Hello there",
"errors": [
"errors"
]
}
{
"status": true,
"message": "Hello there",
"errors": [
"errors"
]
}
{
"message": "Hello there"
}
{
"status": true,
"message": "Hello there",
"errors": [
"errors"
]
}