# CONNECT_CODE_INVALID

> HTTP 400. A store plugin tried to exchange a Connect code for its keys, and the code can't be used. details.reason says why (see [Plugin Connect](/checkout/connect) for the flow):

A store plugin tried to exchange a Connect code for its keys, and the code can't be used.
`details.reason` says why (see [Plugin Connect](/docs/checkout/connect) for the flow):


| `reason` | What happened |
|---|---|
| `unknown` | No such code was issued. |
| `used` | The code was already exchanged. A code works once, and only once. |
| `expired` | More than 5 minutes passed between approving and exchanging. |
| `verifier` | The `code_verifier` is not the one the code's `code_challenge` was made from. |
| `site` | The `site_url` is not the store the code was issued to. |

Every exchange spends the code, right or wrong, so a code that leaked can't be tried twice. If a
code that was already exchanged is presented again, the connection it made is **revoked** (its
keys and webhooks stop at once): only someone replaying the code would send it a second time.

## What to do

- **Merchants:** press **Connect intents.fi** in your store's settings again. It takes a few
  seconds, and nothing from the failed attempt is left behind.
- **Plugin authors:** make a fresh `state` and `code_verifier` for every attempt, keep the verifier
  on your server, exchange the code as soon as the browser comes back, send the same `site_url`
  you put in the request, and never retry an exchange with the same code.


## Example response

```json
{ "error": { "code": "CONNECT_CODE_INVALID", "message": "…" } }
```

---

Source: https://intents.fi/docs/errors/CONNECT_CODE_INVALID · The whole corpus: https://intents.fi/docs/llms-full.txt
