Customize Receipts
This guide shows how to replace the default Bitmap of the receipts the SDK prints automatically at the end of a transaction, without changing when printing happens or the transaction data shown.
How it works
The SDK issues two receipts per transaction, and you can customize each one independently — one, both, or none. A receipt you do not customize keeps the SDK default layout.
| Receipt | Audience | Default content |
|---|---|---|
Establishment (EstablishmentReceipt) | Kept by the merchant for reconciliation. | Includes extra operational data (ARQC, AID, cardholder name, terminal). |
Customer (CustomerReceipt) | Handed to the cardholder. | Only the essential proof data, without sensitive card data. |
Each provider receives a typed object populated with the transaction data and returns the Bitmap to print. The SDK prints it at the right moment.
ApoloSdk.Builder(context)
.customizeReceipts {
establishment(provider: EstablishmentReceiptBitmapProvider)
customer(provider: CustomerReceiptBitmapProvider)
}
.setAutoPrintEstablishmentReceipt(autoPrint: Boolean)
typealias EstablishmentReceiptBitmapProvider = (EstablishmentReceipt) -> Bitmap
typealias CustomerReceiptBitmapProvider = (CustomerReceipt) -> BitmapsetAutoPrintEstablishmentReceipt(true) (default) prints the establishment receipt automatically after an approved sale, and the success screen shows only the customer-receipt button. With false, nothing prints automatically and the success screen shows both buttons.
Customize one or both receipts
// only the customer receipt
ApoloSdk.Builder(applicationContext)
.customizeReceipts {
customer { receipt -> renderCustomerReceiptBitmap(receipt) }
}
.build()
// both receipts
ApoloSdk.Builder(applicationContext)
.customizeReceipts {
establishment { receipt -> renderEstablishmentReceiptBitmap(receipt) }
customer { receipt -> renderCustomerReceiptBitmap(receipt) }
}
.setAutoPrintEstablishmentReceipt(true) // default — may be omitted
.build()Receipt data
The SDK delivers these fields to the provider. Some are exclusive to the establishment receipt for privacy, as recommended by ABECS.
| Field | Establishment | Customer | Description |
|---|---|---|---|
merchantName, merchantDocument, merchantCity | ✅ | ✅ | Merchant identification. |
terminalCode | ✅ | ✅ | Terminal where the transaction occurred. |
cardBrand, cardNumber | ✅ | ✅ | Card brand and masked number. |
cardholderName | ✅ | — | Cardholder name — establishment only. |
paymentMethod | ✅ | ✅ | Presentable payment method. |
installments, installmentPlanLabel | ✅ | ✅ | Installment count and plan label (for example, "5X DE R$ 200,00"). |
installmentTypeLabel | ✅ | — | Credit installment type (for example, "Parcelado Lojista") — establishment only. |
amount | ✅ | ✅ | Formatted transaction amount. |
authorizationCode | ✅ | ✅ | Authorization code. |
arqc | ✅ | — | ARQC cryptogram — establishment only. |
aid | ✅ | ✅ | EMV application AID. |
dateTime | ✅ | ✅ | Transaction date and time. |
isReprint | ✅ | ✅ | true when the print is a reprint. |
paymentId | ✅ | ✅ | Transaction identifier (useful for later refunds). |
receiptType | ✅ | ✅ | DEBIT, CREDIT, PIX, VOUCHER, or REVERSAL. |
pinAuthApproved, requiresSignature | ✅ | — | Cardholder verification flags — establishment only. |
voucherCategory | ✅ | ✅ | Voucher category, when applicable. |
voucherCne | ✅ | — | Voucher network code — establishment only. |
voucherBalance | — | ✅ | Remaining voucher balance — customer only. |
originalAuthorizationCode, originalTerminal | ✅ | ✅ | Data of the original transaction, on refund receipts. |
You can branch on receiptType to render a specific layout per payment method.
For Pix, card fields (
cardBrand,cardNumber,cardholderName,arqc,aid,authorizationCode) come as empty strings, since there is no physical card. UsepaymentIdas the main identifier and handle the empty fields to avoid rendering errors.
Best practices
- Customize only the receipts that need to differ from the default.
- Do not put establishment-only sensitive data (
cardholderName,arqc) on the customer receipt. - Return a
Bitmapsized for the terminal printer — the resolution and contrast notes from Print a receipt apply here too.
Next steps
- Customization model — compare theme, slots, overrides, and receipts.