MPTransactionProcess *process = [transactionProvider startTransactionWithParameters:transactionParameters accessoryParameters:accessoryParameters registered:[...] statusChanged:[...] actionRequired:[...] completed:^(MPTransactionProcess *process, MPTransaction *transaction, MPTransactionProcessDetails *details) { 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(@"___________________"); }
TransactionProcess paymentProcess = transactionProvider.startTransaction(transactionParameters, accessoryParameters, new TransactionProcessWithRegistrationListener() { @Override public void onCompleted(TransactionProcess process, Transaction transaction, TransactionProcessDetails processDetails) { // 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", "___________________"); } } } );