# payment_in_progress

> A payment is already in progress

- Status: 409 Conflict
- Returned by: /api/public
- Operations: [cancelOrder](https://developers.rivr.io/reference/api-public/cancelOrder.md), [refundOrder](https://developers.rivr.io/reference/api-public/refundOrder.md)
- Retry (`retryWhen`): `later`
- Did anything happen? (`outcome`): `unknown` (Unknown)
- Payments in Rivr Go
- Page in the portal: https://developers.rivr.io/errors/payment_in_progress
- Try it: `GET https://developers.rivr.io/errors/simulate/payment_in_progress` answers with the code's exact wire form; `?succeedAfter=N&attempt=K` gives a 200 once `attempt` passes `N`

## What it means

Another payment is already in progress for the order, through the payment link, a payment terminal, a loan or invoice, a bank transfer reference, or a payment someone started in Rivr Go. For card, it also applies to an `Idempotency-Key` whose payment may already have been handed to the SDK: it already has an outcome, or it was prepared more than a minute ago. The payment in progress may be your own earlier attempt, so it can still complete. In `/api/public`, cancel and refund answer this way while a card payment is in progress on a terminal, and nothing is changed.

## What your system does

Wait until the other payment has finished or been abandoned, and follow the order with `GET /api/public/orders/{orderId}`. If the order becomes `Completed`, it is paid. If it is released, the payment can be started again — for card, with a new `Idempotency-Key` — and a cancel or refund can be sent again.

## Is it worth retrying?

Only once the situation has changed, see above. Sending the same call straight away gets the same answer.

`retryWhen`: `later`. The same request can succeed, but only once something outside it has changed: another payment has finished, a permission has been given or Rivr has switched something on. Sending it again straight away gets the same answer. Follow the order or wait for the change.

## Did anything happen?

`outcome`: `unknown`. **Unknown.** The answer doesn't say whether what you asked for has happened, through this call or an earlier one. Read the state first.

The call started no new payment. The payment in progress may be your own earlier call, for example with the same `Idempotency-Key`, and can still complete and charge the patient. On cancel and refund nothing changed, and the key can be used again.

Read the state (`resolveWith`):

- `cancelOrder` → [`GET /api/public/orders/{orderId}`](https://developers.rivr.io/reference/api-public/getOrder.md): `status` shows whether the payment completed (4, Completed). Nothing was cancelled.
- `refundOrder` → [`GET /api/public/orders/{orderId}`](https://developers.rivr.io/reference/api-public/getOrder.md): `status` shows whether the payment completed (4, Completed). Nothing was refunded.

## Example: /api/public

```http
HTTP/1.1 409 Conflict
Content-Type: application/json

{
  "propertyName": "HasInFlightTerminalPaymentAttempt",
  "message": "A terminal payment attempt is in flight for this order and it cannot be cancelled right now. Retry once the attempt has completed or failed.",
  "errorCode": "payment_in_progress",
  "code": "payment_in_progress",
  "type": "https://developers.rivr.io/errors/payment_in_progress"
}
```

The `title`, `detail`, `message` and `error_description` texts are exactly as the API writes them today.
