Sale Transaction

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

Sale Overview

A Sale Transaction enables a merchant using 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.

456

How to process a Sale transaction request message

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

📘

Key elements of a Sale transaction request message

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

Examples of an Ecommerce Sale transaction request message can be seen below.

{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "ecom.sale", 
  "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": "ecom.sale", 
  "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="
  },
  "storedCredentialDetails": {
    "cardOnfileIndicator": "cardDetailsStoredFirstTime"
  }
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "ecom.sale", 
  "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": {
    "cardOnfileIndicator": "cardholderInitiatedCardOnFile"
  }    
}

Examples of a Mail Order Sale transaction request message can be seen below.

{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.sale", 
  "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"
  }
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.sale", 
  "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"
  }  
}
{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "mailorder.sale", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",
  "accountDetails": {
    "cardTokenizedNumber": "9997000000005071111"
  },
  "cardVerificationDetails": {
    "cardVerificationValue": "123"
  },
  "addressVerificationDetails": {
    "address": "5",
    "zipPostalCode": "123",
    "countryCode": "GBR"
  }    
}

Handling a Sale transaction response message

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

{
  "id": "7890ff90-e277-4ead-a7d8-6929a3f83286",
  "state": "Authorised",
  "providerStateCode": "000",
  "providerStateMessage": null,
  "providerCardSecurityResponseCode": null,
  "providerAddressVerificationResponseCode": 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"
  }
}