# Close a partial payment

> Ends the instalment plan of a `partial` payment before its last instalment. With `outcome: keep` the payment becomes `succeeded` for what the paid instalments collected (`amount_paid`), which is already on your balance; the unpaid instalments are dropped. With `outcome: refund` it is closed the same way and a refund of everything collected is opened at once; Wajub sends it to the numbers the instalments came from. Nothing closes a partial payment on its own. Requires the secret key. A restricted key needs `payment.write`, and `refund.write` as well with `outcome: refund`. Through `X-Sync`, the connection needs the `payments` capability, and `refunds` as well with `outcome: refund`, as `POST /refunds` takes it.

`POST https://api.wajub.com/payments/{id}/close`

## Path parameters

- `id` (string, required): The payment's `id`.

## Headers

- `Idempotency-Key` (string): Your key for this request, 1 to 128 characters of letters, digits and `. _ : -`. The same request sent again with the same key returns the first answer instead of doing the work twice. See [Idempotency](https://docs.wajub.com/api/idempotency).

## Body (application/json)

- `outcome` (string, required, one of `keep`, `refund`): `keep` the instalments collected, or `refund` them.
- `reason` (string, nullable): With `outcome: refund`, why the payment is refunded: one of the refund reasons. Defaults to `requested_by_customer`.
- `fees_bearer` (string, nullable, one of `merchant`, `customer`): With `outcome: refund`, who bears the fee share of the refund: `merchant` (default) or `customer`.

## Responses

- `200`: OK
- `403`: Forbidden
- `406`: Publishable key
- `409`: Conflict
- `422`: Outcome missing
