# Self-employed
Sandbox mode is used for testing. To connect, contact Support Service (opens new window).
To obtain a certain check status, you must use one of two test TINs:
| Parameter | Description |
|---|---|
185796979287 | status is setSUCCESSwhen registering a check. |
058104954632 | status is setFAILEDwhen registering a check. |
# Connecting a self-employed person
Request parameters:
| Parameter | Obligation | Description |
|---|---|---|
inn | Yes | Individual taxpayer identification number. |
callback_url | Yes | The URL to which the response will be sent. |
is_sandbox | Yes | Test mode parameter:true;1;да;yes |
Query example:
curl --request POST \
--url https://api.psp.io/self-employed/v1/tin/bind \
--header 'MID: 1234' \
--header 'Authorization: Bearer Nwii9xFAfHjAWkk6PPOFUmpheFe123' \
--data '{
"is_sandbox": true,
"inn": "185796979287",
"callback_url": "https://webhook.site/28b30c34-9fbd-4e98-b1b7-e20a999d530b"
}'
If successful, the response will include:
id: unique request identifier. -inn: Linked taxpayer identification number.
Synchronous response:
{
"id": "3ab4e73d-a197-4a2f-9b92-69ef07468b04",
"inn": "185796979287"
}
```**Callback:**
::: warning PLEASE ATTENTION!
You must provide the url in advance to send callbacks to Mandarin!
:::
```json
{
"id": "80cf6b02-795f-486f-a515-562a41a87429",
"inn": "185796979287",
"status": 0,
"message": null
}
```**Callback parameters:**
| Parameter | Type | Description |
|---|---|---|
| id | uuid | Request ID |
| inn | string | TIN |
| status | integer | Status of response from SMZ, possible options:<br>0 - success;<br>1 - completed with an error;<br>8 - period of permanent request to the Federal Tax Service has expired;<br>408 - timeout error (long wait for a response from the Federal Tax Service) |
| message | string | Error text for statuses: 1, 8, 408 |
## Checking self-employed status
When calling the [check status](https://docs.mandarin.io/public/api_self-employed.html#%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-%D1%81%D1%82%D0%B0%D1%82%D1%83%D1%81%D0%B0) self-employed, you need to pass parameters to the querystring with the results you want to get:
| Query Params | Value | Description |
|--------------|--------------------------|--------------------------------------------------------------------------------|
| is_sandbox | true;<br>1;<br>yes;<br>yes | Test mode parameter, you can use any of the listed values |
| state | ACTIVE;<br>NOT_SELF_EMPLOYEE | SMZ status, you can specify any of [this list](https://docs.mandarin.io/public/api_self-employed.html#%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA-%D1%81%D1%82%D0%B0%D1%82%D1%83%D1%81%D0%BE%D0%B2) |
**Query example:**
```bash
curl --request GET \
--url https://api.psp.io/self-employed/v1/tin/185796979287?is_sandbox=true&state=ACTIVE \
--header 'MID: 1234' \
--header 'Authorization: Bearer Nwii9xFAfHjAWkk6PPOFUmpheFe123'
Example answer:
{
"id": "test-d4dc85c1-765a-4865-bea6-01b215a333ed",
"inn": "185796979287",
"status": "ACTIVE"
}
# Generating a test receipt
Request parameters:
| Parameter | Obligation | Description |
|---|---|---|
inn | Yes | The TIN (Taxpayer Identification Number) associated with the check. |
цена | Yes | Price of goods/services |
title | Yes | Name of product/service in the receipt |
is_sandbox | Yes | Test mode parameter:true;1;да;yes |
Query example:
curl --request POST \
--url https://api.psp.io/self-employed/v1/receipts \
--header 'MID: 1234' \
--header 'Authorization: Bearer Nwii9xFAfHjAWkk6PPOFUmpheFe123' \
--data '{
"is_sandbox": true,
"inn": "185796979287",
"price": 100,
"title": "Оплата заказа №1234"
}'
Synchronous response with test TIN 185796979287:
{
"cheque_id": "20172zyc8z",
"inn": "185796979287",
"message": "",
"session_id": "edccadd7-e5f9-4de2-8088-64e6adf0959b",
"status": "success",
"url": "https://lknpd.nalog.ru/api/v1/receipt/623406197779/20172zyc8z/print",
"title": "Оплата заказа №1234"
}
Synchronous response with test TIN 058104954632:
{
"cheque_id": null,
"inn": "058104954632",
"message": "Inactive TIN 058104954632 failed/ACTIVE",
"session_id": "edccadd7-e5f9-4de2-8088-64e6adf0959b",
"status": "failed",
"url": null,
"title": "Оплата заказа №1234"
}
Response options:
cheque_id- unique identifier of the created check. -inn- TIN associated with the check. -message- additional information or error message. -session_id- id of the created check. -status- request status, see list of statuses below. -url- URL for printing the created receipt. -title- Name of product/service specified in the request.
List of statuses:
| Status | Description |
|---|---|
| success | The check was successfully created |
| failed | Failed to create check. The details of the error can be checked in the response received (message). |
← Mandarin.ID BaaS →