--- sidebar_position: 3 --- # Receipt service The receipt service provides an implementation for printing receipts. You can register separate implementations for different receipt types. ## Registration ```javascript export default async context => { context.service.addService({ type: 'receiptService', receiptType: 'full-receipt', printReceipt: async req => { // req contains: orderId, uiCultureCode // ... send the receipt to a printer return { status: 'Success' }; }, }); }; ``` ## Receipt types You can register a service for each receipt type independently: | Receipt type | Description | | --- | --- | | `full-receipt` | A full detailed receipt | | `compact-receipt` | A compact order confirmation receipt | To support both types, register two separate services: ```javascript export default async context => { context.service.addService({ type: 'receiptService', receiptType: 'full-receipt', printReceipt: async req => { // print full receipt return { status: 'Success' }; }, }); context.service.addService({ type: 'receiptService', receiptType: 'compact-receipt', printReceipt: async req => { // print compact receipt return { status: 'Success' }; }, }); }; ``` ## Request parameters The `printReceipt` method receives an object with the following properties: | Property | Type | Description | | --- | --- | --- | | `orderId` | `string` | The order to print a receipt for | | `uiCultureCode` | `string` | Culture code for localization | ## Responses ### Success ```javascript return { status: 'Success' }; ``` ### Error ```javascript return { status: 'Error', error: { code: 'printer.offline', message: 'The printer is not responding', }, }; ```