Receipt API
Introduction
The receipt API provides endpoints to create receipts for carts, query them and generate printing instructions.
For more details about this API usage check our API documentation
Preparation
- Have an authenticated token from the authentication service, this token should be used as an authorization
bearer token
header for every request done in this API (more information about the authorization service here). - Have the cart ID you wish to create a receipt for (more information about carts here).
- That the cart ID you are using has been entirely paid using the payment API (more information about payments here).
Create a receipt
In order to create a receipt we need to provide the cart ID by making a POST request to the /receipts
endpoint. Here
is an example request.
Example request body:
Example response:
Create a receipt with postal code
Receipts can also capture the postal code of customers whenever the business requires doing so. A POST request to the
/receipts
endpoint must be done adding the cart Id and postal code in the request body. An example is shown bellow.
Example request body:
Example response:
Create a void receipt
Void receipts can also be created, these are not related to retail transactions so no cart Id is needed in the request
body. A POST request to the /receipts
endpoint must be done adding the void receipt flag in the request body. An
example is shown bellow.
Example request body:
Example response:
Generate receipt printing instructions
Part of the process of creating a receipt is to print a receipt containing information about the transaction. This API
provides an endpoint to generate printing instructions in XML format that contains general information of it. To
generate such printing instructions a GET request needs to be done with the format to
/receipts/{receiptId}/xml
, no request body is required.
Example response:
Here are some important observations in the response:
receiptXML
contains a string with a specialized printing instructions of the receipt in XML format.
Query receipts
This API enables the possibility of making flexible queries. They can be done by providing different attributes of a
receipt as request parameters. They can be queried by the store number, or a date when they were created. More specific
queries can be built by using other attributes such as the type of transaction, or the cashier that created receipts in
a given date, there any many possibilities and combinations that could serve different purposes. To make these queries,
a GET request must be done providing different receipt attributes as request parameters, in this example, we are
querying receipts created in a specific store and a specific date as shown here
/receipts?store.storeId=1337&createDateTime=startsWith(2019-01-16)
, no request body is required.
Example response:
Here are some important observations in the response:
receipts
is the result of the query made, the receipts in the list match the criteria provided in the request parameters.