No momento, esta página não está disponível em português
Point-of-sale icon

Handle the Print Receipt callback

Requirements

Adyen provides certified receipts that are as short as possible while still meeting scheme requirements. For custom receipts, take care to include all data elements required by certification. Any issues that arise from not including these required data elements are at your own liability. 

Card schemes have very specific requirements on what should be included on a receipt. These requirements differ per scheme and country, and can change. Receipts generated by Adyen have been certified as compliant by the card schemes that we support.

Card schemes will occasionally visit live stores to verify that receipts being generated are fully-compliant.

To prevent non-compliance and avoidable chargebacks, we strongly recommend using the Adyen-generated receipts without alterations. If you override this receipt data, or validate values against a hard-coded list, it is your responsibility to ensure that scheme requirements are met at all times.

Implement the print receipt callback

Implement the tender_print_receipt_CB, assign to the function pointer status_tender_print_receipt and invoke this by passing the ReceiptHandler tender option.  For more information on how to do this, see Implement callbacks with register_device_request.

void tender_print_receipt_CB(receipts_strct * status_tender, ped_device_info * ped_state, void * echo_struct){
    app_context_t * sPOS = (app_context_t *)echo_struct;
    //TODO: store the receipts somewhere
    //ADYLibraryResult result =
    confirm_print_receipt(sPOS->terminal_id, sPOS->tender_reference, 1);
}

Invoke the print receipt callback

Specify ReceiptHandler as a tender option to invoke the print receipt callback and print on the POS. If the ReceiptHandler tender option is not specified and the PED does not have a printer, the transaction fails in violation with certification requirements.

Receipts might need to be printed multiple times. For example, when an approved receipt is printed to allow the shopper to sign. If the merchant does not approve the signature, after checking it with the signature on the back of the card, a cancel receipt needs to be printed. So, each invocation of the print receipt callback generates a new receipt. 

Handle the print receipt callback

The tender_print_receipt_CB is returned when a receipt on the PED needs to be printed. Receipt printing is a part of scheme certification. The receipt is passed to the POS when the PED does not include a printer, or where receipts must be archived or emailed. In this case, the POS must confirm that the receipt was received and printed. Create this function and assign to the function pointer status_tender_print_receipt.

Parameters

Field Description
receipts_strct Pointer to the receipts_strct  struct. The receipts_strct contains the actual receipts in receipt - C library structs. The receipt_line struct contains data elements for each line of the receipt.  For more details, see receipt_line. The MerchantReceipt also contains a key/value pair in the additional_data_struct struct.  The key is signatureOnReceipt and the value is true. This allows the shopper to sign the receipt.
ped_device_info Pointer to the ped_device_info struct in the POS. Called with the results of the create tender call.
echo_struct Pointer to a POS defined struct. Returned in the callback. Can be used to share a POS data struct between the call to the library and the associated callback from the library

Confirm Print Receipt Function

Respond to the print receipt callback using the confirm_print_receipt function

Name

Description

confirm_print_receipt

Response to the print receipt callback. Informs the Library that the app has completed printing. The transaction continues after the library receives confirmation. 

Parameters

Field Type Description
terminal_id char Terminal id of the PED.
tender_reference char Tender reference of the transaction.
confirmation ADYAttendantAction Confirmation (true/false).

Code example

confirm_print_receipt(char * terminal_id, char * tender_reference, boolean confirmation);