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

# Recover a Lost Response

> When a request times out, recover what it did without doing it twice

A request can time out, or its connection drop, after Quidkey has acted on it. These steps recover what it did, without paying or refunding twice.

| # | Step | Who |
| - | - | - |
| 1 | Creating a payment transaction times out | |
| 2 | Send it again with the same `Idempotency-Key` | API |
| 3 | Get the checkout again | API |
| 4 | The same for any other keyed create | API |
| 5 | A write with no key | API |

**1. A create times out**

`POST /merchants/{id}/transactions` was sent, and no answer came back. You don't know whether the payment transaction was created.

**2. Send it again with the same key**

Send the same request: the same path, the same body and the same `Idempotency-Key`. That's why you store the key before the first attempt.

* If the first attempt created the payment transaction, the answer is its status, 201, with the transaction as it now stands, and an `Idempotent-Replayed: true` header.
* While the first attempt is still running, the answer is 409 `IDEMPOTENCY_IN_PROGRESS`. Wait a moment, then send it again.
* If nothing was made, the request runs now.

A first attempt that stopped partway leaves its key with no outcome, and after 5 minutes a retry runs the request again. If that first attempt had made its payment transaction, a second one is made beside it, unpaid. See [Idempotency](https://docs.quidkey.com/api-v1/standards/idempotency.md#a-first-attempt-that-never-finished). Neither takes payment unless the customer pays it.

A replayed answer leaves out the one-time `checkout`. So can the answer to a create you sent once: if an answer has no `checkout`, get it as the next step shows.

**3. Get the checkout again**

```bash theme={null}
curl -X POST 'https://api.quidkey.com/v1/transactions/tx_1:issueCheckout' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

It answers the payment transaction with `checkout`, holding the same live link the first create issued. It's safe to repeat. Only the owner of the payment transaction can call it: the partner that created it, while the merchant is still with that partner, and otherwise the merchant. Any other caller gets 404.

**4. Any other keyed create**

The same goes for a refund, a payment link, a merchant, a party, a bank account and a webhook endpoint: send the same request with the same key, and get the resource as it now stands. A webhook endpoint's `signing_secret` is one-time too: if an answer has no `signing_secret`, `:rotateSecret` issues a new one.

**5. A write with no key**

Read what the error says:

* 503 `SERVICE_UNAVAILABLE`: nothing was done, or doing it again is harmless, so send it again.
* 503 `OUTCOME_UNKNOWN`: it may have taken effect. Do what the endpoint's row in [Unknown outcomes](https://docs.quidkey.com/api-v1/standards/errors.md#unknown-outcomes) says: for most, read the resource before deciding, and for `POST /transactions/{id}:executeRefund`, send it again. `POST /webhook-endpoints/{id}:rotateSecret` isn't safe to repeat: each call replaces the secret again.


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