Клиенты · Предложения · Записи · Использование
customer_offers_record_use
Попробуйте три запроса
- Вы указываетеКлиент
- ПомощникПодготовка
- Вы получаетеПредпросмотр
Подготовь «Клиенты / Предложения / Записи / Использование». Для изменения нужны клиент, offerId. Покажи объект и ожидаемый эффект до выполнения.
- customerId
- Клиент
- offerId
- Параметр
- sourceId
- Параметр
- Вы указываетеСогласованные значения
- ПомощникОдин вызов
- Вы получаетеОтвет операции
На учебной записи подготовь «Клиенты / Предложения / Записи / Использование» с параметром orderType = atplace. Покажи остальные обязательные значения и выполни действие, когда согласованы все поля.
- orderType
- atplace
- customerId
- DEMO-101
- offerId
- DEMO-101
- Вы указываетеИсходный ответ
- ПомощникСверка результата
- Вы получаетеПодтверждение
Проверь результат «Клиенты / Предложения / Записи / Использование» по исходному ответу. Покажи клиент, offerId. Объясни, чем подтвердить эффект для выбранного объекта.
- ЗапросСохранить исходный ключ
- ОтветПроверить статус
- ПроверкаСверить эффект операции
Как работает действие
Этот вызов может изменить рабочие данные. Согласуйте точный объект, новые значения и ожидаемый результат. Присвойте операции стабильный requestId. При повторе той же операции используйте прежний ключ и те же значения.
Описание разработчика
Record one confirmed personal-offer use after the sale succeeds. The caller supplies its stable completed-event sourceId, actual product, eligible quantity, real establishment, native order type, item ID and matching personal promocode when required. This Action does not create, edit, validate or check out an order and does not infer payment success; invoke it only after the existing order lifecycle confirms the sale. The server rechecks current customer/Position access, product, active dates, promo code, positive usageLimit, remainingQuantity and sale context, then atomically increments usageCount once and reduces finite remainingQuantity. A consumed limit changes status to used. Repeating a sourceId cannot double count, even with a new requestId. Use customer_offers_reverse_use when a recorded sale is canceled, failed or corrected.
Параметры запроса
- customerId
- Идентификатор клиента, выбранного по результату поиска. обязательно по схеме · string · до символов 160
- offerId
- Exact users/{customerId}/offers document ID returned by a create or list action. обязательно по схеме · string · до символов 160
- sourceId
- Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once. обязательно по схеме · string · до символов 160
- productId
- Идентификатор найденного товара. обязательно по схеме · string · до символов 160
- quantity
- Confirmed eligible product units consumed from this offer. For unlimited quantity the usage count still advances once. обязательно по схеме · number
- establishment
- Actual existing company establishment of the completed sale. обязательно по схеме · string · до символов 160
- orderType
- Actual native order type of the completed sale. обязательно по схеме · string · варианты atplace, pickup, delivery, catering
- promocode
- Personal activation code used on this completed sale, when the offer requires one. необязательно · string · до символов 100
- itemId
- Exact optional native item or variant ID; empty means the whole product. It cannot be changed after creation. обязательно по схеме · string · по умолчанию "" · до символов 160
- requestId
- Ключ этой операции. Для повтора с теми же аргументами сохраните исходное значение. обязательно по схеме · string · до символов 128
Что вернёт команда
- customerId
- Existing users document ID. The server verifies its company and allowed location. обязательно по схеме · string · до символов 160
- offerId
- Exact users/{customerId}/offers document ID returned by a create or list action. обязательно по схеме · string · до символов 160
- sourceId
- Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once. обязательно по схеме · string · до символов 160
- operation
- Committed usage counter operation. обязательно по схеме · string · варианты record, reverse
- quantity
- Units recorded or returned by this exact operation. обязательно по схеме · number
- usageCount
- Server maintained integer count of completed customer_offers_record_use events. Created as zero; quotes and failed sales do not increment it. Reversed events decrement it. обязательно по схеме · integer · минимум 0 · максимум 9007199254740991
- remainingQuantity
- Server maintained eligible units left when quantity > 0; record_use consumes units and reverse_use restores them. Ignored for unlimited quantity. обязательно по схеме · number / null
- status
- Offer status after the committed counter change. обязательно по схеме · string · варианты active, inactive, expired, used
- at
- Server time when this exact usage operation committed. обязательно по схеме · string
Поля и технические схемы

Вход · JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"customerId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Existing users document ID. The server verifies its company and allowed location."
},
"offerId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Exact users/{customerId}/offers document ID returned by a create or list action."
},
"sourceId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once."
},
"productId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Actual product from the completed sale; must equal the offer product."
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0,
"description": "Confirmed eligible product units consumed from this offer. For unlimited quantity the usage count still advances once."
},
"establishment": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Actual existing company establishment of the completed sale."
},
"orderType": {
"type": "string",
"enum": [
"atplace",
"pickup",
"delivery",
"catering"
],
"description": "Actual native order type of the completed sale."
},
"promocode": {
"description": "Personal activation code used on this completed sale, when the offer requires one.",
"type": "string",
"maxLength": 100
},
"itemId": {
"default": "",
"type": "string",
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]*$",
"description": "Exact optional native item or variant ID; empty means the whole product. It cannot be changed after creation."
},
"requestId": {
"type": "string",
"minLength": 8,
"maxLength": 128,
"pattern": "^[A-Za-z0-9_-]+$",
"description": "Stable ID for exactly this mutation and arguments. Retry the same request after uncertainty."
}
},
"required": [
"customerId",
"offerId",
"sourceId",
"productId",
"quantity",
"establishment",
"orderType",
"itemId",
"requestId"
],
"additionalProperties": false
}Выход · JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"customerId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Existing users document ID. The server verifies its company and allowed location."
},
"offerId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Exact users/{customerId}/offers document ID returned by a create or list action."
},
"sourceId": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"pattern": "^[A-Za-z0-9_~:@+.-]+$",
"description": "Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once."
},
"operation": {
"type": "string",
"enum": [
"record",
"reverse"
],
"description": "Committed usage counter operation."
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0,
"description": "Units recorded or returned by this exact operation."
},
"usageCount": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Server maintained integer count of completed customer_offers_record_use events. Created as zero; quotes and failed sales do not increment it. Reversed events decrement it."
},
"remainingQuantity": {
"anyOf": [
{
"type": "number",
"minimum": 0
},
{
"type": "null"
}
],
"description": "Server maintained eligible units left when quantity > 0; record_use consumes units and reverse_use restores them. Ignored for unlimited quantity."
},
"status": {
"type": "string",
"enum": [
"active",
"inactive",
"expired",
"used"
],
"description": "Offer status after the committed counter change."
},
"at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
"description": "Server time when this exact usage operation committed."
}
},
"required": [
"customerId",
"offerId",
"sourceId",
"operation",
"quantity",
"usageCount",
"remainingQuantity",
"status",
"at"
],
"additionalProperties": false
}