Performing a Pre-Authorization and Capture

The PayButton also makes it really easy to implement Pre-Authorizations and Captures, allowing you to support the payment workflows that your merchants require.

Regardless of the kind of additional transaction you are going to make, they will always be based on a set of TransactionParameters and used in conjunction with MposUi.createTransactionIntent().

Card Scheme Rules for Pre-Authorizations

Pre-Authorizations make it possible to reserve a guaranteed amount on the shopper's card and either Capture or Refund it later on. This makes it easy for businesses such as hotels and rental companies to take deposits or up-front payments from their shoppers.

To comply with the Card Scheme regulations, you must make sure that your merchants follow those rules:

  • Pre-Authorizations are only permitted for Visa and MasterCard. Maestro does not allow Pre-Authorizations.
  • The captured amount must be equal to or lower than the pre-authorized amount.
  • Pre-Authorizations must be captured within 30 days to guarantee payment to the merchant.
  • For hotels, car rental companies or cruise line transaction businesses: If no capture is intended, the refund of the Pre-Authorization must take place within 24 hours of the check-out, rental return or disembarkation date.

Performing a Pre-Authorization

To perform a Pre-Authorization on the card, modify the TransactionParameters to include the autoCapture = false property for the initial transaction.

TransactionParameters parameters = new TransactionParameters.Builder()
		.charge(new BigDecimal("13.37"), Currency.EUR)
Intent intent = ui.createTransactionIntent(paramters);
startActivityForResult(intent, MposUi.REQUEST_CODE_PAYMENT);

The result in the onActivityResult() will be the same as for a normal charge transaction.

Make sure to provide a receipt to the shopper!

Capturing a Pre-Authorization

To capture an Pre-Authorization later on, you create TransactionParameters that contains the transactionIdentifier of the previous transaction. Optionally, you can also change the amount that should ultimately be captured.

TransactionParameters parameters = new TransactionParameters.Builder()
		// For partial captures, specify the amount to be captured
		// and the currency from the Pre-Authorization
		//.amountAndCurrency(new BigDecimal("1.00"), io.mpos.transactions.Currency.EUR)

Intent intent = ui.createTransactionIntent(paramters);
startActivityForResult(intent, MposUi.REQUEST_CODE_PAYMENT);

As a result, you will receive one of the following via the onActivityResult():

  • The original transaction that is now captured, indicated by transaction.captured = true;
  • An error indicating why capturing the charge failed.