> ## Documentation Index
> Fetch the complete documentation index at: https://beta-developers.mizaniyapay.dz/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /set-qr-config: Attach Amount Configuration to QR Code

> Attach one or more DZD payment amounts to a static Mizaniya Pay QR code, with optional expiry and single-use settings.

Use the `/set-qr-config` endpoint to associate one or more Algerian Dinar (DZD) amounts with a static QR code. If you call this endpoint again with the same `token`, the previous configuration is replaced entirely. When multiple amounts are configured, the customer selects one on the payment platform. When a single amount is configured, the platform skips selection and displays that amount directly.

## Request

**Method:** `POST`<br />**URL:** `{api_base_url}/set-qr-config`<br />**Headers:**

| Header         | Value              |
| -------------- | ------------------ |
| `Content-Type` | `application/json` |
| `x-api-key`    | `<your_api_key>`   |

Your `api_base_url` and API key are both retrieved from the Mizaniya Partner Platform.

### Body parameters

<ParamField body="token" type="string" required>
  The QR code identifier retrieved from the Partner Platform.
</ParamField>

<ParamField body="amounts" type="number[]" required>
  An array of DZD amounts. Supply a single amount to skip the customer selection step. Must contain at least one positive number.
</ParamField>

<ParamField body="expiresAt" type="string | null">
  An ISO 8601 timestamp indicating when the configuration expires. Pass `null` or omit for a permanent configuration.
</ParamField>

<ParamField body="singleUse" type="boolean" required>
  When `true`, the configuration is automatically cleared after the first successful payment.
</ParamField>

## Code examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "{api_base_url}/set-qr-config" \
    -H "Content-Type: application/json" \
    -H "x-api-key: <your_api_key>" \
    -d '{
      "token": "8f2c1a52-9be4-4d0e-b1a7-3f65c02a9e11",
      "amounts": [1000, 2000, 3000],
      "expiresAt": "2026-08-01T00:00:00.000Z",
      "singleUse": false
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(`${apiBaseUrl}/set-qr-config`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': apiKey,
    },
    body: JSON.stringify({
      token: '8f2c1a52-9be4-4d0e-b1a7-3f65c02a9e11',
      amounts: [1000, 2000, 3000],
      expiresAt: '2026-08-01T00:00:00.000Z',
      singleUse: false,
    }),
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = f"{api_base_url}/set-qr-config"
  headers = {
      "Content-Type": "application/json",
      "x-api-key": api_key,
  }
  payload = {
      "token": "8f2c1a52-9be4-4d0e-b1a7-3f65c02a9e11",
      "amounts": [1000, 2000, 3000],
      "expiresAt": "2026-08-01T00:00:00.000Z",
      "singleUse": False,
  }

  response = requests.post(url, headers=headers, json=payload)
  print(response.status_code)
  print(response.json())
  ```
</CodeGroup>

## Responses

### 200 — Success

```json theme={null}
{
  "statusCode": 200,
  "message": "QR configuration set successfully"
}
```

### 400 — Bad Request

```json theme={null}
{
  "statusCode": 400,
  "message": [
    "token must be a string",
    "amounts must contain at least 1 elements",
    "expiresAt must be a valid ISO 8601 date string",
    "singleUse must be a boolean value"
  ],
  "error": "Bad Request"
}
```

### 401 — Unauthorized

```json theme={null}
{
  "statusCode": 401,
  "message": "Unauthorized",
  "errorCode": "AUTH401_UNAUTHORIZED_ACCESS",
  "timestamp": "2026-07-13T09:00:00.000Z"
}
```

### 404 — QR Code Not Found

```json theme={null}
{
  "statusCode": 404,
  "message": "QR code not found",
  "errorCode": "QR_CODE404_NOT_FOUND",
  "timestamp": "2026-07-13T09:00:00.000Z",
  "details": {
    "token": "8f2c1a52-9be4-4d0e-b1a7-3f65c02a9e11"
  }
}
```

<Note>
  Always branch your error handling on the `errorCode` field, not the `message` string. Message wording may change between API versions.
</Note>
