# Create a Batch Request
source: https://developer.mastercard.com/mastercard-gateway/documentation/integrations-types/hosted-batch/integrate-hosted-batch/create-batch-request/index.md

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 Mastercard 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](https://developer.mastercard.com/mastercard-gateway/documentation/integrations-types/hosted-batch/integrate-hosted-batch/create-batch-request/index.md#ensure-correct-character-encoding).
* Batch files must be supplied in the comma-delimited CSV format and consider 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 API NVP protocol field names. See [NVP Reference](https://developer.mastercard.com/mastercard-gateway/documentation/api-reference/v100/nvp/index.md).
* Fields within the data file must obey the API validation rules (field length and format, mandatory, unique value, and so on).
* 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, in other words, they do not contain the same order identifier. For more information, see [Best Practices and Tips](https://developer.mastercard.com/mastercard-gateway/documentation/integrations-types/hosted-batch/integrate-hosted-batch/index.md#best-practices-and-tips). The sample shows a test batch input file for a merchant using a password as the authentication mechanism to connect to Mastercard Gateway.

```java
apiOperation,order.id,order.currency,transaction.id,transaction.amount,transaction.currency,sourceOfFunds.type,sourceOfFunds.provided.card.number,sourceOfFunds.provided.card.expiry.month,sourceOfFunds.provided.card.expiry.year,response.gatewayCode,result,error.cause,error.explanation,error.field,error.supportCode,error.validationType
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,936742085167,AUD,TX1,30.00,AUD,CARD,5123456xxxxxx346,05,21,,,,
PAY,936742085168,AUD,TX1,35.00,AUD,CARD,5123456xxxxxx346,05,21,,,,,
```

* 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. Warning: Merchants can refer to the Mastercard Gateway Merchant Manager User Guide Enterprise on the Merchant Manager Portal to create a batch request by using the SSL certificate authentication.

## Ensure Correct Character Encoding {#ensure-correct-character-encoding}

The Mastercard Gateway Batch supports the most commonly used character encoding formats - UTF-8 and Latin1 (ISO-8859-1), giving you flexibility when submitting files for processing. The character encoding used in the file must be specified in the content-type HTTP header. Where no character encoding is supplied, Batch attempts to process the file using Latin1 (ISO-8859-1) encoding by default.

If the specified character encoding is not supported by Batch, the batch request is rejected. An HTTP error of 415 Unsupported Media Type is returned.

The content-type header must be set on the HTTPS PUT message with the correct encoding. An example content type header is `"Content-Type: text/plain; charset=UTF-8"`.

Batch would then decode incoming data as UTF-8.

Alert: Though UTF-8 is a supported character encoding format, there are a few fields (for example,` order.reference`) that will only accept ISO-8859-1 characters. This is due to downstream financial systems not being able to support all UTF-8 characters.

<br />

