Receipts and Events
Last updated: 2026-05-19
Receipt Data
The terminal sends receipt data as structured fields instead of a fixed text block. This lets an ECR print on different receipt widths, use custom formatting, support electronic receipts, and store transaction data for reporting.
The library can also generate a simple fixed-width receipt string.
Use the language tabs below to compare the receipt callback implementation across .NET, Java, and Swift.
.NET
csharppublic void PrintReceipt(ReceiptData receipt) { receiptRepository.Save(receipt); receiptPrinter.Print(receipt.GenerateSimpleReceipt(32)); }
Java
java@Override public void PrintReceipt(ReceiptData receipt) { receiptRepository.save(receipt); receiptPrinter.print(receipt.generateSimpleReceipt(32)); }
Swift
swiftfunc printReceipt(receipt: ReceiptData) { receiptRepository.save(receipt) receiptPrinter.print(receipt.generateSimpleReceipt(width: 32)) }
Receipt Contents
Important receipt areas include:
| Area | Examples |
|---|---|
| Transaction | Type, timestamp, reference, currency, net amount, cashback, VAT, tip, total. |
| Merchant | Merchant name, address, city, zip, phone, organisation number. |
| Authorisation | Verification method, authorisation channel, responder, response code, approval code. |
| Card | Masked card number, card name, entry method, payment code. |
| EMV | AID, TVR, TSI, compact or long EMV receipt text. |
| DCC | Provider, rate, converted amount, markup, card scheme, disclaimer. |
Receipt Timing
Most approved card transactions produce merchant and cardholder receipts. A cancelled transaction may produce only a cardholder receipt. If a terminal loses power during a partly completed transaction, PrintReceipt can be called after the next login, outside the context of the original active transaction.
In the Swift sample application, receipts are grouped by transaction and the merchant or cardholder copy can be selected from the history detail view.
DCC Handling
DCC lets a cardholder pay in their own currency when the terminal, card, transaction type, and card range allow it. DCC affects the ECR in two areas:
- DCC receipts must include the required disclaimer text.
- DCC refunds must indicate whether DCC was used in the original purchase.
Use the tabs below for the callback shape in each wrapper.
.NET
csharppublic bool CheckDccOnOriginalTransaction(string displayText, out bool dccWasUsed) { Display(displayText); dccWasUsed = cashierPrompts.Confirm("Was DCC used in the original transaction?"); return true; }
Java
java@Override public Pair<Boolean, Boolean> CheckDccOnOriginalTransaction(String displayText) { Display(displayText); boolean dccWasUsed = cashierPrompts.confirm("Was DCC used in the original transaction?"); return new Pair<>(true, dccWasUsed); }
Swift
swiftfunc checkDccOnOriginalTransaction(displayText: String) async -> BooleanCallbackResult? { display(text: displayText) let used = await cashierPrompts.confirm("Was DCC used in the original transaction?") return BooleanCallbackResult(handled: true, value: used) }
Identifying Cards
Do not rely on the receipt card name alone for issuer reporting. The card name can be product text supplied by the card. Use the masked card number IIN or the EMV AID when you need issuer or scheme classification.
Common AID or RID examples:
| RID | Scheme |
|---|---|
A000000003 | Visa |
A000000004 | Mastercard |
A000000025 | American Express |
A000000333 | UnionPay |
Terminal Events
Use terminal events to keep the ECR UI in sync.
| Event | Recommended handling |
|---|---|
| Link down | Mark terminal unavailable and schedule reconnect. |
| Busy true | Disable new transaction buttons and show terminal busy status. |
| Busy false | Re-enable actions if the terminal is logged in. |
| Card inserted | Update cashier UI and wait for the transaction flow. |
| Card accepted | Store masked card data only if needed for display or reporting. |
| Display text | Mirror the terminal or cashier message area in the ECR. |
| Raw XML | Store only in diagnostics or support tooling. |
Log Storage and XML Trace
The library receives trace data from the terminal and stores or exposes rotating trace information. In .NET, set epas.Options.StorageDirectory when you want logs in a known support folder.
csharpstring storage = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "EpasClientLibraryLogs"); Directory.CreateDirectory(storage); epas.Options.StorageDirectory = storage;
The Swift SDK exposes XML-level diagnostics through:
func log(level: LogLevel, text: String)func epasMessageReceived(message: String)
The sample ECR uses these hooks to show terminal display text, XML trace, and activity logs separately.