A print request allows you to initiate printing on the payment terminal from your POS app outside of a payment flow. You can print text or images.
Html to print.
Image in Base64 to print.
Print data in ESC command.
Unique identification of the partner that is the recipient of the message exchange.
For example, the POS SN
Result of the requested transaction.
Detail of the response.
Additional information to be logged for further examination.
PrintParam param = PrintParam.newBuilder()
.html(getPrintHtml())
.build();
RetailerManager.provideDeviceService()
.newPrintExchange(param)
.startAsyncExchange(new Exchange.RetailerSDKCallback<PrintResult>() {
@Override
public void onError(int code, String msg) {
Logger.e(TAG, "Print failed: " + code + ", " + msg);
}
@Override
public void onResult(PrintResult result) {
Logger.i(TAG, "Print result: " + GsonUtils.toJson(result));
}
});using System;
using PayExplorerConnect;
public void HandlePrintError(int code, string message)
{
Console.WriteLine($"Error: {code}, Message: {message}");
}
public void HandlePrintResult(PrintResult result)
{
Console.WriteLine($"Response: {result.Response}");
}
public string StartPrint()
{
// Replace the HTML with your receipt content.
PrintParam param = new PrintParam.Builder()
.Html("<html><body><h1>Print test</h1></body></html>")
.Build();
string exchangeId = RetailerManager
.ProvideDeviceService()
.NewPrintExchange(param)
.StartAsyncExchange(HandlePrintResult, HandlePrintError);
return exchangeId;
}#import <PayExplorerConnect/RetailerManager.h>
#import <PayExplorerConnect/PrintParam+Builder.h>
PrintParam *params = [PrintParam makeWithBuilder:^(PrintParamBuilder *builder) {
builder.format(OutputFormatCodeHTML);
builder.content(@"<html><body><h1>Print test</h1></body></html>");
}];
[[RetailerManager sharedManager] print:params block:^(NSString *exchangeId) {
// Save the exchange ID to track this request.
} result:^(id result, NSInteger errcode, NSString *msg) {
if (errcode != 0 && result == nil) {
// Handle request error.
return;
}
PrintResult *printResult = (PrintResult *)result;
// Handle print result.
}];