---
url: https://simplepay.webmania.cc/en/reference/errors.md
description: >-
  What SimplePay error codes mean and how to fix them (5100 invalid signature,
  5321 format error, 5013 transaction exists, 3004 3DS, 2063 declined), plus the
  simplepay-js-sdk error messages.
---

# Error codes

You will meet two kinds of errors:

1. **SDK error messages**: thrown by the SDK before or after it calls SimplePay.
2. **SimplePay error codes**: in the `errorCodes` array of SimplePay's response. The SDK turns them into a `SimplePay API error: <codes>` exception (several codes comma-separated, for example `SimplePay API error: 5100,5302`).

```ts
try {
  await startPayment(data)
} catch (error) {
  const match = /SimplePay API error: ([\d,]+)/.exec((error as Error).message)
  const codes = match ? match[1].split(',') : []
  if (codes.includes('5013')) {
    // this orderRef already exists
  }
}
```

## SDK error messages

| Message | Cause | Fix |
|---|---|---|
| `Missing SimplePay configuration for HUF` | The currency's `SIMPLEPAY_MERCHANT_ID_*` or `SIMPLEPAY_MERCHANT_KEY_*` is not set | Set both ([Configuration](../guide/configuration)) |
| `Unsupported currency: XYZ` | `currency` is not `HUF`, `HUF_SZEP`, `EUR` or `USD` | Use a supported currency |
| `Missing merchant key` | An empty secret key was used for signing | Check the key variable; for the IPN, the `merchantKey` argument |
| `SimplePay return url must be absolute https in production` | In production the return URL is missing or not `https` | Set `SIMPLEPAY_REDIRECT_URL` or `redirectUrl` to `https://…` |
| `SimplePay return urls must be absolute https in production` | In production an `urls` entry is missing or not `https` | Make all four `urls` entries `https://…` |
| `SimplePay API error: 401` (or another HTTP status) | SimplePay answered with a non-2xx status | Check the keys and the sandbox/production setting |
| `Missing response signature` | SimplePay's response has no `Signature` header | Often a wrong endpoint or a proxy; turn on `SIMPLEPAY_LOGGER` |
| `Invalid response signature` | The response or back-URL signature doesn't match | Wrong key (sandbox/live mix-up, another currency), or tampered `r`/`s` |
| `Merchant id not found in the environment: …` | The back URL's merchant ID is in no `SIMPLEPAY_MERCHANT_ID_*` variable | Set that account's merchant ID |
| `Invalid IPN request signature` | The IPN signature doesn't match | Read the raw body, pass the right key ([IPN](../guide/ipn#common-mistakes)) |
| `Invalid IPN request body` | The IPN body is not a JSON object | Don't transform the body |
| `Missing Google Pay token` | Empty `googlePayToken` | Pass the token from the browser |
| `Google Pay does not support HUF_SZEP` / `Apple Pay does not support HUF_SZEP` | Google/Apple Pay started with the SZÉP currency | Use another currency |
| `Apple Pay domain must be the registered FQDN` | `domain` is not a valid domain name | Pass the registered FQDN, with no protocol or path |
| `Missing Apple Pay session` | The `startapplepay` response has no `applePaySession` | Check the domain registration in the SimplePay admin |
| `Invalid Apple Pay transaction id` | `transactionId` is not a positive integer | Pass the ID from the `startApplePay` response |
| `Missing Apple Pay token` | The token is not valid Base64 | Pass the browser's token unchanged |
| `Apple Pay authorization failed` | `applePayStatus` is not `STATUS_SUCCESS` | The customer retries, or uses another card |
| `TimeoutError` | SimplePay did not answer within 30 seconds | Retry later |

::: info 3004 with Google Pay
Google Pay `3004` with a `redirectUrl` is **not** an error: `startGooglePay` returns the response and the button redirects to the 3DS page.
:::

## Common SimplePay error codes

Source: [SimplePay – error codes](https://docs.simplepay.hu/hu/developer-tools/api/error-codes) (Hungarian). The descriptions below are short English summaries; the full official list is on that page.

### Signature and format

| Code | Meaning | Typical cause with the SDK |
|---|---|---|
| `5100` | Invalid signature | Wrong key (sandbox key on live or the other way round, another currency's key) |
| `5302`, `5303` | Invalid signature on the incoming request | Same as above |
| `5321` | Format error / invalid JSON | A badly formatted field in the request. For dates (such as `recurring.until`) use `toISO8601DateString`. |

### Merchant

| Code | Meaning | What to do |
|---|---|---|
| `2006` | Merchant not found | Check the merchant ID |
| `5010` | Merchant account not found | Sandbox ID on the live API or the other way round |
| `5201` | Merchant ID missing | Set `SIMPLEPAY_MERCHANT_ID_*` |

### Order

| Code | Meaning | What to do |
|---|---|---|
| `5013` | Transaction already exists | Every payment attempt needs a new, unique `orderRef` |
| `5101`, `5213` | Order reference missing | Pass `orderRef` |
| `5102` | Amount missing | Pass `total` |
| `5065` | Invalid amount | Check the `total` value |
| `5066` | Invalid currency | Use the account's currency |
| `5011` | Transaction not found | Check the `transactionId` (for example with `cancelCard`) |
| `5333` | Transaction ID missing | |
| `5304` | Call failed because of a timeout | Retry |

### Card and 3DS

These concern the customer's card. They show up as a `FAIL` event on the back URL, or as an exception for token charges.

| Code | Meaning | What to tell the customer |
|---|---|---|
| `2063`, `2066`, `2004` | Declined by the issuing bank | Ask your bank, or pay with another card |
| `2013` | Balance or daily limit | Check your balance and limits |
| `2070` | Card type not enabled or not recognised | Use another card |
| `2071` | Wrong card number | Check the card number |
| `2072` | Wrong expiry date | Check the expiry date |
| `2073` | Wrong CVC | Check the code on the back |
| `3004` | The bank asks for strong customer authentication (3DS) | Retry and follow your bank's authentication steps |

### Recurring payments

| Code | Meaning | What to do |
|---|---|---|
| `5044` | Recurring payments not enabled | Ask SimplePay to enable them for the account |
| `5040` | Stored card not found | The card was removed; a new registration is needed |
| `5041` | Stored card expired | A new card registration is needed |
| `5081` | Recurring token not found | Wrong or already deleted token |

### General

| Code | Meaning |
|---|---|
| `0` | Success |
| `999`, `5000` | General error – retry; if it persists, contact SimplePay support |
