# Payment statuses This method returns the **current status** of a **bank card** payment by the identifier from the initialization response (`order_id`) or by your `user_data` if `order_id` was not saved. Use it to poll status after [creating a payment via form](./init-form.md) or [host2host (GATE)](./host2host.md), and when callback delivery fails. ## How it works 1. **Identification** — in the request, specify `order_id` (from the `init_form` / `init_payment` response) **or** `user_data` (order ID on your side). 2. **Request** — the server sends a signed request to the `status_payment` endpoint. 3. **Response** — the API returns JSON with the current `status`, amounts, masked card number, and if needed fields for 3-D Secure (`redirect_url`, `3ds_url`, `pa_req`, `creq`, `md`). Interpretation of `status` and `status_description` codes — see [Transaction statuses](../transaction-statuses.md). ## Technical information | | | | --- | --- | | **Endpoint** | `https://api.1payment.com/status_payment` | | **Methods** | `GET`, `POST` | | **Response format** | JSON | | **Payment type in response** | For cards, `payment_type` equals `card` | ## Request parameters ### Required | Parameter | Type | Description | | --- | --- | --- | | `partner_id` | Integer | Your unique ID in the 1Payment system. | | `project_id` | Integer | Your project identifier. | | `sign` | String | Request signature (see the "Signature" section). | ### Payment identification Pass **one** of the following parameters: | Parameter | Type | Description | | --- | --- | --- | | `order_id` | String | Payment ID in 1Payment (from the initialization response). | | `user_data` | String | Your order ID; used if `order_id` is not specified. | ## Signature generation (`sign`) Signature: MD5, lowercase (hex). General rules — [API request format](../init-request.md#подпись-запроса-sign). **Formula:** ```text MD5(status_payment + <параметры_без_sign_в_алфавитном_порядке_через_&> + ) ``` **Example string before hashing** (lookup by `order_id`): ```text status_paymentorder_id=8p3brmb19gfg0sg8gcwhws8kgc748s87&partner_id=1234&project_id=5678secret_key ``` ### Signature verification in the documentation {% signatureVerifier method="status_payment" preset="status_payment" /%} ## Request examples {% codeTabs %} {% tab label="Node.js" %} ```javascript const crypto = require('crypto'); const axios = require('axios'); async function getCardPaymentStatus(apiKey, params) { const sortedKeys = Object.keys(params).sort(); const queryString = sortedKeys.map((key) => `${key}=${params[key]}`).join('&'); const baseString = `status_payment${queryString}${apiKey}`; params.sign = crypto.createHash('md5').update(baseString).digest('hex'); const response = await axios.get('https://api.1payment.com/status_payment', { params }); return response.data; } const apiKey = process.env.ONEPAYMENT_API_KEY; const data = { partner_id: 1234, project_id: 5678, order_id: '8p3brmb19gfg0sg8gcwhws8kgc748s87', }; getCardPaymentStatus(apiKey, data).then(console.log); ``` {% /tab %} {% tab label="Python" %} ```python import hashlib import os import requests def get_card_payment_status(api_key: str, params: dict) -> dict: sorted_keys = sorted(params.keys()) query_string = "&".join(f"{k}={params[k]}" for k in sorted_keys) base_string = f"status_payment{query_string}{api_key}" params["sign"] = hashlib.md5(base_string.encode("utf-8")).hexdigest() response = requests.get("https://api.1payment.com/status_payment", params=params) response.raise_for_status() return response.json() api_key = os.environ["ONEPAYMENT_API_KEY"] data = { "partner_id": 1234, "project_id": 5678, "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87", } print(get_card_payment_status(api_key, data)) ``` {% /tab %} {% tab label="PHP" %} ```php $v) { if ($k === 'sign') { continue; } $tail .= "{$k}={$v}&"; } $tail = substr($tail, 0, -1); // 2. Формирование подписи (префикс status_payment) $params['sign'] = md5('status_payment' . $tail . $apiKey); // 3. Запрос к API $url = 'https://api.1payment.com/status_payment?' . http_build_query($params); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $response; } // Пример данных запроса $apiKey = getenv('ONEPAYMENT_API_KEY'); $data = [ 'partner_id' => 1234, 'project_id' => 5678, 'order_id' => '8p3brmb19gfg0sg8gcwhws8kgc748s87', ]; echo getCardPaymentStatus($apiKey, $data); ``` {% /tab %} {% tab label="cURL" %} ```bash # sign = md5("status_payment" + order_id=...&partner_id=1234&project_id=5678 + API_KEY) curl -sS "https://api.1payment.com/status_payment?partner_id=1234&project_id=5678&order_id=8p3brmb19gfg0sg8gcwhws8kgc748s87&sign=PASTE_MD5_HEX" ``` {% /tab %} {% /codeTabs %} ## API response Successful response (`200`): ```json { "payment_type": "card", "project_id": 5678, "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87", "user_data": "order_777", "status": 3, "status_description": "SUCCESS", "init_time": "2026-05-05T18:23:11Z", "status_time": "2026-05-05T18:23:42Z", "merchant_price": 50, "init_price": 50, "user_price": 48.5, "currency": "RUB", "account": "411111******1111", "token": "card_t_1a2b3c" } ``` | Field | Description | | --- | --- | | `payment_type` | Payment type; for cards — `card`. | | `project_id` | Your project ID. | | `order_id` | Payment ID in the 1Payment system. | | `user_data` | Identifier passed when creating the payment. | | `status` | Numeric code: `2` — pending, `3` — success, `4` — declined. | | `status_description` | `PENDING`, `SUCCESS`, or `FAILURE`. | | `init_time` | Payment creation time (UTC). | | `status_time` | Time the current status was received (UTC). | | `merchant_price` | Payment amount for the payer. | | `init_price` | Amount at initialization. | | `user_price` | Partner payout amount. | | `currency` | Payment currency (ISO 4217). | | `account` | Masked card number. | | `status_code` | Decline reason code (when `status` = `4`; see [decline codes](../decline-error-codes.md)). | | `token` | Saved card identifier after successful payment (if enabled; see [subscriptions](./recurring.md)). | | `test` | `1` for test transactions. | ### 3-D Secure fields When status is pending and 3-D Secure is required, the response may include: | Field | Description | | --- | --- | | `redirect_url` | URL to redirect the payer to the bank ACS. | | `3ds_url` | Bank ACS URL for 3-D Secure. | | `pa_req` | Parameter for 3-D Secure **v1.x**. | | `creq` | Parameter for 3-D Secure **v2.x**. | | `md` | 3-D Secure service parameter. | If the response contains `redirect_url` or `3ds_url`, redirect the payer to complete payment (see also [host2host (GATE)](./host2host.md)). Request error (`400`): ```json { "error_code": 2 } ``` ## Related sections - [Create payment via form](./init-form.md) - [Create host2host (GATE) payment](./host2host.md) - [Create subscription payment](./recurring.md) - [Payment refunds](./refund.md) - [Transaction statuses](../transaction-statuses.md) - [Payment types](../payment-types.md) - [Error codes (API)](../error-codes-api.md) - [Error codes (declines)](../decline-error-codes.md)