Printing
Like the rest of the axept® PRO solution, the Printing & Scanning API is a RESTful endpoint residing on the target terminal.
/print API
https://(TerminalIP):8080/POSitiveWebLink/1.1.0/rest/print
An HTTPS POST
request should be sent to the above URL with the following parameters:
POST /print - Query String Parameters | |||
---|---|---|---|
Field Name | State | Data Type | Description |
tid | Mandatory | String | This is the Serial Number of the terminal that should print the request. This is printed on a label on the rear of the device. |
POST /transaction - Header Parameters | |||
Authorization | Mandatory | String | This field should be populated with a value of Bearer 6945595921271780 |
POST
/print Body
POST /print Object | |||||||
---|---|---|---|---|---|---|---|
Field Name | State | Data Type | Description | ||||
printFormat | Mandatory | Enum | Indicates what kind of printing you wish to complete. The following values are allowed:
| ||||
printContent | Conditional | Array | Mandatory for lines ONLY. An Array of Objects, one for each line required. | ||||
receipt | Conditional | String | Mandatory for bitmap ONLY. Base64 Encoded bitmap to be printed. |
Images/Bitmaps must be no wider that 384 pixels.
Each object in the printContent
Array can contain EITHER the text
or img
Objects, as described below.
If printFormat
is bitmap
however, you will only need the receipt
field above.
See our Examples below for more information.
printContent
Array - text
Object
text Object | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Field Name | State | Data Type | Description | ||||||||||||
text | Mandatory | String | The text you wish to print in its unformatted state. Mandatory where text is used. This field supports the JavaScript escape sequence command \n for a New Line, allowing you to split or wrap text manually. You can also use this to add multiple line spaces. Please see the examples below for more details. | ||||||||||||
attributes | Mandatory | Integer | A numeric value that tells axept® PRO how to format the provided text. Any valid additive combination of the following values can be accepted.
Example: Bold(1), Medium(4), Right-Aligned(16) text would require attributes=21 because 1+4+16 = 21. Mandatory where text is used. |
printContent
Array - img
Object
The img
object is a single field and value pair as detailed below.
text Object | |||
---|---|---|---|
Field Name | State | Data Type | Description |
img | Mandatory | String | Base64 encoded bitmap of the image you wish to print. |
Images/Bitmaps must be no wider that 384 pixels.
/print Examples
Examples containing Base64 encoded images are very large. It is recommended that you copy them from below and view them in a different program.
- Bitmap
- Text - Simple
- Text - Formats
- Text - Newline
- Text & Images
- Images as Lines
{
"printFormat": "bitmap",
"receipt": "Qk0+DwAAAAAAAD4AAAAoAAAAgAEAAFAAAAABAAEAAAAAAAAPAAB0EgAAdBIAAAAAAAAAAAAAAAAAAP///wD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7////////wP/////////////////////////////////////////////////////7///////8AB/////////////////////////////////////////////////////7///////AAAH////////////////////////////////////////////////////7//////+AAAB///////////////////5///////+f///////////////////////7//////4AAAA///////////////////4///////+P///////////////////////7//////8AAAAP//////////////////4///////+P///////////////////////7//////OAAAAH//////////////////4////////P///////////////////////7/////8DB/8AD//////////////////4////////H///////////////////////7/////8Dn//gB//////////////////4////////H///////////////////////7/////4B///4A//////////////////4////////j///////////////////////7/////4B///8Af/////////////////4////////j///////////////////////7/////8D/D//AP/////////////////4////////z///////////////////////7/////sD/B//AP//////4eB4H+B/weB4+D//4Pj/x/5/+P/z/4H/j/8f8P8H////7/////H/+B8HwH//////gGB4H+B/AGB44A//gDj/x/4/+P/j/gB/j/8fwPwB////7/////D/+B4DwH/////+AAB4H+B+ACB4gAf+AAj/w/4/+P/j+AA/j/8fgPgA////7////+B/8DwB4D/////8AAB4H+B8AAB4D8P8H4j/g/4/+P/j8H4fj/8fD/H4f///7////+A/4PgB8D/////4AAB4H+B4AAB4P/H4f8D/g/4/+P/j8f+Pj/8fH+P8f///7////+B/w/gA8B/////4AAB4H+BwAAB4f/j4/+D/Ef4/+P/j4/+Hj/8fH+P8f///7////8B/h/gA8B/////4D4B4H+BwDwB4//jx//D/Ef4/+P/jx//Hj/8fH8f8f///7////8B+D/gA+B/////wH8B4H+BwP8B4//xx//j/OP4/+P/jx//Hj/8fP+f8f///7////8DwH/AB+B/////wP+B4H+BgP8B4//xx//j+OP4/+P/jx//nj/8fP//4f///7////8DgP/AD/A/////wP+B4H+BgP8B4//xx//j+PP4/+P/jz///j/8fP//A////7////4HgP+AH/A/////wP+B4H+BgP+B4//xj//j8fH4/+P/jwAAHj/8fP/4B////7////4HgP8AP/A/////wP+B4H+BgP+B4//xj//j8fH4/+P/jwAAHj/8fP/gP////7////4Hgf4D//A/////wP+B4H+BgP8B4//xx//j4/D4/+P/jz//nj/8fP/B/////7////4Hgf4H//A/////wP+B4H+BgP8B4//xx//j4/j4/+P/jx//Hj/8fP+P/////7////4Hw/wf8fA/////wH8B4D+BwP8B4//hx//D4/j4/+P/jx//Hj/8fP+f8f///7////4H//g/4PA/////4D4B4D8BwDwB4f/j4//Dx/x4/+H/j4//Hj/4/P+f8f///7////4H//B/wPA/////4AAB4AABwAAB4P/H4/+Dx/x4f8H/j4/+Ph/4/P+f8f///7////4D/8D/wPA/////8AAB4AAD4AAB4H+H8P8Dj/w4P8T/H8P8fg/x/P+P4////7////8D/4H/gfA/////8AAB4AAH8AAB4B4P8Dgjj/45Dww8H+DwfgPB4APHg////7////8D/gP/h+B/////+AAB4EAH+ACB4wAf/ABjH/4YgB4AP/AB/iAD4APAB////7////8B+Af+H+B//////gGB4GAf/AGB48B//wHjH/8YwD+A//wD/jgP4APwH////7////8B8A/8P8B//////4eB4Hh//weB////////////+f/n//////4//P///////7////8B8A/4f8B///////+B/////////////////////////////////P///////7////+A8B/A/8D///////+B/////////////////////////////////P///////7////+A8B+A/+D///////+B/////////////////////////////////P///////7/////AeD8B//H///////+B/////////////////////////////////P///////7/////APH8B//n///////+B/////////////////////////////////////////7/////gH/8B/h////////+B/////////////////////////////////////////7/////wD/8D/B///////////////////////////////////////////////////7/////4B/+H/A///////////////////////////////////////////////////7/////4A////A///////////////////////////////////////////////////7/////8AH//nB///////////////////////////////////////////////////7/////+AB/8Dz///////////////////////////////////////////////////7//////AAAAB////////////////////////////////////////////////////7//////gAAAA////////////////////////////////////////////////////7//////4AAAA////////////////////////////////////////////////////7//////+AAAD////////////////////////////////////////////////////7///////AAAH////////////////////////////////////////////////////7///////8AB/////////////////////////////////////////////////////7////////gP/////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8="
}
{
"printFormat": "lines",
"printContent": [
{
"text": "some text",
"attributes": 0
}
]
}
{
"printFormat": "lines",
"printContent": [
{
"text": "Normal text",
"attributes": 0
},
{
"text": "Bold text",
"attributes": 1
},
{
"text": "Centered",
"attributes": 32
},
{
"text": "Centered BOLD",
"attributes": 37
},
{
"text": "Right aligned",
"attributes": 16
},
{
"text": "Right aligned Bold",
"attributes": 17
},
{
"text": "Size MEDIUM",
"attributes": 4
},
{
"text": "Size MEDIUM + Bold",
"attributes": 5
},
{
"text": "Size LARGE",
"attributes": 8
},
{
"text": "Size LARGE + BOLD",
"attributes": 9
}
]
}
{
"printFormat": "lines",
"printContent": [
{
"text": "middle\nnewline",
"attributes": 0
},
{
"text": "\nstart newline",
"attributes": 0
},
{
"text": "end newline\n",
"attributes": 0
},
{
"text": "no newline",
"attributes": 0
},
{
"text": "\n\n",
"attributes": 0
},
{
"text": "centred\nnewline",
"attributes": 32
},
{
"text": "right\nnewline",
"attributes": 16
}
]
}
{
"printFormat": "lines",
"printContent": [
{
"text": "some text",
"attributes": 0
},
{
"img": "iVBORw0KGgoAAAANSUhEUgAAAYAAAABQAQAAAAA49Z+JAAADNklEQVR4XuXWTY7UMB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e7taZAAAAAElFTkSuQmCC"
},
{
"text": "another line",
"attributes": 0
}
]
}
{
"printFormat": "lines",
"printContent": [
{
"img": "iVBORw0KGgoAAAANSUhEUgAAAYAAAABQAQAAAAA49Z+JAAADNklEQVR4XuXWTY7UMBAF4IoijXeE5azGF0H4YoiYm5mbmBsEzSZIVsx7ZbvTCdNJt4ANWOrppDqfx7/lSH6wyD5wVv4VMI376EEhiHYfPSgEYdhHD8q/AV6zfwx8A1jcPn6zSPYAs93HbxaAMQzTplHxqImSxYUhmuvY9m5XZBEbhtBfx87AEAa/AdMJMMH67jp2DLL0wckDTQLIy0PAE2we2Q5BK6/lS3LAw6IjLxZ7CbeeFyYvJhndXN565524uctJRBvgEcYNfh+8yQLgJadu6jJu8f8BXsQCzACcZe8AJvQkvsMfgEVkTF2QUVhrL84/i5klzx0+qD2MABE/RpEOD9vETyfyATXO0gG8lx5gAkioPbILAbUCCMEkMgDJM2K4BkBNCdddyUs6Ar6CzwUYAtmB2F8lMsYJHAC++wpKDEB2AC3RBwlcuAKhgQXYyCWLEQwENgib11VgC+giQTBSFipGPqHqgVGLmfFDBEC9uPX9hCsOKnAFWOMA2Hqxw6wDoNvsY8Ct9YYUg0YwiK67AjDpsWflBHPpI9fFgLZ4TI1eo625rIr5V5AryA0MG9ARmKw7XFxagVWwKLBb0B8D9GALpgImgqUCbPgVGE4SO30LTBswRgId1nvBUwMcVo7SFrCGDcAyHCVwOzdQRklBugXmUZdGvhPogVLKOnEEnLgGykwDcEevIHHYCugJuhVwLb0FRq5RrjtVCthCLtQG8HNOY9miSV64vD9xfzrfhwsIEipICiZbksBlxwFw0/Qr4AYqAI3V80bTTANu3gKNKWAOLqlSExnjDURmjTeAYTI2ukPXNIO+lbxUQUkzV4DZm8k4MNHiR3Qfs8DMp4DXFWQF0v8o6V5T5RP+LJoqXQNJU2UBA4+sPn5UMKNLWMClhZqMC0B1DXC36hlXN8UAwPeIYDPyRQOo1zdg9RT19VDEbERT3+dmDIPL33P+iuDo3Rd+VWAB2iEV2bbbhW3l0l0P9jPgCLjm2nPHYFHAt5nLy8kZwMiiV3j9cTV0D+AbGZe4lmOQFGRORytnID8G5r8O8GZQgL2E7gPBXUInoC+AKaCWYxAruA79WRDM74Pz8l+Cn0MCLkNe7taZAAAAAElFTkSuQmCC"
},
{
"img": "Qk0+DwAAAAAAAD4AAAAoAAAAgAEAAFAAAAABAAEAAAAAAAAPAAB0EgAAdBIAAAAAAAAAAAAAAAAAAP///wD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7////////wP/////////////////////////////////////////////////////7///////8AB/////////////////////////////////////////////////////7///////AAAH////////////////////////////////////////////////////7//////+AAAB///////////////////5///////+f///////////////////////7//////4AAAA///////////////////4///////+P///////////////////////7//////8AAAAP//////////////////4///////+P///////////////////////7//////OAAAAH//////////////////4////////P///////////////////////7/////8DB/8AD//////////////////4////////H///////////////////////7/////8Dn//gB//////////////////4////////H///////////////////////7/////4B///4A//////////////////4////////j///////////////////////7/////4B///8Af/////////////////4////////j///////////////////////7/////8D/D//AP/////////////////4////////z///////////////////////7/////sD/B//AP//////4eB4H+B/weB4+D//4Pj/x/5/+P/z/4H/j/8f8P8H////7/////H/+B8HwH//////gGB4H+B/AGB44A//gDj/x/4/+P/j/gB/j/8fwPwB////7/////D/+B4DwH/////+AAB4H+B+ACB4gAf+AAj/w/4/+P/j+AA/j/8fgPgA////7////+B/8DwB4D/////8AAB4H+B8AAB4D8P8H4j/g/4/+P/j8H4fj/8fD/H4f///7////+A/4PgB8D/////4AAB4H+B4AAB4P/H4f8D/g/4/+P/j8f+Pj/8fH+P8f///7////+B/w/gA8B/////4AAB4H+BwAAB4f/j4/+D/Ef4/+P/j4/+Hj/8fH+P8f///7////8B/h/gA8B/////4D4B4H+BwDwB4//jx//D/Ef4/+P/jx//Hj/8fH8f8f///7////8B+D/gA+B/////wH8B4H+BwP8B4//xx//j/OP4/+P/jx//Hj/8fP+f8f///7////8DwH/AB+B/////wP+B4H+BgP8B4//xx//j+OP4/+P/jx//nj/8fP//4f///7////8DgP/AD/A/////wP+B4H+BgP8B4//xx//j+PP4/+P/jz///j/8fP//A////7////4HgP+AH/A/////wP+B4H+BgP+B4//xj//j8fH4/+P/jwAAHj/8fP/4B////7////4HgP8AP/A/////wP+B4H+BgP+B4//xj//j8fH4/+P/jwAAHj/8fP/gP////7////4Hgf4D//A/////wP+B4H+BgP8B4//xx//j4/D4/+P/jz//nj/8fP/B/////7////4Hgf4H//A/////wP+B4H+BgP8B4//xx//j4/j4/+P/jx//Hj/8fP+P/////7////4Hw/wf8fA/////wH8B4D+BwP8B4//hx//D4/j4/+P/jx//Hj/8fP+f8f///7////4H//g/4PA/////4D4B4D8BwDwB4f/j4//Dx/x4/+H/j4//Hj/4/P+f8f///7////4H//B/wPA/////4AAB4AABwAAB4P/H4/+Dx/x4f8H/j4/+Ph/4/P+f8f///7////4D/8D/wPA/////8AAB4AAD4AAB4H+H8P8Dj/w4P8T/H8P8fg/x/P+P4////7////8D/4H/gfA/////8AAB4AAH8AAB4B4P8Dgjj/45Dww8H+DwfgPB4APHg////7////8D/gP/h+B/////+AAB4EAH+ACB4wAf/ABjH/4YgB4AP/AB/iAD4APAB////7////8B+Af+H+B//////gGB4GAf/AGB48B//wHjH/8YwD+A//wD/jgP4APwH////7////8B8A/8P8B//////4eB4Hh//weB////////////+f/n//////4//P///////7////8B8A/4f8B///////+B/////////////////////////////////P///////7////+A8B/A/8D///////+B/////////////////////////////////P///////7////+A8B+A/+D///////+B/////////////////////////////////P///////7/////AeD8B//H///////+B/////////////////////////////////P///////7/////APH8B//n///////+B/////////////////////////////////////////7/////gH/8B/h////////+B/////////////////////////////////////////7/////wD/8D/B///////////////////////////////////////////////////7/////4B/+H/A///////////////////////////////////////////////////7/////4A////A///////////////////////////////////////////////////7/////8AH//nB///////////////////////////////////////////////////7/////+AB/8Dz///////////////////////////////////////////////////7//////AAAAB////////////////////////////////////////////////////7//////gAAAA////////////////////////////////////////////////////7//////4AAAA////////////////////////////////////////////////////7//////+AAAD////////////////////////////////////////////////////7///////AAAH////////////////////////////////////////////////////7///////8AB/////////////////////////////////////////////////////7////////gP/////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8="
}
]
}
/reprint API
In addition to giving you control over the printer for bespoke printing, you can also use the Printing & Scanning API to reprint cardholder receipts for previous transactions, even if printing was disabled originally.
https://(TerminalIP):8080/POSitiveWebLink/1.1.0/rest/reprint
An HTTPS POST
request should be sent to the above URL with the following parameters:
POST /reprint - Query String Parameters | |||
---|---|---|---|
Field Name | State | Data Type | Description |
tid | Mandatory | String | This is the Serial Number of the terminal that should print the request. This is printed on a label on the rear of the device. |
POST /transaction - Header Parameters | |||
Authorization | Mandatory | String | This field should be populated with a value of Bearer 6945595921271780 |
POST /transaction - Body Parameters | |||
reprintRequest | Mandatory | Body | Provides the required information to print your image or text. |
POST
/reprint Body
POST /print Object | |||||||
---|---|---|---|---|---|---|---|
Field Name | State | Data Type | Description | ||||
uti | Mandatory | String | The unique transaction identifier for the original transaction. This is returned in the Payment Response in the axept® PRO /transaction API. | ||||
copy | Mandatory | Enum | Indicates which receipt you want to print. The following values are allowed:
|
/reprint Examples
- Merchant
- Cardholder
{
"uti": "0445B143-C8B5-4A02-A258-667049065CF2",
"copy": "MERCHANT"
}
{
"uti": "0445B143-C8B5-4A02-A258-667049065CF2",
"copy": "CARDHOLDER"
}
Printing Error Codes
A successful /print
or /reprint
request will result in a 200 OK
HTTP Response code with the following fields:
{
"additionalInfo": "Success",
"resultCode": 0,
"resultError": "",
"resultType": "OK"
}
In some cases, unsuccessful attempts will result in a 4xx
HTTP Response code, with the below responses.
Error Responses | ||
---|---|---|
HTTP Response Code | JSON Response data | Resolution |
400 - Bad input parameter or invalid JSON | "additionalInfo": "Image format invalid or unsupported", "resultCode": -3, "resultError": "Bad input parameter or invalid JSON", "resultType": "Error" | Ensure the image data is a properly encoded Base64 bitmap, and retry. |
400 - Bad input parameter or invalid JSON | "additionalInfo": "Device doesn't have a printer", "resultCode": -2, "resultError": "Bad input parameter or invalid JSON", "resultType": "Error" | Ensure the image data is a properly encoded Base64 bitmap, and retry. |
400 - Bad input parameter or invalid JSON | N/A | Correct the JSON data being supplied. |
400 - UTI not found | N/A | Correct the uti being supplied in the reprint request. |
408 - Request Timeout | N/A | Check the receipt size. Long images can exceed the amount of data available in the request. |
413 - Content Too Large | "additionalInfo": "Image too wide", "resultCode": -4, "resultError": "Content Too Large", "resultType": "Error" | Resize the base64 encoded image to be max. 384 pixels |
This is NOT an exhaustive list of errors. You will receive other regular HTTP Response Codes in addition to those detailed above.