Implement Pre-Authorizations and Captures

The SDK supports 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, it will always be based on a set of MPTransactionParameters. These are provided to either [MPTransactionProvider startTransactionWithParameters:] for cases where there is no previous reference transaction available and interaction with a card reader is required (CHARGEs), or to [MPTransactionProvider amendTransactionWithParameters:] for cases where you are modifying an existing transaction (captures and refunds) and you have to provide the transaction.identifier as a reference.

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 hotel, car rental company 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 MPTransactionParameters to include the autoCapture = NO property for the initial transaction.

MPTransactionParameters *tp =
    [MPTransactionParameters chargeWithAmount:[NSDecimalNumber decimalNumberWithString:@"5.00"]
                                                                              currency:MPCurrencyEUR
                                                                             optionals:
     ^(id<MPTransactionParametersOptionals>  _Nonnull optionals)
{
    optionals.subject = @"Bouquet of Flowers";
    optionals.customIdentifier = @"yourReferenceForTheTransaction";
    optionals.autoCapture = NO;
}];

Afterwards you start the transaction as usual via [MPTransactionProvider startTransactionWithParameters:].

Make sure to provide a receipt to the shopper!

Capturing a Pre-Authorization

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

MPTransactionParameters *parameters =
[MPTransactionParameters captureTransactionWithIdentifier:@"<transactionIdentifier>"
											  optionals:
 ^(id<MPTransactionParametersCaptureOptionals>  _Nonnull optionals)
 {
	 // For partial captures, specify the amount to be captured
	 // and the currency from the Pre-Authorization
	 // [optionals setAmount:[NSDecimalNumber decimalNumberWithString:@"1.00"] currency:MPCurrencyEUR];
 }];

Since this is a modification to an existing transaction, you now need to pass the parameters to [MPTransactionProvider amendTransactionWithParameters:].

As a result, you will receive one of the following:

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

The SDK supports 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, it will always be based on a set of TransactionParameters. These are provided to either TransactionProvider.startTransaction() for cases where there is no previous reference transaction available and interaction with a card reader is required (CHARGEs), or to TransactionProvider.amendTransaction() for cases where you are modifying an existing transaction (captures and refunds) and you have to provide the transaction.identifier as a reference.

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 hotel, car rental company 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)
		.autoCapture(false)
		.build();
Intent intent = ui.createTransactionIntent(paramters);

Afterwards you start the transaction as usual via TransactionProvider.startTransaction().

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()
		.capture("<transactionIdentifer>")
		// 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)
		.build();

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

Since this is a modification to an existing transaction, you are now passing the parameters to TransactionProvider.amendTransaction().

As a result, you will receive one of the following:

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

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.