# Update a payment

`PATCH /v1/payments/{payment_id}`

Required scope: `payments:write`

Change a payment that was logged by hand.

## Path parameters

- `payment_id` (string, required)

## Request body (application/json)

- `amount` (integer or null, optional)
- `contact_id` (string or null, optional)
- `currency` (string or null, optional)
- `note` (string or null, optional)
- `paid_at` (string (date-time) or null, optional)
- `status` (string or null, optional) Allowed values: `"succeeded"`, `"pending"`, `"failed"`, `"refunded"`.

## Responses

- `200`: Successful Response
- `400`: The request is not valid.
- `401`: Not signed in, or the credentials are not valid.
- `402`: The balance is too low.
- `403`: Not allowed to do this.
- `404`: Not found.
- `409`: Conflicts with the current state.
- `413`: The request body is too large.
- `415`: The content type is not supported.
- `422`: A value in the request is not valid.
- `429`: Too many requests. Wait for `Retry-After` seconds.
- `500`: Something went wrong on our side.
- `502`: A service Valeron depends on refused the request.
- `503`: A service Valeron depends on is unavailable.

## Examples

### Request

```bash title="cURL"
curl -X PATCH "https://api.valeron.io/v1/payments/pay_01J5M1MJA8" \
  -H "Authorization: Bearer $VALERON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 2400000,
  "contact_id": "ct_01JCH8XFQH",
  "currency": "USD",
  "note": "Thanks for your time today. Here is what we agreed.",
  "paid_at": "2026-12-03T14:30:00Z",
  "status": "succeeded"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.valeron.io/v1/payments/pay_01J5M1MJA8", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.VALERON_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "amount": 2400000,
    "contact_id": "ct_01JCH8XFQH",
    "currency": "USD",
    "note": "Thanks for your time today. Here is what we agreed.",
    "paid_at": "2026-12-03T14:30:00Z",
    "status": "succeeded"
  }),
});
if (!response.ok) throw new Error(`Valeron returned ${response.status}`);
const data = await response.json();
```

```python title="Python"
import os
import requests

response = requests.patch(
    "https://api.valeron.io/v1/payments/pay_01J5M1MJA8",
    headers={"Authorization": f"Bearer {os.environ['VALERON_API_KEY']}"},
    json={
        "amount": 2400000,
        "contact_id": "ct_01JCH8XFQH",
        "currency": "USD",
        "note": "Thanks for your time today. Here is what we agreed.",
        "paid_at": "2026-12-03T14:30:00Z",
        "status": "succeeded",
    },
)
response.raise_for_status()
data = response.json()
```

### Response 200

```json
{
  "amount": {
    "amount": 2400000,
    "currency": "USD"
  },
  "contact": {
    "id": "pay_01JMVCNE28",
    "name": "Jordan Rivera"
  },
  "created_at": "2026-12-03T14:30:00Z",
  "id": "pay_01JMVCNE28",
  "logged_by": {
    "id": "pay_01JMVCNE28",
    "name": "Jordan Rivera"
  },
  "note": "Thanks for your time today. Here is what we agreed.",
  "paid_at": "2026-12-03T14:30:00Z",
  "payer_email": "example",
  "payer_name": "example",
  "processor_payment_id": "pay_01JPFEETCF",
  "refunded_amount": 2400000,
  "source": {
    "label": "Example",
    "value": "example"
  },
  "status": {
    "label": "Example",
    "value": "example"
  },
  "updated_at": "2026-12-03T14:30:00Z"
}
```

### Response 401

```json
{
  "error": null
}
```

### Response 402

```json
{
  "error": null
}
```

### Response 403

```json
{
  "error": null
}
```

### Response 404

```json
{
  "error": null
}
```
