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://pos.cloudware.pt/ws/v1.1/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://pos.cloudware.pt/ws/v1.1/documents/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'GET';
$params = array(
'store_id' => 123456,
'register_id' => 1234567,
'client_id' => 1234567,
'client_fiscal_id' => '123456789',
'client_country' => 'PT',
'type' => 'FT',
'subtype' => 'G',
'since' => '2024-01-01',
'until' => '2024-12-31',
'q' => '01P2024/133',
'external_reference' => 'SSO00092/133',
'status' => 'N',
'view' => 'normal',
'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 |
client_id | int | 1234567 | Client ID |
client_fiscal_id | string | 123456789 | Client Fiscal ID |
client_country | string | PT | Client Country |
type | string | FT | Valid Document Type You may send a comma separated string with multiple document types |
subtype | string | G | Document Sub Type You may send a comma separated string with multiple document sub types |
since | date | 2024-01-01 | Min date |
until | date | 2024-12-31 | Max date |
q | string | 01P2024/133 | Search string |
external_reference | string | SSO00092/133 | Search string |
status | stringN - NormalA - CanceledF - Invoiced | Status | |
view | string normal, detailed | More details of the documents | |
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 |
date_supply | date | 2016-01-15 | Delivery Date |
system_time | datetime | 2016-01-02 10:01:20 | System date and time System time is always defined using UTC timezone |
local_time | datetime | 2016-01-02 10:01:20 | Local date and time Local time according to your timezone |
amount_gross | currency | 123.00 | Total amount |
amount_net | currency | 100.00 | Total amount before taxes |
type | string | FT | Document Type |
subtype | string | G | Document Subtype |
tax_authority_id | string | 10000708560 | Tax Authority ID Only for movement of goods |
status | string | N | Status |
qty_left_to_invoice | float | 1 | Quantity left to invoice Returned only when document is a "Guia Global" |
total_unpaid | float | Unpaid amount | |
payment_status | string pending, expired, paid | Payment Status | |
external_reference | string | PT00192-24-21302 | External reference |
Returns all information about a specific document. To obtain a pdf version, just add .pdf
extension to the document's id.
<?php
$url = 'https://pos.cloudware.pt/ws/v1.1/documents/12345/';
// $url = 'https://pos.cloudware.pt/ws/v1.1/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://pos.cloudware.pt/ws/v1.1/documents/12345/';
// $url = 'https://pos.cloudware.pt/ws/v1.1/documents/12345.pdf';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'GET';
$params = array(
'mode' => 'normal',
'copies' => 1,
'output' => 'html',
'output_template_id' => 123,
'output_version' => 'ORIGINAL',
'return_qrcode' => 1 or 0,
'download' => 1 or 0,
'register_id' => 12345,
);
$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 | |
copies | int 1, 2, 3 | Number of copies | |
output | string auto, pdf, html, escpos, tpasibs, json | Printable Output | |
output_template_id | int | 123 | Template ID |
output_version | string ORIGINAL, SECOND | Version | |
return_qrcode | int | 1 or 0 | Return SVG Qrcode |
download | int | 1 or 0 | Download PDF. Only .pdf extension |
register_id | int | 12345 | Register ID. Only used if the output is auto |
Name | Type | Example | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | int | 12345 | ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type | string | FT | Official type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subtype | string | G | Document Subtype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tax_authority_id | string | 10000708560 | Tax Authority ID Only for movement of goods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
number | string | FT 01P2016/220 | Document Number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date | date | 2016-01-02 | Date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date_supply | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
local_time | datetime | 2016-01-02 10:01:20 | Local date and time Local time according to your timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
external_reference | string | PT00192-2024-21302 | External reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
qty_left_to_invoice | float | 1 | Quantity left to invoice Returned only when document is a "Guia Global" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
status | array | Status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debt | array | Debt amount | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
irs | array | IRS data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
movement_of_goods | array | Transportation info | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
related_docs | collection | Related documents | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hash | string | Bgah | Validation hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
atcud | string | JFAAAAAA-123 | ATCUD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output | text | Printable output | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output_data | immutable | Printable output data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
qrcode | text | Qrcode SVG | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
qrcode_data | text | Qrcode Data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
multibanco | array | Your own multibanco data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
venduspay | array | Vendus Pay Smart Checkout Page | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Creates a new document like an invoice, a credit note, a receipt for a payment, a transportation document, and all others.
Invoices
The only mandatory parameter when creating an invoice 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. Regarding client
, you don't have to send this parameter if you don't have his fiscal_id
, and you should NEVER send fiscal_id
as 999999990. And if client
does not exist, it will be added.
Credit Notes
When creating a NC, you must specify reference_document
for each item, passing document_number
and document_row
which unequivocally identifies an existing line on the original invoice, along with id
and qty
. You also have to specify notes stating the reason for issuing the credit note.
Payments and Receipts
To register a customer's payment, you create a receipt, that is, a document of type RG
. Relevant parameters are payments
and invoices
, which should contain a list of all invoices being paid, each identified by its document_number
. You should NOT send items
.
<?php
$url = 'https://pos.cloudware.pt/ws/v1.1/documents/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'POST';
$params = array(
'register_id' => 12345,
'type' => 'FT',
'discount_code' => '23-180523-7',
'discount_amount' => 10.00,
'discount_percentage' => '2.50',
'date_due' => '2024-12-31',
'mode' => 'normal',
'date' => '2024-05-04',
'date_supply' => '2024-05-04',
'notes' => 'New season',
'ncr_id' => 'Specific to CV',
'external_reference' => 'PT00192-2024-21302',
'stock_operation' => 'out',
'ifthenpay' => 'no',
'eupago' => 'no',
'print_discount' => 'no',
'output' => 'html',
'output_template_id' => 123,
'tx_id' => '123',
'errors_full' => 'no',
'rest_room' => 12345,
'rest_table' => 12345,
'occupation' => 2,
'stamp_retention_amount' => 100.00,
'irc_retention_id' => 'a',
'related_document_id' => 12345,
'return_qrcode' => 1 or 0,
'doc_to_generate' => 'FT',
'multibanco' => array(
'entity' => '10022',
'reference' => '222333444',
'amount' => 22.53,
),
'client' => array(
'id' => 12345,
'fiscal_id' => '223098091',
'name' => 'Alberto Lopes',
'address' => 'Av. Sousa Magalhães, 126',
'postalcode' => '4100-039',
'city' => 'Lisboa',
'phone' => '210 192 930',
'mobile' => '918 876 546',
'email' => 'alberto.lopes@dominio.pt',
'website' => 'https://www.dominio.pt',
'notes' => 'VIP client',
'country' => 'PT',
'external_reference' => 'AB892798/19',
'send_email' => 'yes',
'billing_email' => 'alberto.lopes.contabilista@dominio.pt',
'irs_retention' => 'no',
),
'supplier' => array(
'id' => 12345,
'fiscal_id' => '223098091',
'name' => 'Alberto Lopes',
'address' => 'Av. Sousa Magalhães, 126',
'postalcode' => '4100-039',
'city' => 'Lisboa',
'phone' => '210 192 930',
'mobile' => '918 876 546',
'email' => 'alberto.lopes@dominio.pt',
'website' => 'https://www.dominio.pt',
'country' => 'PT',
'obs' => 'Some info about supplier',
),
'movement_of_goods' => array(
'vehicle_id' => '00-AB-00',
'show_prices' => 'yes',
'loadpoint' => array(
'date' => '2016-10-01',
'time' => '10:05',
'address' => 'Rua Amadeu Sousa Cardoso, 13',
'postalcode' => '4100-423',
'city' => 'Porto',
'country' => 'PT',
'store_id' => 1234,
'changestock' => 'out',
),
'landpoint' => array(
'is_global' => 'no',
'date' => '2016-10-02',
'time' => '09:15',
'address' => 'Rua Almada Negreiros, 98',
'postalcode' => '1100-123',
'city' => 'Lisboa',
'country' => 'PT',
'store_id' => 1234,
'receivestock' => 'yes',
),
),
'payments' => array(
array(
'id' => '1234',
'amount' => 100.00,
'date_due' => '2024-12-31',
'venduspay_id' => 'xxxxxxxxxx',
),
),
'items' => array(
array(
'id' => 12345,
'reference' => 'CAFK001',
'gross_price' => 12345,
'supply_price' => 12345,
'qty' => 3.530,
'type_id' => 'P',
'variant_id' => 12345,
'lot_id' => 12345,
'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',
'tax_exemption_law' => 'Artigo 13.º do CIVA',
'text' => 'New Edition',
'serial' => '87393872983792',
'tax_custom' => array(
'country' => 'PT, ES, FR, PT-AC',
'rate' => 23,
'code' => 'NOR, INT, RED, NS, ...',
'type' => 'IVA',
),
'reference_document' => array(
'document_number' => 'FT 01P2016/220',
'document_row' => 3,
'reference_id' => 1234,
'reference_relation' => 'GG',
),
),
),
'invoices' => array(
array(
'document_number' => 'FT 01P2016/28',
),
),
);
$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_code | string | 23-180523-7 | Discount code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_amount | currency | 10.00 | Discount in euros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
discount_percentage | string | 2.50 | Discount in percentage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date_due | date | 2024-12-31 | Due date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payments | collection | Payment Methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | string normal, tests | Working mode If not provided, it will be assumed register's mode definition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date | date | 2024-05-04 | If not set, defaults to current date. Can not be ealier than the one from latest document, nor later than the current date. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date_supply | date | 2024-05-04 | If not set, defaults to current date. Date when goods/services are made available to customer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
notes | string | New season | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ncr_id | string | Specific to CV | NC reason ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
external_reference | string | PT00192-2024-21302 | External reference For example, to reference a tracking code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stock_operation | stringin - Increment stocknone - Don't change stockout - Decrement stock | Operation on items with stock_control. If not sent, system will use the default for the type of document being created | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ifthenpay | string no, yes | Generate ifthenpay reference. If not set, default is no. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eupago | string no, yes | Generate euPago reference. If not set, default is no. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
multibanco | array | Your own multibanco data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
client | array | Client | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
supplier | array | Supplier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
items | collection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
movement_of_goods | array | Transportation info | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoices | collection | When creating a RG | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
print_discount | string yes, no | Print Discount Coupons | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output | string auto, pdf, html, escpos, tpasibs | Printable Output | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output_template_id | int | 123 | Template ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tx_id | string | 123 | Transaction unique identifier. If set, this will ensure that only a document may be created using the same tx_id, even if multiple requests are made by mistake. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errors_full | string no, yes | Whether to return full error info or just error string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rest_room | int | 12345 | ID Room | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rest_table | int | 12345 | ID Table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
occupation | int | 2 | Occupation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stamp_retention_amount | currency | 100.00 | Amount in euros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
irc_retention_id | text | a | IRC ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
related_document_id | int | 12345 | ID of a document that relates to this one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return_qrcode | int | 1 or 0 | Return SVG Qrcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
doc_to_generate | string FT, FR | Type of document to generate when RG or OT is paid |
Name | Type | Example | Description |
---|---|---|---|
id | int | 12345 | ID |
type | string | FT | Official type |
subtype | string | G | Document Subtype |
tax_authority_id | string | 10000708560 | Tax Authority ID Only for movement of goods |
number | string | FT 01P2016/220 | Document Number |
date | date | 2016-01-02 | Date |
date_supply | 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 |
local_time | datetime | 2016-01-02 10:01:20 | Local date and time Local time according to your timezone |
amount_gross | currency | 123 | Total amount after taxes |
amount_net | currency | 100.00 | Total amount before taxes |
hash | string | Bgah | Validation hash |
atcud | string | JFAAAAAA-123 | ATCUD |
output | text | Printable output | |
output_data | immutable | Printable output data | |
qrcode | text | Qrcode SVG | |
qrcode_data | text | Qrcode Data |
<?php
$url = 'https://pos.cloudware.pt/ws/v1.1/documents/12345/';
$apiKey = 'c433ff57a5ba6cdf301a48c97d9432594e35e73ce545945639bc4fb5798f1e8a';
$method = 'PATCH';
$params = array(
'stock' => 'true',
'status' => 'N',
'mode' => 'normal',
);
$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 |
stock | string | true | stock |
status | stringN - NormalA - CanceledF - Invoiced | Estado | |
mode | string normal, tests | Working mode |
Name | Type | Example | Description |
---|---|---|---|
id | int | 1234 | ID |
status | stringN - NormalA - CanceledF - Invoiced | Estado |