Email and Print Receipts
After the transaction has been completed, you must enable the merchant to send a receipt to the shopper. Through the SDK, you can easily send a ready-made electronic receipt via email or print one.
If you support refunds, you also have to be able to send and print receipts for successful refunds.
Send Receipt via Email
Call
sendCustomerReceiptForTransactionIdentifier
with the
transactionIdentifier
of the transaction for which you want to send a receipt:
[transactionProvider sendCustomerReceiptForTransactionIdentifier:@"transactionIdentifer" emailAddress:@"[email protected]" completed:^(NSString *transactionIdentifier, NSString *emailAddress, NSError *error) { if(!error) { // Receipt successfully sent! } }]; emailAddress:@"[email protected]" completed:^(NSString *transactionIdentifier, NSString *emailAddress, NSError *error) { if(!error) { // Receipt successfully sent! } }];
Print Receipt via Printer
Use
printCustomerReceiptForTransactionIdentifier
with the
transactionIdentifier
of the transaction for which you want to print a receipt.
Similar to
MPTransactionProcess
, you need to build a user interface for the
MPPrintingProcess
to show status information to the merchant:
MPPrintingProcess *process = [transactionProvider printCustomerReceiptForTransactionIdentifier:@"transactionIdentifer" usingAccessory:MPAccessoryFamilySewoo statusChanged:^(MPPrintingProcess *printingProcess, MPTransaction *transaction, MPPrintingProcessDetails *details) { NSLog(@"%@\n%@", details.information[0], details.information[1]); } completed:^(MPPrintingProcess *printingProcess, MPTransaction *transaction, MPPrintingProcessDetails *details) { if (details.state == MPPrintingProcessDetailsStateSentToPrinter) { // Show to the merchant, that printing was successful // and close the printing UI } else { // Allow your merchant to retry printing } }];
Email and Print Receipts
After the transaction has been completed, you have to enable the merchant to send a receipt to the shopper. Through the SDK, you can easily send a ready-made electronic receipt via email or print one.
If you support refunds, you also have to be able to send receipts for successful refunds.
Send Receipt via Email
Call
sendCustomerReceiptForTransaction
with the
transactionIdentifier
of the transaction for which you want to send a receipt:
transactionProvider.getTransactionModule().sendCustomerReceiptForTransaction( "transactionIdentifer", "[email protected]", new SendReceiptListener() { @Override public void onCompleted(String transactionIdentifier, MposError error) { if(!error) { // Receipt successfully sent! System.out.println("Sent!"); } } } );
Print Receipt via Printer
Use
printCustomerReceiptForTransaction
with the
transactionIdentifier
of the transaction for which you want to print a receipt.
Similar to
TransactionProcess
, you need to build a user interface for the
PrintingProcess
to show status information to the merchant:
PrintingProcess process = transactionProvider.printCustomerReceiptForTransaction( "transactionIdentifer", AccessoryFamily.SEWOO, new PrintingProcessListener() { @Override public void onStatusChanged(PrintingProcess printingProcess, PrintingProcessDetails printingProcessDetails) { abortButton.setVisibility(printingProcess.canAbort() ? View.VISIBLE : View.INVISIBLE); Log.d("mpos", "status changed: " + Arrays.toString(printingProcessDetails.getInformation())); } @Override public void onCompleted(PrintingProcess printingProcess, PrintingProcessDetails printingProcessDetails) { if (printingProcessDetails.getState() == PrintingProcessDetailsState.SENT_TO_PRINTER) { // Show to the merchant, that printing was successful // and close the printing UI } else { // Allow your merchant to retry printing } } } );