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 on paper.

If you support refunds, you also have to be able to send receipts for successful refunds.

Send receipt via email

Call sendCustomerReceiptForTransactionIdentifier with the transactionIdentifier of the transaction for which you want to send out a receipt:

[transactionProvider sendCustomerReceiptForTransactionIdentifier:@"transactionIdentifer"
													emailAddress:@"shopper@provider.com"
													   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
	}
}];

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 on paper.

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 out a receipt:

transactionProvider.sendCustomerReceiptForTransaction(
		"transactionIdentifer",
		"shopper@provider.com",
		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
				}
			}
		}
);

Can we help you?

If you cannot find your answer, contact us and we'll get in touch with you soon.

© Copyright 2017 Payworks GmbH. Legal.