
## Get a payment

`GET /v1/payments/:id`

Returns a single payment by ID with all fields.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Payment ID. List: [`GET /v1/payments`](/docs/entities/payments/list) |
| `select` (query) | string | no | Comma-separated response fields, for example `id,sum,currency,paid`. Without it, every field is returned. The `id` field is always returned. An unknown name does not cause an error: that field is absent from the response, and `meta.warnings` carries an `UNKNOWN_SELECT_FIELD` warning. Names come from [Payment fields](/docs/entities/payments/fields) |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/payments/17" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/payments/17" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/payments/17', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Payment:', data.sum, data.currency, '—', data.paySystemName)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/payments/17', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Payment object. All its fields are listed below |
| `data.id` | number | Payment ID |
| `data.accountNumber` | string | Sequential payment number on the Bitrix24 account |
| `data.orderId` | number | Order ID. List: [`GET /v1/orders`](/docs/entities/orders/list) |
| `data.paySystemId` | number | Payment system ID. List: [`GET /v1/pay-systems`](/docs/entities/pay-systems/list) |
| `data.paySystemName` | string | Payment system name |
| `data.paySystemIsCash` | boolean | Whether the payment system accepts cash (read-only) |
| `data.paySystemXmlId` | string | External payment system ID (read-only) |
| `data.sum` | number | Payment amount |
| `data.currency` | string | Payment currency. List: [`GET /v1/currencies`](/docs/entities/currencies/list) |
| `data.paid` | boolean | Whether the payment is marked as received |
| `data.datePaid` | datetime \| null | Date the payment was marked as received. `null` if no date is set |
| `data.dateBill` | datetime | Invoice issue date |
| `data.datePayBefore` | datetime \| null | Payment due date, with no meaningful time component. The time component in the response is always midnight in the Bitrix24 account time zone and has no separate meaning. `null` if not set |
| `data.dateMarked` | datetime \| null | Date the payment was flagged as problematic (read-only). `null` if it is not flagged |
| `data.dateResponsibleId` | datetime \| null | Date the responsible person was assigned (read-only). `null` if no responsible person is assigned |
| `data.responsibleId` | number \| null | Responsible employee. List: [`GET /v1/users`](/docs/entities/users/list). `null` if not assigned |
| `data.comments` | string \| null | Payment comment. `null` if not set |
| `data.xmlId` | string | External ID |
| `data.isReturn` | string | Refund flag: `"N"` for a regular payment, `"Y"` for a refund, `"P"` for a partial refund |
| `data.marked` | boolean | Whether the payment is flagged as problematic |
| `data.reasonMarked` | string \| null | Reason for the flag. `null` if it is not flagged |
| `data.empPaidId` | number \| null | Employee who marked the payment as received (read-only). List: [`GET /v1/users`](/docs/entities/users/list) |
| `data.empResponsibleId` | number \| null | Employee responsible for the payment (read-only). List: [`GET /v1/users`](/docs/entities/users/list) |
| `data.empMarkedId` | number \| null | Employee who set the flag (read-only). List: [`GET /v1/users`](/docs/entities/users/list) |
| `data.empReturnId` | number \| null | Employee who processed the refund (read-only). List: [`GET /v1/users`](/docs/entities/users/list) |
| `data.psStatus` | string \| null | Payment status reported by the payment system. `null` if the payment was not processed through a payment system |
| `data.psStatusCode` | string \| null | Status code from the payment system |
| `data.psStatusDescription` | string \| null | Status description from the payment system |
| `data.psStatusMessage` | string \| null | Message from the payment system |
| `data.psSum` | number \| null | Payment amount reported by the payment gateway |
| `data.psCurrency` | string \| null | Payment currency reported by the payment gateway |
| `data.psResponseDate` | datetime \| null | Payment gateway response date |
| `data.psInvoiceId` | string \| null | Invoice ID on the payment gateway side |
| `data.payVoucherNum` | string \| null | Payment order number. `null` if there is no payment order |
| `data.payVoucherDate` | datetime \| null | Payment order date. `null` if there is no payment order |
| `data.payReturnNum` | string \| null | Refund document number. `null` if there has been no refund |
| `data.payReturnDate` | datetime \| null | Refund date. `null` if there has been no refund |
| `data.payReturnComment` | string \| null | Refund comment. `null` if there has been no refund |
| `data.priceCod` | number | Cash on delivery amount. `0` if no cash on delivery amount is set |
| `data.companyId` | number \| null | Payer company from CRM. List: [`GET /v1/companies`](/docs/entities/companies/list). `null` if not set |
| `data.externalPayment` | boolean | Payment was created in an external system |
| `data.id1c` | string \| null | Payment ID in ERP. `null` if the payment is not synchronized with ERP |
| `data.version1c` | string \| null | Payment version in ERP. `null` if the payment is not synchronized with ERP |
| `data.updated1c` | boolean | Whether the payment was updated through ERP |
| `meta.warnings` | array | Warnings about unknown names in `select`, with `code`, `message`, and `field`. Only included when warnings exist |

For the full list of fields with links to ID sources, see [Payment fields](./fields.md).

## Response example

```json
{
  "success": true,
  "data": {
    "id": 17,
    "accountNumber": "19/1",
    "orderId": 19,
    "paySystemId": 11,
    "paySystemName": "Cash",
    "paySystemIsCash": true,
    "paySystemXmlId": "bx_61372545d32ae",
    "sum": 0,
    "currency": "USD",
    "paid": false,
    "datePaid": "2020-05-14T20:00:00.000Z",
    "dateBill": "2020-05-14T20:00:00.000Z",
    "datePayBefore": null,
    "dateMarked": null,
    "dateResponsibleId": "2020-05-15T12:08:16.000Z",
    "responsibleId": 1,
    "empPaidId": null,
    "empResponsibleId": 1,
    "empMarkedId": null,
    "empReturnId": null,
    "comments": null,
    "reasonMarked": null,
    "xmlId": "bx_5ebe943aacfa0",
    "id1c": null,
    "version1c": null,
    "updated1c": false,
    "externalPayment": false,
    "isReturn": "N",
    "marked": false,
    "priceCod": 0,
    "companyId": null,
    "payReturnNum": null,
    "payReturnDate": null,
    "payReturnComment": null,
    "payVoucherNum": null,
    "payVoucherDate": null,
    "psStatus": null,
    "psStatusCode": null,
    "psStatusDescription": null,
    "psStatusMessage": null,
    "psSum": null,
    "psCurrency": null,
    "psInvoiceId": null,
    "psResponseDate": null
  }
}
```

## Error response example

404 — payment not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "payment is not exists"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No payment with this ID was found |
| 403 | `SCOPE_DENIED` | The API key does not have the `sale` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

For the full list of common API errors, see [Errors](/docs/errors).

## See also

- [Payment fields](./fields.md)
- [Update a payment](./update.md)
- [Delete a payment](./delete.md)
- [List payments](./list.md)
- [Order](../orders/get.md)
- [Limits and optimization](/docs/optimization)
