
## Get a payment

`GET /v1/payments/:id`

Returns a single payment by identifier with all fields.

## Parameters

| Parameter | Type | Req. | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Payment identifier |

## 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 |
|------|-----|---------|
| `id` | number | Payment identifier |
| `accountNumber` | string | Sequential payment number within the Bitrix24 account |
| `orderId` | number | Order identifier |
| `paySystemId` | number | Payment system identifier |
| `paySystemName` | string | Payment system name |
| `paySystemIsCash` | boolean | Whether the payment system accepts cash (read-only) |
| `paySystemXmlId` | string | External identifier of the payment system (read-only) |
| `sum` | number | Payment amount |
| `currency` | string | Payment currency |
| `paid` | boolean | Whether the payment is marked as received |
| `datePaid` | datetime \| null | Date the payment was marked as received. `null` if the payment is not marked |
| `dateBill` | datetime | Invoice issue date |
| `datePayBefore` | datetime \| null | Payment due date — date only. In the response the time is always midnight in the Bitrix24 account timezone and carries no separate meaning. `null` if not set |
| `dateMarked` | datetime \| null | Date the payment was flagged as problematic (read-only). `null` if there is no flag |
| `dateResponsibleId` | datetime \| null | Date the responsible employee was assigned (read-only). `null` if no responsible employee is assigned |
| `responsibleId` | number \| null | Responsible employee. `null` if not assigned |
| `comments` | string \| null | Payment comment. `null` if not set |
| `xmlId` | string | External identifier |
| `isReturn` | string | Return flag: `"N"` regular payment, `"Y"` return, `"P"` partial return |
| `marked` | boolean | Whether the payment is flagged as problematic |
| `reasonMarked` | string \| null | Reason for the flag. `null` if there is no flag |
| `empPaidId` | number \| null | Employee who marked the payment (read-only) |
| `empResponsibleId` | number \| null | Employee responsible for the payment (read-only) |
| `empMarkedId` | number \| null | Employee who set the flag (read-only) |
| `empReturnId` | number \| null | Employee who processed the return (read-only) |
| `psStatus` | string \| null | Payment status according to the payment system. `null` if the payment did not go through a payment system |
| `psStatusCode` | string \| null | Status code from the payment system |
| `psStatusDescription` | string \| null | Status description from the payment system |
| `psStatusMessage` | string \| null | Message from the payment system |
| `psSum` | number \| null | Payment amount according to the payment gateway |
| `psCurrency` | string \| null | Payment currency according to the payment gateway |
| `psResponseDate` | datetime \| null | Payment gateway response date |
| `psInvoiceId` | string \| null | Invoice identifier on the payment gateway side |
| `payVoucherNum` | string \| null | Payment voucher number. `null` if there is no payment voucher |
| `payVoucherDate` | datetime \| null | Payment voucher date. `null` if there is no payment voucher |
| `payReturnNum` | string \| null | Return document number. `null` if there was no return |
| `payReturnDate` | datetime \| null | Return date. `null` if there was no return |
| `payReturnComment` | string \| null | Return comment. `null` if there was no return |
| `priceCod` | number | Cash-on-delivery amount. `0` if no cash-on-delivery is set |
| `companyId` | number \| null | Paying company from CRM. `null` if not set |
| `externalPayment` | boolean | Payment created in an external system |
| `id1c` | string \| null | Payment identifier in the ERP. `null` if the payment is not synchronized with the ERP |
| `version1c` | string \| null | Payment version in the ERP. `null` if the payment is not synchronized with the ERP |
| `updated1c` | boolean | Whether the payment was updated via the ERP |

Full list of fields with links to identifier sources — [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

422 — payment not found:

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

## Errors

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

Full list of common API errors — [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)
