> ## Documentation Index
> Fetch the complete documentation index at: https://gateway.wasmou.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Products

> Licence keys, subscriptions and gift cards: browse, buy, retrieve codes.

General product catalog: licence keys, gift cards, subscriptions and more.

> [!TIP]
>
> For a full mirror of the catalog (with delivery mode and stock) use [`GET /api/catalog`](https://gateway.wasmou.net/services/catalog). The endpoints below are the lighter, per-product calls.

## 1. Get all products

Get all available products with their variants.

**Endpoint:** `GET /api/products`

```json Response theme={"dark"}
{
  "status": "success",
  "message": "Products retrieved",
  "data": [
    {
      "id": 1,
      "name": "Steam Wallet",
      "description": "Steam wallet codes",
      "image_product": "https://example.com/image.jpg",
      "category_id": 5,
      "is_active": true,
      "requires_input": false,
      "variants": [
        {
          "id": 10,
          "name": "Steam Wallet 10 USD",
          "price": 1425.00,
          "is_available": true,
          "input_fields": []
        }
      ]
    }
  ]
}
```

## 2. Get product variants

**Endpoint:** `GET /api/products/{productId}/variants`

```json Response theme={"dark"}
{
  "status": "success",
  "message": "Variants retrieved",
  "data": [
    {
      "id": 10,
      "name": "Steam Wallet 10 USD",
      "price": 1425.00,
      "is_available": true,
      "input_fields": []
    }
  ]
}
```

Variants where you hold a stock allocation also contain a `client_stock` object ([details](https://gateway.wasmou.net/concepts/stock.md)).

## 3. Purchase a product

**Endpoint:** `POST /api/products/purchase/{variantId}`

| Body field | Type | Description |
| - | - | - |
| `quantity` | integer, required | 1 to 50. |
| `key_id` | integer, optional | A specific key to buy. If omitted, one is assigned for you. |
| *input fields* | varies | Whatever `input_fields` lists for the product. |

**Basic request** (no inputs required):

```json theme={"dark"}
{ "quantity": 1 }
```

**With product inputs** (when `requires_input` is `true`):

```json theme={"dark"}
{
  "quantity": 1,
  "account_email": "user@example.com",
  "account_password": "password123"
}
```

```json Response theme={"dark"}
{
  "status": "success",
  "message": "Purchase successful",
  "data": {
    "order_ids": ["1234567890123456789"],
    "count": 1
  }
}
```

> [!WARNING]
>
> Save `order_ids` **before** doing anything else. They are the only way to retrieve the code later.

Your wallet is debited and, for allocated variants, your stock is consumed in the same transaction. If anything fails, nothing is charged.

## 4. Retrieve order keys

### Single order

**Endpoint:** `GET /api/products/order/{orderId}`

```json Response theme={"dark"}
{
  "status": "success",
  "message": "Order details retrieved",
  "data": {
    "order_id": "1234567890123456789",
    "product_name": "Steam Wallet",
    "variant_name": "Steam Wallet 10 USD",
    "status": "completed",
    "key": "ABC123-DEF456-GHI789",
    "has_key": true,
    "price": 1425.00,
    "created_at": "2026-10-04T10:30:00.000000Z",
    "purchase_timestamp": null
  }
}
```

### Multiple orders

**Endpoint:** `POST /api/products/orders/retrieve`

```json Request theme={"dark"}
{
  "order_ids": ["1234567890123456789", "1234567890123456790"]
}
```

The response is an array of order objects in the same format as a single order.

### Status values

| Status | Meaning |
| - | - |
| `processing` | Accepted, waiting for fulfilment. |
| `completed` | Fulfilled; the key is available when the product has one. |
| `delivered` | Delivered. Treat it like `completed`. |
| `failed` | Could not be fulfilled; refunded. |
| `refunded` | Refunded. |
| `canceled` | Canceled; refunded. |

If `has_key` is `false`, poll the endpoint until the key becomes available.

## Example workflow

```bash theme={"dark"}
# 1. Get all products
curl -X GET "https://api.wasmou.net/api/products" -H "X-Api-Key: your_api_key"

# 2. Get variants for product 1
curl -X GET "https://api.wasmou.net/api/products/1/variants" -H "X-Api-Key: your_api_key"

# 3. Purchase variant 10
curl -X POST "https://api.wasmou.net/api/products/purchase/10" \
  -H "X-Api-Key: your_api_key" -H "Content-Type: application/json" \
  -d '{"quantity": 1}'

# 4. Retrieve the order key
curl -X GET "https://api.wasmou.net/api/products/order/1234567890123456789" \
  -H "X-Api-Key: your_api_key"

# 5. Retrieve several orders
curl -X POST "https://api.wasmou.net/api/products/orders/retrieve" \
  -H "X-Api-Key: your_api_key" -H "Content-Type: application/json" \
  -d '{"order_ids": ["1234567890123456789", "1234567890123456790"]}'
```

## Input fields

Some products need extra data, for example game account details. Read the `input_fields` of the variant (or product in the catalog) and send those fields in the purchase body. Missing or invalid fields return a [validation error](https://gateway.wasmou.net/errors.md#validation-errors).

## Best practices

* Read `delivery` and `available` first ([delivery modes](https://gateway.wasmou.net/concepts/delivery.md)).
* Check `available_balance` before large batches.
* Poll `orders/retrieve` for `processing` orders and stop when the status is final.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.