PreAuthorization Transaction

In this section you will learn how to process a PreAuthorization transaction

PreAuthorization Overview

A PreAuthorization transaction enables a merchant to request authorization of the transaction by the acquirer and, if the transaction is approved, then immediately require the capture of the transaction amount (debit the cardholder's account) by including the transaction for settlement.

How to process a PreAuthorization transaction request message

The merchant's system Posts a JSON PreAuthorization transaction message to the ANYpay Gateway. Section Card Transactions describes the elements required to build a PreAuthorization transaction request message.

📘

Key elements of a PreAuthorization transaction request message

Type MUST be set to [ecom.preAuthorization] or [mailorder.preAuthorization]

Examples of a PreAuthorization transaction request message can be seen below.

{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "ecom.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",     
  "accountDetails": {
    "cardNumber": "4444333322221111",
    "expiryDateMonth": 12,
    "expiryDateYear": 25
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  },
  "threeDSecureDetails": {
    "status": "Authenticated",
    "eci": "05",
    "cavv": "AAACBBNDYmJ3iDAlIUNiAAAAAAA=",
    "xid": "msRVTxAzkZtZOaN64kF8uIj6sY8="
  },
  "storedCredentialDetails": {
    "cardOnfileIndicator": "cardDetailsStoredFirstTime"
  }    
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",     
  "accountDetails": {
    "cardNumber": "4444333322221111",
    "expiryDateMonth": 12,
    "expiryDateYear": 25
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  },
  "storedCredentialDetails": {
    "cardOnfileIndicator": "cardDetailsStoredFirstTime"
  }  
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "ecom.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",
  "accountDetails": {
    "cardTokenizedNumber": "9997000000005071111"
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  },
  "threeDSecureDetails": {
    "status": "Authenticated",
    "eci": "05",
    "cavv": "AAACBBNDYmJ3iDAlIUNiAAAAAAA=",
    "xid": "msRVTxAzkZtZOaN64kF8uIj6sY8="
  } ,
  "storedCredentialDetails": {
    "merchantInitatedTransactionIndicator": "reauthorization"
  }    
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",
  "accountDetails": {
    "cardTokenizedNumber": "9997000000005071111"
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  },
  "storedCredentialDetails": {
    "merchantInitatedTransactionIndicator": "reauthorization"
  }   
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "ecom.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP",   
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",   
  "accountDetails": {
    "tokenId": "13c45dc2-56ec-4d7f-a966-50b6c3e93b37" 
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  },
  "threeDSecureDetails": {
    "status": "Authenticated",
    "eci": "05",
    "cavv": "AAACBBNDYmJ3iDAlIUNiAAAAAAA=",
    "xid": "msRVTxAzkZtZOaN64kF8uIj6sY8="
  }  
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.preAuthorization", 
  "amount": "10.00", 
  "currencyCode": "GBP",   
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",   
  "accountDetails": {
    "tokenId": "13c45dc2-56ec-4d7f-a966-50b6c3e93b37" 
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  }
}

Handling a PreAuthorization transaction response message

An example of a PreAuthorization transaction response message can be seen below.

{
  "id": "7890ff90-e277-4ead-a7d8-6929a3f83286",
  "state": "Authorised",
  "providerStateCode": "000",
  "providerStateMessage": null,
  "currencyCode": "USD",
  "accountDetails": {
    "cardNumber": "444433******1111",
    "tokenizedCardNumber": "9997000000005071111",
    "isVisaCheckout": null
  },
  "details": {
    "providerMerchantId": "542929008043127",
    "providerTerminalId": "00630376"
  },
  "stateDetails": {
    "approvalCode": "06268A"
  },
  "cardSecurityResponseCode": null,
  "addressVerificationResponseCode": null
}
{
  "code": "4017740",
  "details": {
    "message": "Invalid username or password"
  }
}