# Mark an instalment failed on the rail

Records that a debit was attempted and the rail rejected it, and schedules the retry: the attempt count goes up and the next retry date is set while retries remain. Body: `reason` is REQUIRED — a failure with no reason is refused — plus an optional `code` for the rail's own return code. Legal from scheduled, pending or processing. Reach for `post_payments_id_missed` instead when nothing was ever attempted, and `post_payments_id_reverse` when a booked receipt has to be undone.

Access class: `workspace`.

## Endpoint

`POST /v1/payments/{id}/failed`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| id | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "code": "string",
    "reason": "string"
  },
  "params": {
    ":id": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "achTraceNumber": "string",
    "actualAmountMinor": 1,
    "balanceAfterMinor": 1,
    "balanceBeforeMinor": 1,
    "batchId": "",
    "cashFlowId": 1,
    "counterpartyId": 1,
    "createdAt": "string",
    "currency": "string",
    "detail": {},
    "dueDate": "string",
    "expectedAmountMinor": 1,
    "externalTransactionId": "",
    "facilityId": 1,
    "failedAt": "string",
    "failureCode": "string",
    "failureReason": "string",
    "gracePeriodEnd": "string",
    "id": 1,
    "maxRetries": 1,
    "method": "string",
    "nextRetryDate": "string",
    "notes": "string",
    "paymentNumber": 1,
    "penaltyAmountMinor": 1,
    "processedAt": "string",
    "reconciled": true,
    "reconciledAt": "string",
    "reconciledByUserId": 1,
    "reconciliationNotes": "string",
    "referenceNumber": "string",
    "retryCount": 1,
    "reversedAt": "string",
    "scheduleId": 1,
    "settledAt": "string",
    "status": "string",
    "updatedAt": "string",
    "varianceMinor": 1,
    "waivedAt": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
