- In a Pay at Table flow, print the bill on the terminal before sending a payment request. This lets the customers decide if they want to split the bill, and how they want to pay.
- Print entry tickets at a festival.
- In a quick-service restaurant, print a receipt that allows customers to pick up their order at the counter.
- Print a QR code with a URL to join your loyalty program or to download an app.
Requirements
Before you begin, take into account the following requirement.| Requirement | Description |
|---|---|
| Integration type | A Terminal API integration with payment terminals. |
| Hardware | Only works on payment terminals with a built-in printer, such as the V240m Plus (in Brazil), V400c Plus, V400m, S1F2, S1F2L, and S1F4Pro. |
| Limitations | It is not possible to print barcode formats such as EAN-8, EAN-13, UPC-A, Code 25, Code 128 or PDF417. |
Print text
To use the payment terminal to print text content:-
Make a Terminal API print request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Device andMessageCategoryset to Print.Parameter Required Description ProtocolVersion
3.0 MessageClass
Device MessageCategory
Print MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
The PrintRequest.PrintOutput object, including:EachParameter Required Description DocumentQualifier
Document ResponseMode
PrintEnd OutputContent.OutputFormat
Text OutputContent.OutputText
An array with one or more array items containing the text you want to print. OutputTextarray item can have:Parameter Required Description CharacterStyleAllowed values: Normal, Bold, Underline. If not specified, defaults to Normal. AlignmentAllowed values: Left, Centred, Justified, Right. If not specified, defaults to Left. EndOfLineFlagIf not specified, defaults to true. Use false if you want the next array item to continue on the same line. Text
The text you want to print in this array element. For a blank line, specify an empty value.
-
The standard
- Receipt example
- Document example
{
"SaleToPOIRequest": {
"MessageHeader": {
"ProtocolVersion": "3.0",
"MessageClass": "Device",
"MessageCategory":"Print",
"MessageType": "Request",
"ServiceID": "050824",
"SaleID": "POSSystemID12345",
"POIID": "V400m-346403161"
},
"PrintRequest": {
"PrintOutput": {
"DocumentQualifier": "Document",
"ResponseMode": "PrintEnd",
"OutputContent": {
"OutputFormat": "Text",
"OutputText": [
{
"CharacterStyle": "Bold",
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": "THIS IS THE TITLE"
},
{
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": ""
},
{
"Alignment": "Left",
"EndOfLineFlag": false,
"Text": "This is key-1"
},
{
"Alignment": "Right",
"EndOfLineFlag": true,
"Text": "value-1"
},
{
"Alignment": "Left",
"EndOfLineFlag": false,
"Text": "This is key-2"
},
{
"Alignment": "Right",
"EndOfLineFlag": true,
"Text": "value-2"
},
{
"Alignment": "Left",
"EndOfLineFlag": false,
"Text": "This is key-3"
},
{
"Alignment": "Right",
"EndOfLineFlag": true,
"Text": "value-3"
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "Some explanation about the receipt (# %^& @/: $ £ EUR )"
},
{
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": ""
},
{
"CharacterStyle": "Bold",
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": "This is the footer"
}
]
}
}
}
}
}
{
"SaleToPOIRequest": {
"MessageHeader": {
"ProtocolVersion": "3.0",
"MessageClass": "Device",
"MessageCategory":"Print",
"MessageType": "Request",
"ServiceID": "050823",
"SaleID": "POSSystemID12345",
"POIID": "V400m-346403161"
},
"PrintRequest": {
"PrintOutput": {
"DocumentQualifier": "Document",
"ResponseMode": "PrintEnd",
"OutputContent": {
"OutputFormat": "Text",
"OutputText": [
{
"CharacterStyle": "Bold",
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": "THIS IS THE TITLE"
},
{
"CharacterStyle": "Normal",
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": "This is the subtitle"
},
{
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": ""
},
{
"CharacterStyle": "Underline",
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "This is a heading"
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "Normal left-aligned text belonging to the header above."
},
{
"CharacterStyle": "Underline",
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "Another heading"
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "Normal left-aligned text belonging to the header above."
},
{
"Alignment": "Left",
"EndOfLineFlag": false,
"Text": "This is the key"
},
{
"Alignment": "Right",
"EndOfLineFlag": true,
"Text": "value"
},
{
"Alignment": "Left",
"EndOfLineFlag": false,
"Text": "This is the key"
},
{
"Alignment": "Right",
"EndOfLineFlag": true,
"Text": "value"
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": ""
},
{
"Alignment": "Justified",
"EndOfLineFlag": true,
"Text": "Normal justified text flush with the left and right margins."
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "For comparison, here you have some normal left-aligned text."
},
{
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": ""
},
{
"CharacterStyle": "Bold",
"Alignment": "Left",
"EndOfLineFlag": true,
"Text": "This is bold left-aligned text."
},
{
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": ""
},
{
"CharacterStyle": "Bold",
"Alignment": "Centred",
"EndOfLineFlag": true,
"Text": "This is the footer"
}
]
}
}
}
}
}
-
Check the PrintResponse. This should include:
DocumentQualifier: DocumentResponse.Result: Success
{ "SaleToPOIResponse": { "PrintResponse": { "DocumentQualifier": "Document", "Response": { "Result": "Success" } }, "MessageHeader": { "MessageCategory": "Print", "MessageClass": "Device", "MessageType": "Response", "POIID": "V400m-346403161", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "050823" } } }
Print a QR code
To use the payment terminal to print a QR code that the shopper can scan with their mobile device:-
If the QR code needs to contain more than just a URL, convert the content to a URL-encoded string. You’ll need to specify the URL-encoded string in the print request.
For example, if the QR code should have this content:
The resulting URL-encoded string will look like this:
Visit www.adyen.com/pos-payments and: - Learn about the features we support - Choose from a range of terminalsIf the QR code needs to contain only a URL, for exampleVisit%20www.adyen.com%2Fpos-payments%20and%3A%0A-%20Learn%20about%20the%20features%20we%20support%0A-%20Choose%20from%20a%20range%20of%20terminalshttps://www.adyen.com/pos-payments, there is no need to URL-encode that. You’ll specify the URL in the print request as a plain text string. -
Make a Terminal API print request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Device andMessageCategoryset to Print.Parameter Required Description ProtocolVersion
3.0 MessageClass
Device MessageCategory
Print MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
The PrintRequest.PrintOutput object, including:Parameter Required Description DocumentQualifier
CustomerReceipt ResponseMode
PrintEnd OutputContent.OutputFormat
BarCode OutputContent.OutputBarcode.BarcodeType
QRCode OutputContent.OutputBarcode.BarcodeValue
The content of the QR code: a URL specified as a plain text string or a URL encoded string.
JSON
{ "SaleToPOIRequest": { "MessageHeader": { "ProtocolVersion": "3.0", "MessageClass": "Device", "MessageCategory": "Print", "MessageType": "Request", "ServiceID": "050817", "SaleID": "POSSystemID12345", "POIID": "V400m-346403161" }, "PrintRequest": { "PrintOutput": { "DocumentQualifier": "CustomerReceipt", "ResponseMode": "PrintEnd", "OutputContent": { "OutputFormat":"BarCode", "OutputBarcode": { "BarcodeType": "QRCode", "BarcodeValue": "https://www.adyen.com/pos-payments" } } } } } }Java
String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String saleID = "YOUR_CASH_REGISTER_ID"; String POIID = "YOUR_TERMINAL_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); PrintRequest printRequest = new PrintRequest(); PrintOutput printOutput = new PrintOutput(); printOutput.setDocumentQualifier( DocumentQualifierType.CUSTOMERRRECEIPT ); printOutput.setResponseMode( ResponseModeType.PRINTEND ); OutputContent outputContent = new OutputContent(); outputContent.setOutputFormat( OutputFormatType.BARCODE ); OutputBarcode outputBarcode = new OutputBarcode(); outputBarcode.setBarcodeType( BarcodeTypeType.QRCODE ); outputBarcode.setBarcodeValue( "https://www.adyen.com/pos-payments" ) outputContent.setOutputBarcode(outputBarcode); printOutput.setOutputContent(outputContent); printRequest.setPrintOutput(printOutput); saleToPOIRequest.setPrintRequest(printRequest); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.DEVICE ); messageHeader.setMessageCategory( MessageCategoryType.PRINT ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setServiceID(serviceID); messageHeader.setSaleID(saleID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); -
The standard
-
Check the PrintResponse. This should include:
DocumentQualifier: CustomerReceiptResponse.Result: Success
{ "SaleToPOIResponse": { "PrintResponse": { "DocumentQualifier": "CustomerReceipt", "Response": { "Result": "Success" } }, "MessageHeader": { "MessageCategory": "Print", "MessageClass": "Device", "MessageType": "Response", "POIID": "V400m-34640316", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "050817" } } }
Print an image
To use the payment terminal to print a PNG image:- Convert the PNG image to a Base64-encoded string. The size limit of the image is 256000 bytes. Therefore, we recommend using 1-bit grayscale images with a maximum width of 384 pixels.
-
In the XML code sample below, replace
<IMAGE_DATA>with the Base64-encoded string. XML code sampleYou must include a space between<?xml version="1.0" encoding="UTF-8"?> <img src="data:image/png;base64, <IMAGE_DATA>"/><img src="data:image/png;base64,and the Base64-encoded<IMAGE_DATA>. - Convert the whole XML code sample, including the already Base64-encoded image, to a Base64-encoded string.
-
Make a Terminal API print request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Device andMessageCategoryset to Print.Parameter Required Description ProtocolVersion
3.0 MessageClass
Device MessageCategory
Print MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
The PrintRequest.PrintOutput object, including:Parameter Required Description DocumentQualifier
Document ResponseMode
PrintEnd OutputContent.OutputFormat
XHTML OutputContent.OutputXHTML
The Base64-encoded XML code sample with the image data.
{ "SaleToPOIRequest": { "MessageHeader": { "ProtocolVersion": "3.0", "MessageClass": "Device", "MessageCategory": "Print", "MessageType": "Request", "ServiceID": "050831", "SaleID": "POSSystemID12345", "POIID": "V400m-34640316" }, "PrintRequest": { "PrintOutput": { "DocumentQualifier": "Document", "ResponseMode": "PrintEnd", "OutputContent": { "OutputFormat": "XHTML", "OutputXHTML": "PD94bWwgdmVyc2...NUNZSUk9Ii8+" } } } } } -
The standard
-
Check the PrintResponse. This should include:
DocumentQualifier: DocumentResponse.Result: Success
{ "SaleToPOIResponse": { "PrintResponse":{ "DocumentQualifier": "Document", "Response": { "Result": "Success" } }, "MessageHeader": { "MessageCategory": "Print", "MessageClass": "Device", "MessageType": "Response", "POIID": "V400m-34640316", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "050831" } } }
Handle print errors
If the print request fails because of a problem with the printer, you receive aPrintResponse containing the following:-
DocumentQualifier: Document or CustomerReceipt -
Response.Result: Failure -
ErrorCondition: DeviceOut -
AdditionalResponse: A description of the problem, for example:- Printer is Temporary Out of Service: paper low.
- Printer is Temporary Out of Service: no more paper.
- Printer is Temporary Out of Service: paper jam.
- Printer is Permanently Out of Service: out of order.
- Printer is Permanently Out of Service: unknown.
- Printer is Permanently Out of Service: absent.
- The device has no printer.
{
"SaleToPOIResponse": {
"MessageHeader": {
"MessageCategory": "Print",
"MessageClass": "Device",
"MessageType": "Response",
"POIID": "V400m-347440332",
"ProtocolVersion": "3.0",
"SaleID": "POSSystemID12345",
"ServiceID": "0508178"
},
"PrintResponse": {
"DocumentQualifier": "CustomerReceipt",
"Response": {
"AdditionalResponse": "message=Printer%20is%20Temporary%20Out%20of%20Service%3a%20no%20more%20paper&warnings=At%20SaleToPOIRequest.PrintRequest.PrintOutput.OutputContent.OutputBarcode%2c%20field%20%27BarcodeType%27%3a%20Unexpected",
"ErrorCondition": "DeviceOut",
"Result": "Failure"
}
}
}
}