Create Batch Request

Creating the batch request is a critical step in the merchant integration. A batch request consists of a batch file in Native Format, which the Batch service accepts and submits to the CommWeb payment gatewayBatch URL using HTTPS PUT.

The Native Format is defined as follows:

  • The HTTP header must specify basic authentication and include your integration password base64 encoded.
  • The character encoding of your request must include only ISO-8859-1(Latin1), or UTF-8 formats. See Ensure Character Encoding.
  • Batch files must be supplied in the comma delimited CSV format and take into account the following processing restrictions:
    • Comments should not be included as they are not supported.
    • Values are not trimmed of leading or trailing spaces.
    • Embedded commas should be handled by enclosing the value in quotes.
    • Embedded double quotes should be handled by enclosing the value in quotes, and then representing it by a pair of double quotes.
    • There is a maximum value length of 100,000 characters per line.
    • Each batch file should contain a single header row with values that correspond to the DirectAPI NVP protocol field names. See NVP Reference.
    • Fields within the data file must obey the DirectAPI validation rules (field length and format, mandatory, unique value, etc).
    • Records for all transaction types (authorizations, purchases, captures, refunds, voids) may be provided within a file. However, ensure that the transaction types are NOT related to the same order, i.e., they do not contain the same order identifier. For more information, see Best Practices and Tips.

    The sample below shows a test batch input file for a merchant using password as the authentication mechanism to connect to CommWeb payment gateway.

    apiOperation,order.id,transaction.id,order.amount,order.currency,sourceOfFunds.type,sourceOfFunds.provided.card.number,sourceOfFunds.provided.card.expiry.month,sourceOfFunds.provided.card.expiry.year,sourceOfFunds.provided.card.number,result,error.cause,error.explanation,response.gatewayCode
    PAY,921830104177,TXID1,30,AUD,CARD,5123456789012346,05,17,,,,,
    PAY,921830104178,TXID1,100,AUD,CARD,5123456789012346,05,17,,,,,
    PAY,921830104179,TXID1,50,AUD,CARD,4987654321098769,05,17,,,,,
    PAY,921830104180,TXID1,90,AUD,CARD,4987654321098769,05,17,,,,,
    PAY,921830104181,TXID1,45,AUD,CARD,345678901234564,05,17,,,,,
    PAY,921830104182,TXID1,75,AUD,CARD,345678901234564,05,17,,,,,
    

  • Both the request and response fields must be defined in the batch request. When preparing your integration, you should spend some time examining the response parameters for each relevant operation in the API Reference to decide which fields to include in the request. All of these fields provide valuable information, and many of which you may wish to store locally for accounting, reconciliation, troubleshooting and traceability reason.

Sample code for a basic Batch integration has been included in the example code. See Downloads.

Copyright © 2020 Commonwealth Bank of Australia