> ## Documentation Index
> Fetch the complete documentation index at: https://kb.paymentsmojo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Formats

> JSON or XML requests and responses, and how results come back.

## JSON or XML

The gateway accepts and answers both. It answers in **JSON by default**, and in **XML** to callers that speak XML,
deciding in this order:

1. `?format=json` or `?format=xml` on the request.
2. An `Accept` header naming only one of them.
3. The format of the request body.
4. JSON.

JSON uses camelCase member names and leaves empty ones out:

```json theme={null}
{ "respStat": "A", "retRef": "277127012209", "amount": "2.40", "tipAmount": "0.40" }
```

The same in XML:

```xml theme={null}
<AuthCardResponse><RespStat>A</RespStat><RetRef>277127012209</RetRef><Amount>2.40</Amount><TipAmount>0.40</TipAmount></AuthCardResponse>
```

Send JSON with `Content-Type: application/json`, XML with `application/xml`.

## Results

| `respStat` | Meaning |
| - | - |
| `A` | Approved |
| `B` | Retry |
| `C` | Declined |
| `E` | Error, with the reason in `respMessage` |

Errors use the same shape, so the register can show why:

```json theme={null}
{ "respStat": "E", "respMessage": "POS Gateway isn't turned on at Main Street." }
```

| HTTP | When |
| - | - |
| `200` | Any answer above, including declines and errors. |
| `400` (no body) | A required field is missing. |
| `401` | The key is unknown, wrong or revoked. |
| `429` | Too many requests from one address (more than 120 a minute). |

A customer cancelling on the terminal answers `Operation cancelled by customer`.

Every response names the gateway version that handled it in the `X-Mojo-Gateway-Version` header.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.