# Transaction Reset (RAZ)

RAZ (Remise A Zero) endpoints manage the periodic reset of customer transaction balances. This is commonly used in collective catering to reset e-wallet spending at the end of a billing period.

### `PUT /brands/{brandId}/reset_transactions` - Reset Brand Transactions

Schedule a reset of all customer transactions for a brand. This creates a Cloud Task that processes the reset asynchronously.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Request Body

```json
{
  "endDate": "2025-09-30T23:59:59.000Z",
  "includeArchivedCustomers": false,
  "includeDisabledCustomers": false,
  "isAutoRaz": false
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Required | Example | Description |
| --- | --- | --- | --- | --- |
| endDate | string (ISO 8601 date-time) | Yes | "2025-09-30T23:59:59.000Z" | Last transaction date included in the reset. |
| includeArchivedCustomers | boolean | Yes | false | Whether archived customers are included in the reset. |
| includeDisabledCustomers | boolean | Yes | false | Whether disabled customers are included in the reset. |
| isAutoRaz | boolean | No | false | Marks the reset as an automatic RAZ when true. |

#### Response

```json
{
  "status": 200,
  "code": "reset_brand_transaction",
  "message": "The transactions for this brand have been reset"
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "reset\_brand\_transaction" | Machine-readable application code for the result. |
| message | string | "The transactions for this brand have been reset" | Human-readable result message. Do not use this value for program logic. |

### `PUT /brands/{brandId}/reset_transactions/execute` - Execute Brand Transaction Reset

Performs the brand-wide reset immediately. It accepts the same payload as the scheduling endpoint. customerId is accepted as a query parameter by validation but is not used by the current execution handler.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The brand whose transactions are reset. |
| customerId | integer | No | Accepted query parameter; the current handler does not use it to limit the reset. |

#### Request Body

```json
{
  "endDate": "2025-09-30T23:59:59.000Z",
  "includeArchivedCustomers": false,
  "includeDisabledCustomers": false,
  "isAutoRaz": false
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Required | Example | Description |
| --- | --- | --- | --- | --- |
| endDate | string (ISO 8601 date-time) | Yes | "2025-09-30T23:59:59.000Z" | Last transaction date included in the reset. |
| includeArchivedCustomers | boolean | Yes | false | Whether archived customers are included in the reset. |
| includeDisabledCustomers | boolean | Yes | false | Whether disabled customers are included in the reset. |
| isAutoRaz | boolean | No | false | Marks the reset as an automatic RAZ when true. |

#### Response

```json
{
  "status": 200,
  "code": "reset_brand_transaction",
  "message": "The transactions for this brand have been reset"
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "reset\_brand\_transaction" | Machine-readable application code for the result. |
| message | string | "The transactions for this brand have been reset" | Human-readable result message. Do not use this value for program logic. |

### `PUT /brands/{brandId}/{customerId}/reset_transactions` - Reset Transactions for Single Customer

Reset transactions for a specific customer within a brand.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |
| customerId | integer | Yes | The unique identifier of the customer. |

#### Request Body

```json
{
  "endDate": "2025-09-30T23:59:59.000Z",
  "isAutoRaz": false
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| endDate | string | "2025-09-30T23:59:59.000Z" | Date or timestamp for end. |
| isAutoRaz | boolean | false | Whether auto raz is enabled or applies. |

#### Response

```json
{
  "status": 200,
  "code": "reset_brand_transaction",
  "message": "Customer transaction reset completed."
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "reset\_brand\_transaction" | Machine-readable application code for the result. |
| message | string | "Customer transaction reset completed." | Human-readable result message. Do not use this value for program logic. |

### `GET /brands/{brandId}/last_raz` - Get Last RAZ

Retrieve the details of the last transaction reset performed for a brand.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Response

```json
{
  "status": 200,
  "code": "last_raz",
  "message": "The last raz is",
  "data": {
    "razId": 42,
    "brandId": 100,
    "endDate": "2025-09-30T23:59:59.000Z",
    "isAutoRaz": false,
    "created_at": "2025-10-01T08:00:00.000Z"
  }
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "last\_raz" | Machine-readable application code for the result. |
| message | string | "The last raz is" | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
| data.razId | integer | 42 | Identifier of the associated raz. |
| data.brandId | integer | 100 | Identifier of the brand. |
| data.endDate | string | "2025-09-30T23:59:59.000Z" | Date or timestamp for end. |
| data.isAutoRaz | boolean | false | Whether auto raz is enabled or applies. |
| data.created\_at | string | "2025-10-01T08:00:00.000Z" | Timestamp when this resource was created. |

### `DELETE /brands/{brandId}/rollback_last_raz` - Rollback Last RAZ

Undo the last transaction reset for a brand, restoring customer balances to their pre-reset state.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Response

```json
{
  "status": 200,
  "code": "rollback_last_raz",
  "message": "Last RAZ has been rolled back."
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "rollback\_last\_raz" | Machine-readable application code for the result. |
| message | string | "Last RAZ has been rolled back." | Human-readable result message. Do not use this value for program logic. |

### `POST /brands/{brandId}/auto_raz` - Create Auto RAZ Schedule

Schedule an automatic recurring transaction reset for a brand.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Request Body

```json
{
  "applyDate": "2025-10-31T23:59:59.000Z"
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| applyDate | string | "2025-10-31T23:59:59.000Z" | Date or timestamp for apply. |

#### Response

```json
{
  "status": 201,
  "code": "auto_raz_job_created",
  "message": "The auto raz job for the given brand has been created"
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 201 | HTTP status code returned by the API. |
| code | string | "auto\_raz\_job\_created" | Machine-readable application code for the result. |
| message | string | "The auto raz job for the given brand has been created" | Human-readable result message. Do not use this value for program logic. |

### `GET /brands/{brandId}/auto_raz` - Get Auto RAZ Schedule

Retrieve the current auto RAZ schedule for a brand.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Response

```json
{
  "status": 200,
  "code": "auto_raz_job",
  "message": "The auto raz job for the given brand is",
  "data": {
    "brandId": 100,
    "applyDate": "2025-10-31T23:59:59.000Z",
    "isActive": true
  }
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "auto\_raz\_job" | Machine-readable application code for the result. |
| message | string | "The auto raz job for the given brand is" | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
| data.brandId | integer | 100 | Identifier of the brand. |
| data.applyDate | string | "2025-10-31T23:59:59.000Z" | Date or timestamp for apply. |
| data.isActive | boolean | true | Whether this resource is active. |

### `DELETE /brands/{brandId}/auto_raz` - Delete Auto RAZ Schedule

Remove the automatic recurring transaction reset schedule for a brand.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Response

```json
{
  "status": 200,
  "code": "auto_raz_job_deleted",
  "message": "Auto RAZ job deleted."
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "auto\_raz\_job\_deleted" | Machine-readable application code for the result. |
| message | string | "Auto RAZ job deleted." | Human-readable result message. Do not use this value for program logic. |

### RAZ Contact Emails

Manage the contact email addresses that receive notifications when a RAZ (transaction reset) is performed.

### `POST /brands/{brandId}/raz_contact_email` - Set RAZ Contact Emails

Set the list of email addresses to notify when a RAZ is performed.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Request Body

```json
{
  "emails": [
    "admin@restaurant.com",
    "finance@restaurant.com"
  ]
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| emails | array | \[…\] | List of emails entries. |
| emails\[\] | string | "admin@restaurant.com" | The emails value. |

#### Response

```json
{
  "status": 200,
  "code": "raz_contact_email_created",
  "message": "RAZ contact emails saved."
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "raz\_contact\_email\_created" | Machine-readable application code for the result. |
| message | string | "RAZ contact emails saved." | Human-readable result message. Do not use this value for program logic. |

### `GET /brands/{brandId}/raz_contact_email` - Get RAZ Contact Emails

Retrieve the list of email addresses configured to receive RAZ notifications.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Response

```json
{
  "status": 200,
  "code": "raz_contact_email",
  "message": "Contact email for raz have been found",
  "data": [
    "admin@restaurant.com",
    "finance@restaurant.com"
  ]
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "raz\_contact\_email" | Machine-readable application code for the result. |
| message | string | "Contact email for raz have been found" | Human-readable result message. Do not use this value for program logic. |
| data | array | \[…\] | Endpoint-specific response payload. |
| data\[\] | string | "admin@restaurant.com" | Endpoint-specific response payload. |

### `POST /brands/{brandId}/raz_send_email` - Send RAZ Notification Email

Manually trigger sending a RAZ notification email to the configured contact addresses.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| brandId | integer | Yes | The unique identifier of the brand. |

#### Request Body

```json
{
  "razAmount": 15000,
  "applyDate": "2025-09-30T23:59:59.000Z"
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| razAmount | integer | 15000 | The raz amount value. |
| applyDate | string | "2025-09-30T23:59:59.000Z" | Date or timestamp for apply. |

#### Response

```json
{
  "status": 200,
  "code": "raz_contact_email",
  "message": "RAZ email sent."
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "raz\_contact\_email" | Machine-readable application code for the result. |
| message | string | "RAZ email sent." | Human-readable result message. Do not use this value for program logic. |
