[POST] .../v1/retailcard/add
Creates a new customer card. Use this method to create a retail customer card linked to an existing customer, card group, barcode type and loyalty program. The request requires customer_id, barcode_value and barcode_type_id; group_id and promo_id may be supplied explicitly, otherwise server default settings are used and the method returns new_id for the created card. The method checks the current request user and requires customer card add permission; it validates group, customer, promo program, barcode length up to 128 characters, uniqueness of the customer plus promo pair, uniqueness of barcode and whether the promo type allows retail cards and returns validation, permission, duplicate and storage failures as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| barcode_type_id | Int64 | Required | Barcode type ID. |
| barcode_value | String | Required | Barcode. |
| customer_id | Int64 | Required | Customer ID. |
| enabled | Boolean | Optional | Indicates whether the customer card is active: true - active, false - inactive. |
| expiry_date | String | Optional | Card expiration date. |
| group_id | Int64 | Optional | Customer card group ID. |
| promo_id | Int64 | Optional | Promotion ID. |
| unlimited | Boolean | Optional | Indicates whether the card validity period is unlimited: true - unlimited, false - limited. |
Request Example
{
"barcode_type_id": 1,
"barcode_value": "string",
"customer_id": 1,
"enabled": true,
"expiry_date": "string",
"group_id": 1,
"promo_id": 1,
"unlimited": true
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 1
}
}