Returns a list of existing documents that may be filtered using store_id
, register_id
, type
and date (using since
and until
). Please take a look at the Requests page of this documentation to learn how to use pagination parameters.
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
?>
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'GET';
$params = array(
'store_id' => 123456,
'register_id' => 1234567,
'type' => 'FT',
'since' => '2024-01-01',
'until' => '2024-12-31',
'mode' => 'normal',
);
$url .= '?' . http_build_query($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
$result = curl_exec($curl);
?>
Name | Type | Example | Description |
---|---|---|---|
store_id | int | 123456 | Store ID |
register_id | int | 1234567 | Register ID |
type | stringFT - FaturaFS - Fatura SimplificadaFR - Fatura ReciboNC - Nota de CréditoDC - Consulta de MesaPF - Fatura Pró-FormaOT - OrçamentoEC - EncomendaGA - Guia de Ativos PrópriosGT - Guia de TransporteGR - Guia de RemessaGD - Guia de DevoluçãoRG - Recibo | Type | |
since | date | 2024-01-01 | Min date |
until | date | 2024-12-31 | Max date |
mode | string normal, tests | Working mode |
Name | Type | Example | Description |
---|---|---|---|
id | int | 12345 | ID |
number | string | FT 01P2016/220 | Document number |
date | date | 2016-01-02 | Date |
store_id | int | 12345 | Store ID |
register_id | int | 12345 | Register ID |
date_due | date | 2016-01-15 | Payment date When payment is due |
system_time | datetime | 2016-01-02 10:01:20 | System date and time System time is always defined using UTC timezone |
amount_gross | currency | 123.00 | Total amount |
amount_net | currency | 100.00 | Total amount before taxes |
Returns all information about a specific document. To obtain a pdf version, just add .pdf
extension to the document's id.
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/12345/';
// $url = 'https://www.vendus.pt/ws/v1.0/documents/12345.pdf';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
?>
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/12345/';
// $url = 'https://www.vendus.pt/ws/v1.0/documents/12345.pdf';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'GET';
$params = array(
'mode' => 'normal',
'output' => 'html',
);
$url .= '?' . http_build_query($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
$result = curl_exec($curl);
?>
Name | Type | Example | Description |
---|---|---|---|
mode | string normal, tests | Working mode | |
output | string pdf, escpos, html | Printable Output |
Name | Type | Example | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | int | 12345 | ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type | string | FT | Official type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
number | string | FT 01P2016/220 | Document Number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date | date | 2016-01-02 | Date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
system_time | datetime | 2016-01-02 10:01:20 | System date and time Always using UTC timezone and in sync with the Portuguese Astronomical Observatory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
amount_gross | currency | 123 | Total amount after taxes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
amount_net | currency | 100.00 | Total amount before taxes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date_due | date | 2016-01-15 | Due date When payment is due | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
observations | string | Versão vermelha | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
store_id | int | 12345 | Store ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
register_id | int | 12345 | Register ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
user_id | int | 12345 | User ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
taxes | collection | Taxes list | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discounts | array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payments | collection | Payment methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
client | array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
items | collection | Products | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
status | array | Status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debt | array | Debt amount | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
movement_of_goods | array | Transportation info | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
related_docs | collection | Related documents | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hash | string | Bgah | Validation hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output | text | Base64 Encoded | Printable output |
Creates a new document. The only mandatory parameter is items
. For each item, you must send at least its qty
, along with id
(or reference
). If it is a new product, it will be created.
Likewise, if client
does not exist, it will be added. Also regarding client
, you don't have to send this parameter if you dont have his fiscal_id
, and you should NEVER send fiscal_id
as 999999990.
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'POST';
$params = array(
'register_id' => 12345,
'type' => 'FT',
'discount_amount' => 10.00,
'discount_percentage' => 2.50,
'notes' => 'New season',
'date' => '2024-04-27',
'mode' => 'normal',
'stock_operation' => 'out',
'output' => 'html',
'client' => array(
'id' => 12345,
'fiscal_id' => '223098091',
'name' => 'Alberto Lopes',
'address' => 'Av. Sousa Magalhães, 126',
'postalcode' => '4100-039 Lisboa',
'phone' => '210 192 930',
'mobile' => '918 876 546',
'email' => 'alberto.lopes@dominio.pt',
'website' => 'https://www.dominio.pt',
'country' => 'PT',
),
'movement_of_goods' => array(
'vehicle_id' => '00-AB-00',
'loadpoint' => array(
'date' => '2016-10-01',
'time' => '10:05',
'address' => 'Rua Amadeu Sousa Cardoso, 13',
'postalcode' => '4100-423',
'city' => 'Porto',
'country' => 'PT',
),
'landpoint' => array(
'date' => '2016-10-02',
'time' => '09:15',
'address' => 'Rua Almada Negreiros, 98',
'postalcode' => '1100-123',
'city' => 'Lisboa',
'country' => 'PT',
),
),
'payments' => array(
array(
'id' => 1234,
'amount' => 100.00,
'date_due' => '2024-12-31',
),
),
'items' => array(
array(
'id' => 12345,
'reference' => 'CAFK001',
'gross_price' => 12345,
'qty' => 3.530,
'type_id' => 'N',
'title' => 'Café ao Kg',
'unit_id' => 1872,
'category_id' => 123,
'brand_id' => 124,
'discount_amount' => 124,
'discount_percentage' => 5,
'stock_control' => 1,
'stock_type' => 'M',
'tax_id' => 'NOR',
'tax_exemption' => 'M40',
'reference_document' => 'FT 01P2016/220',
'reference_row' => 3,
'text' => 'New Edition',
),
),
);
$content = json_encode($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array(
"Content-type: application/json",
"Content-Length: " . strlen($content),
)
);
$result = curl_exec($curl);
?>
Name | Type | Example | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
register_id | int | 12345 | POS ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type | stringFT - FaturaFS - Fatura SimplificadaFR - Fatura ReciboNC - Nota de CréditoDC - Consulta de MesaPF - Fatura Pró-FormaOT - OrçamentoEC - EncomendaGA - Guia de Ativos PrópriosGT - Guia de TransporteGR - Guia de RemessaGD - Guia de DevoluçãoRG - Recibo | Type of document | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_amount | currency | 10.00 | Discount in euros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_percentage | float | 2.50 | Discount in percentage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payments | collection | Payment Methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
notes | string | New season | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date | date | 2024-04-27 | If not set, defaults to current date. Can not be ealier than the one from latest document, nor later than the current date. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | string normal, tests | Working mode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
client | array | Client | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
items | collection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
movement_of_goods | array | Transportation info | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stock_operation | stringin - Increment stockout - Decrement stock | Operation on items with stock_control. If not sent, system will use the default for the type of document being created | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output | string pdf, escpos, html | Printable Output |
Name | Type | Example | Description |
---|---|---|---|
id | int | 12345 | ID |
type | string | FT | Official type |
number | string | FT 01P2016/220 | Document Number |
date | date | 2016-01-02 | Date |
system_time | datetime | 2016-01-02 10:01:20 | System date and time Always using UTC timezone and in sync with the Portuguese Astronomical Observatory |
amount_gross | currency | 123 | Total amount after taxes |
amount_net | currency | 100.00 | Total amount before taxes |
hash | string | Bgah | Validation hash |
output | text | Base64 Encoded | Printable output |
<?php
$url = 'https://www.vendus.pt/ws/v1.0/documents/12345/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'PATCH';
$params = array(
'status' => 'N',
);
$content = json_encode($params);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array(
"Content-type: application/json",
"Content-Length: " . strlen($content),
)
);
$result = curl_exec($curl);
?>
Name | Type | Example | Description |
---|---|---|---|
id | int | 1234 | ID |
status | stringN - NormalA - Anulado | Estado |
Name | Type | Example | Description |
---|---|---|---|
id | int | 1234 | ID |
status | stringN - NormalA - Anulado | Estado |