Configure printings
The printers of the Point Smart 1 and 2 terminals allow printing the purchase ticket and, additionally, integrate custom printings through the Terminals API. This function can be useful for those who require printing complementary receipts, such as coupons or even images.
This way, you can manage additional printings directly from your Point of Sale system, and obtain them from the terminal to which they are assigned.
Create printings
The printings generated from your system are actions that your point of sale sends to the terminal. Therefore, to create a printing, you must send a POST to the endpoint Create terminal actionAPI with your test Access TokenAccess test credentials, taking care to correctly send the mandatory parameters indicated below.
curl
curl -X POST \ 'https://api.mercadopago.com/terminals/v1/actions'\ -H 'Content-Type: application/json' \ -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \ -H 'Authorization: Bearer ACCESS_TOKEN \ -d '{ "type": "print", "external_reference": "ext_ref_1234", "config": { "point": { "terminal_id": "NEWLAND_N950__N950NCB123456789", "subtype": "image" } }, "content": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAB2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAPqSURBVHic7ZrZaxRBEIe/mJh4xRgDGk8ivqtvIvGESLwQ7wsU/yD/Ah+NURQjIioY8FbwRZ9UEFREvEFjEm83GR96Byab2Zlf9/RuFp0PlsxR1dVTXVXdPRPIycnJycnJ+V+pc9DpANYAU8vc/wXcBZ479qkcLcBmYGaZ+6PAI+C+Z7tj2Ar8AIKU3x9gl0e7HcBbwW4AHPNodxwPxE4EwEtgkie7xy3sjgLtnuyO46tFRwJgnQebU4CBStm1GaFGYLqFPMBBS/k4dgKzLHVkeRsHtFl2AmAf0OSgF+WIg05FHDDboSOtQLeDXshcoMtBryIOaHXoCGRLg8NAg4NeiypY6QgA2A40O+oedtSrKQdMA3Y46K0AljnarJkaEOKSBi7FL6SmagDARkxBU2kgW+2ouQhoAPZYyHeTbTVXcw4AOGQh61r8QmwXThJXsVuOxq3Rlwh2ZgLfM9r6pD5UtWoAmK23ktf7Kb/VVmnBbaufyDOyjUoAPBHs3PFgJ6D8ewNnPnvq2PIEGx2YVPFhZ7HyUGoKTMJidZVCUjE8ir/Q9VoI2/AzKgHwinjH1+EnzcLfWuXB1AjIOgVGWQSsjrneCSz1aEeKANUBWWeAUuJmgyxL3zhq2gF7gcmR86biNYUBUU6qWb5TYEiUawM2RM43oY3YK+C6aMNrBKivw/qAn6Ls7sjxAVGnFxgUZb1GgDqlvMEsmRV2APWY9wXbRJ1e9CiT0rYSKXBWlJ2D+cK0FZghyD8EHgPDYvvSoKnv21QHDAIXMV+PlPX8LmC+2HZP8a8aAV5rgOqAL5iPJ1dE+b3AFkGuAJwuHk9IDVAdEE5RZ0T5drRI6Qc+FI9rPgIALmMiwRc9kWM1AibUAd+BS6JOGkOYuhI9V5iFsLHyvRL8EjlW0yCNPoxDQ9QIqEebXVJpRt+BNUb0mjAOybqri64YARZa6C5KezglAtTR/wb8jpz/YmzouvAGuF1yTU0BEOqA4gDb/I+SNQ1OACMl14Yxb40UJtwB/ZhXaa6cirkW4HE1WGkH/AEuiPqlPMD801Mc3qbCSjsA9L1BKT0J97wthnw6oNyoXAM+im2EFEiuH1WNAJc1QJQC9mnQD7xPuO9tP1CNFAD72SAp/EFPAS8OUCMgaVRuAu/EdkqXvra2otREEQQzb58X2znH2KVvHFV1gPpFKMkBoKfBSUFGTYHUwVMcoIbu05T794AXKTLPgFsebIUkFVKZlaRvatKKVkgnZn0f18ZrYJXYTiPpX5EHi31PRP0QOQ9Yz/h/dwswo1G6YUmiAViA2a6GjGAcU7Bsp4v4r8DDwA08RUBOTk5OTk7Ov8lfFiKY13GwsdoAAAAASUVORK5CYII=" }'
| Attribute | Type | Description |
Authorization | Header | Refers to either your test Access TokenAccess test credentials. |
X-Idempotency-Key | Header | Idempotency key. This key ensures that each request is processed only once, avoiding duplicates. Use an exclusive value in your request header, such as a UUID V4 or random strings. |
type | Body. String | Action type. You must send the value print, which is associated with creating printing actions for the Point of Sale. |
external_reference | Body. String | It is an external reference of the order, assigned at the time of its creation. It must be a unique value for each order and cannot contain PII data. The maximum allowed limit is 64 characters and the allowed ones are: uppercase and lowercase letters, numbers and hyphen (-) and underscore (_) symbols. |
config.point.terminal_id | Body. String | Identifier of the Point terminal that will obtain the order. You must send it as it was returned in the call Get terminalsAPI, as in the following example: "NEWLAND_N950__N950NCB801293324". |
config.point.subtype | Body. String | Identifier of the print subtype that will be created for the Point terminal. If the action is print, you must choose one of the following values: - custom: for custom printing. - image: for image printing. |
content | Body. String | Contains the information to print on the Point terminal. Go to Requirements for printing content to know what validations to consider depending on the type of printing. |
Requirements for printing content
To implement the different types of printing desired, in addition to indicating which one it is in the config.point.subtype field, you must take into account the requirements, formats and validations that each of them requires when sending their content through the content parameter.
Custom printings use tags that allow adjusting the format and appearance of printed documents, ensuring greater control over the style and structure of the text.
When defining the subtype attribute as custom, you must include in the content field a string with the desired content, formatted using at least one of the supported tags. The content for this attribute is a minimum of 100 characters and a maximum of 4096, including the tags themselves.
Below, check the different available tags and their functions.
| Tags | Function | Example |
{b} | Bold | {b}Bold text{/b} |
{w} | Large letter | {w}Large letter text{/w} |
{s} | Small letter | {s}Small letter text{/s} |
{br} | Line break | {br} |
{left} | Align left | {left}Left aligned text{/left} |
{center} | Center text | {center}Centered text{/center} |
{qr} | Print a QR that represents the sent text | {qr}Text{/qr} |
{pdf417} | Print the TED stain | {pdf417}Text{/pdf417} |
Additionally, we provide you with a usage example.
json
{ "type": "print", "config": { "point": { "terminal_id": "{{device.id}}", "subtype": "custom" } }, "external_reference": "8a42e06e45d5", "content": "{br}--------------------------------{br}{center}{w} DELIVERY RECEIPT{/w}{br}{br}{s} Order number :12345{/s}{br}{s} Store: Test store{/s}{br}--------------------------------{br}{s}***DISPATCH ITEM(S)***{/s}{br}{s}SKU / ARTICLE QUANTITY {/s}{br}{s}----------------------------------------------{/s}{br}{s}4065432630504 / SOCCER BALL WUCL LGE EHV240424 1{br}{s}DELIVER: 06/06/2024{/s}{br}{s}ADDRESS: METROPOLITAN {/s}{br}{s}RECEIVES: John{/s}{br}{s}delivery to customer in am schedule{/s}{br}--------------------------------{br}" }
If the request is sent correctly, the response will return the id of the created action along with the status: created, and the printing will be automatically obtained by the terminal, in which case it will then have a status: on_terminal. If the latter does not happen, you can check our trobuleshooting documentation.
The Terminals API will also allow you to get an actionAPI, including its status in real time, by sending the reference id obtained in the response to its creation.
Finally, it is also possible to cancel an actionAPI using the reference id obtained in the response to its creation, as long as its status is created.
