Custom Receipts
If you require more flexibility than the ready-made receipts provide, you can also send or print custom receipts, including payment-related data.
Make sure that your custom receipt contains all of the required receipt information and that you are able to also send receipts for successful refunds.
Required Receipt Information
A sample receipt with the required information and its placement is shown below. Actual receipt content can vary, depending on acquirer and payment method.
  1. Full address of the merchant, including the country. Iterate over
    merchantDetails
    , for each line item print
    value
    .
  2. receiptType.value
  3. transactionType.value
  4. amountAndCurrency.value
  5. The payment details, e.g. the masked account number. Iterate over
    paymentDetails
    , for each line item print the
    label
    and
    value
    .
  6. statusText.value
  7. date.value
    and
    time.value
  8. The clearing details, e.g. the merchant identifier. Iterate over
    clearingDetails
    , for each line item print the
    label
    and
    value
    .
  9. If
    printTipLine
    is
    true
    , then you must print Tip and Total Amount lines on your receipts.
  10. If
    printSignatureLine
    is
    true
    , then you must print a signature line on your merchant receipt.
Accessing Receipt Data
The receipts are already embedded in the transaction reference that you receive after a successful transaction. The transaction object provides access to both the merchant and customer receipts .
Receipts are only attached if the transaction did not fail, so make sure to check the transaction and both receipt properties before accessing them.
How to access receipt data:
// For the Merchant Receipt MPReceipt *receipt = transaction.merchantReceipt; // For the Customer Receipt //MPReceipt *receipt = transaction.customerReceipt; NSLog(@"MERCHANT DETAILS"); for (MPReceiptLineItem* lineItem in receipt.merchantDetails) { NSString *label = lineItem.label; NSString *value = lineItem.value; NSLog(@"%@: %@", label, value); } NSLog(@" "); NSLog(@"%@: %@", receipt.receiptType.label, receipt.receiptType.value); NSLog(@"%@: %@", receipt.transactionType.label, receipt.transactionType.value); NSLog(@"%@: %@", receipt.amountAndCurrency.label, receipt.amountAndCurrency.value); NSLog(@" "); NSLog(@"PAYMENT DETAILS"); for (MPReceiptLineItem* lineItem in receipt.paymentDetails) { NSString *label = lineItem.label; NSString *value = lineItem.value; NSLog(@"%@: %@", label, value); } NSLog(@" "); NSLog(@"%@: %@", receipt.statusText.label, receipt.statusText.value); NSLog(@"%@: %@", receipt.date.label, receipt.date.value); NSLog(@"%@: %@", receipt.time.label, receipt.time.value); NSLog(@" "); NSLog(@"CLEARING DETAILS"); for (MPReceiptLineItem* lineItem in receipt.clearingDetails) { NSString *label = lineItem.label; NSString *value = lineItem.value; NSLog(@"%@: %@", label, value); } NSLog(@" "); // --- Optional NSLog(@"%@: %@", receipt.identifier.label, receipt.identifier.value); // --- // When offering Tip Adjust if(receipt.printTipLine) { NSLog(@"TIP : ___________________"); NSLog(@"TOTAL : ___________________"); } // --- Only for the Merchant Receipt if(receipt.printSignatureLine) { NSLog(@"Customer Signature:"); NSLog(@"___________________"); }
Custom Receipts
Should you require more flexibility than the ready-made receipts provide, you can also send or print custom receipts, including the payment-related data.
Make sure that your custom receipt contains all of the required receipt information and that you are able to also send receipts for successful refunds.
Required Receipt Information
A sample receipt with required information and its placement is shown below. Actual receipt content can vary, depending on acquirer and payment method.
  1. Full address of the merchant, including the country. Iterate over each line item
    getMerchantDetails()
    returns and print what the
    getValue()
    method returns.
  2. getReceiptType().getValue()
  3. getTransactionType().getValue()
  4. getAmountAndCurrency().getValue()
  5. The payment details, e.g. the masked account number. Iterate over each line item
    getPaymentDetails()
    returns and print what the
    getLabel()
    and
    getValue()
    methods return.
  6. getStatusText().getValue()
  7. getDate().getValue()
    and
    getTime().getValue()
  8. The clearing details, e.g. the merchant identifier. Iterate over each line item
    getClearingDetails()
    returns and print what the
    getLabel()
    and
    getValue()
    methods return.
  9. If
    isTipLineRequired()
    is
    true
    , then you have to print Tip and Total Amount lines on your receipts.
  10. If
    isSignatureLineRequired()
    is
    true
    , then you have to print a signature line on your merchant receipt.
Accessing Receipt Data
The receipts are already embedded in the transaction reference that you receive after a successful transaction. The transaction object provides access to both the merchant and customer receipts.
Receipts are only attached if the transaction did not fail, so make sure to check the transaction and both receipt properties before accessing them.
How to access receipt data:
// For the Merchant Receipt Receipt receipt = transaction.getMerchantReceipt(); // For the Customer Receipt // Receipt receipt = transaction.getCustomerReceipt(); Log.d("RECEIPT", "MERCHANT DETAILS"); for (ReceiptLineItem lineItem : receipt.getMerchantDetails()) Log.d("RECEIPT", lineItem.getLabel() + ": " + lineItem.getValue()); Log.d("RECEIPT", " "); Log.d("RECEIPT", receipt.getReceiptType().getLabel() + ": " + receipt.getReceiptType().getValue()); Log.d("RECEIPT", receipt.getTransactionType().getLabel() + ": " + receipt.getTransactionType().getValue()); Log.d("RECEIPT", receipt.getAmountAndCurrency().getLabel() + ": " + receipt.getAmountAndCurrency().getValue()); Log.d("RECEIPT", " "); Log.d("RECEIPT", "PAYMENT DETAILS"); for (ReceiptLineItem lineItem : receipt.getPaymentDetails()) Log.d("RECEIPT", lineItem.getLabel() + ": " + lineItem.getValue()); Log.d("RECEIPT", " "); Log.d("RECEIPT", receipt.getStatusText().getLabel() + ": " + receipt.getStatusText().getValue()); Log.d("RECEIPT", receipt.getDate().getLabel() + ": " + receipt.getDate().getValue()); Log.d("RECEIPT", receipt.getTime().getLabel() + ": " + receipt.getTime().getValue()); Log.d("RECEIPT", " "); Log.d("RECEIPT", "CLEARING DETAILS"); for (ReceiptLineItem lineItem : receipt.getClearingDetails()) Log.d("RECEIPT", lineItem.getLabel() + ": " + lineItem.getValue()); Log.d("RECEIPT", " "); // --- Optional Log.d("RECEIPT", receipt.getIdentifier().getLabel() + ": " + receipt.getIdentifier().getValue()); // --- // When offering Tip Adjust if(receipt.isTipLineRequired()) { Log.d("RECEIPT", "TIP : ___________________"); Log.d("RECEIPT", "TOTAL : ___________________"); } // --- Only for the Merchant Receipt if(receipt.isSignatureLineRequired()) { Log.d("RECEIPT", "Customer Signature"); Log.d("RECEIPT", "___________________"); }