# Create one-time payment records

Create one-time payment records

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/compensation/v1/lump_sum_payment/batch_create
HTTP Method | POST
Rate Limit | [10 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | Write one-time payment record(corehr:compensation.lump_sum_payment:write)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
user_id_type | string | Yes | User ID categories<br>**Example value**: open_id<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br><md-enum-item key="people_corehr_id" ><br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)

### Request body

Parameter | Type | Required | Description
---|---|---|---
records | lump_sum_payment_for_create\[\] | No | One-time payment information to create<br>**Data validation rules**:<br>- Length range: `0` ～ `500`
unique_id | string | Yes | External unique id, determined by upstream business<br>**Example value**: "7402510801304718380_7309316347007764012_7402523725868058156_1726070400000_10000"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
user_id | string | Yes | Employee id, specified by user_id_type in imported parameter<br>**Example value**: "7337149697626801708"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
total_amount | string | Yes | Total amount<br>**Example value**: "2000.00"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
binding_period | int | Yes | Binding period, in months<br>**Example value**: 2<br>**Data validation rules**:<br>- Value range: `0` ～ `2147483647`
currency_id | string | Yes | Currency id (can be queried through the [【Currency】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/basic_info-currency/search)) interface)<br>**Example value**: "6863329932261459464"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
issuance_frequency | int | Yes | Issuance frequency, must be consistent with the length of the details<br>**Example value**: 3<br>**Data validation rules**:<br>- Value range: `0` ～ `2147483647`
item_id | string | Yes | Bonus item id (can be queried through the [【Compensation component item】](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/compensation-v1/item/list)) interface)<br>**Example value**: "7411039006180312620"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
reference_period_start_date | string | No | Reference Period Start Date<br>**Example value**: "2024-08-01"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
reference_period_end_date | string | No | Reference Period End Date<br>**Example value**: "2024-08-01"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
details | lump_sum_payment_detail_for_create\[\] | Yes | Detail list<br>**Data validation rules**:<br>- Length range: `0` ～ `2147483647`
issuance_amount | string | Yes | Issuance amount<br>**Example value**: "2000.00"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
issuance_status | string | Yes | Issuance status<br>**Example value**: "to_be_issued"<br>**Optional values are**:<br>- to_be_issued：To be issued<br>- not_issued：Not issued<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
issuance_way | string | Yes | Issuance type<br>**Example value**: "with_salary"<br>**Optional values are**:<br>- with_salary：Issued with salary<br>- with_cash：Cash<br>- with_year_end_bonus：Issued with annual bonus
issuance_time | string | Yes | Issuance Date<br>**Example value**: "2024-08-01"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
belong_time | string | Yes | Belong Date<br>**Example value**: "2025-01-20"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
issuance_country_region_id | string | No | Issuance country region id (can be queried through the [Search country/region information<br>](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/basic_info-country_region/search) interface)<br>**Example value**: "6862995757234914824"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
issuance_pay_group_id | string | No | Issuance pay group id (can be queried through the [Search paygroup information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/payroll-v1/paygroup/list) interface)<br>**Example value**: "6862995757234914824"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
detail_reference_period_start_date | string | No | Detail reference period start date<br>**Example value**: "2024-08-01"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
detail_reference_period_end_date | string | No | Detail reference period end date<br>**Example value**: "2024-08-01"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters
remark | string | No | Remark<br>**Example value**: "Remark"<br>**Data validation rules**:<br>- Length range: `0` ～ `3000` characters
binding_period_decimal | string | No | Binding period decimal<br>**Example value**: "12.56"<br>**Data validation rules**:<br>- Length range: `0` ～ `255` characters

### Request body example
```json
{
    "records": [
        {
            "unique_id": "7402510801304718380_7309316347007764012_7402523725868058156_1726070400000_10000",
            "user_id": "7337149697626801708",
            "total_amount": "2000.00",
            "binding_period": 2,
            "currency_id": "6863329932261459464",
            "issuance_frequency": 3,
            "item_id": "7411039006180312620",
            "reference_period_start_date": "2024-08-01",
            "reference_period_end_date": "2024-08-01",
            "details": [
                {
                    "issuance_amount": "2000.00",
                    "issuance_status": "to_be_issued",
                    "issuance_way": "with_salary",
                    "issuance_time": "2024-08-01",
                    "belong_time": "2025-01-20",
                    "issuance_country_region_id": "6862995757234914824",
                    "issuance_pay_group_id": "6862995757234914824",
                    "detail_reference_period_start_date": "2024-08-01",
                    "detail_reference_period_end_date": "2024-08-01"
                }
            ],
            "remark": "Remark",
            "binding_period_decimal": "12.56"
        }
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
operate_results | lump_sum_payment_operate_result\[\] | The result of the operation for each record. For successfully created records, the created one-time payment record id will be returned
id | string | The ID of the record of the operation
unique_id | string | The unique id of the record of the operation
code | int | Operation result status code<br>**Optional values are**:<br>- 0：Operation successful<br>- 21270201：The record to be changed does not exist<br>- 21270202：Unique id conflict<br>- 21270203：The total amount format is incorrect<br>- 21270205：Only use the number of decimal places specified in the bonus item rules<br>- 21270206：The sum of the bonus detail issuance amount is not equal to the total amount<br>- 21270207：The total number of bonus details is not equal to the number of issuance frequency<br>- 21270208：Issuance frequency less than or equal to 0<br>- 21270209：The currency is empty or does not exist<br>- 21270210：Remarks are too long<br>- 21270211：The format of the issuance amounts is incorrect<br>- 21270213：The issuance date format of the bonus details is incorrect<br>- 21270214：The issuance type is illegal<br>- 21270215：The issuance status is illegal<br>- 21270217：Employees are not covered by the bonus rules<br>- 21270218：The issuance type is not within the scope of the bonus item rules<br>- 21270219：Bonus item rules do not support configuring the binding period<br>- 21270220：The issuance status is "issued", and modification is not supported<br>- 21270221：The bonus item rules already specified currency, and other currencies are not supported<br>- 21270222：Bonus item does not exist<br>- 21270223：Employee does not exist<br>- 21270224：The issuance status is "issued", and deletion is not supported.<br>- 21270225：Bonus item rules do not support multiple issuances<br>- 21270226：No permission<br>- 21270227：The binding period only allows positive integers<br>- 21270228：This bonus does not currently support custom binding periods. Please configure and write it in accordance with the salary item binding period rules<br>- 21270229：The application and distribution date shall not be later than the distribution date<br>- 21270230：The application and distribution date format of the bonus details is incorrect<br>- 21270070：The binding period and the ownership period start and end dates do not match<br>- 21270239：One time payment detail reference period start date and One time payment detail reference period end date shall be filled in or left blank at the same time. Please confirm<br>- 21270240：One time payment detail reference period start date must be earlier than or equal to One time payment detail reference period end date. Please confirm<br>- 21270241：One time payment detail reference period must fall within the scope of One time payment record reference period. Please adjust
message | string | Operation result description

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "operate_results": [
            {
                "id": "7390583861280556588",
                "unique_id": "7390583861280556588",
                "code": 21270202,
                "message": "uqniue id conflict"
            }
        ]
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 2290001 | param is invalid | Parameter error
500 | 2290002 | server error | Server error

