# Routes

## 🚏 Webstore Routes

This section outlines all HTTP routes supported by the webstore, including the associated template, method, and query parameters for each.

***

### 🏠 Home

**Route:** `GET /`\
**Template:** `index.html`

Displays the main homepage of the webstore.

***

### 🛍 Products

#### 🔎 List Products

**Route:** `GET /products`\
**Template:** `category.html`

| Query Parameter | Type      | Description                                            |
| --------------- | --------- | ------------------------------------------------------ |
| `tags`          | string\[] | Optional. Comma-separated tag slugs to filter products |

***

#### 📄 View Product

**Route:** `GET /products/{product.slug}`\
**Template:** `product.html`

Displays product detail page based on the provided slug.

***

#### 💳 Checkout Product

**Route:** `POST /products/{product.slug}/checkout`

| Query Parameter | Type    | Description                                                 |
| --------------- | ------- | ----------------------------------------------------------- |
| `cart`          | boolean | Optional. Adds to cart if true                              |
| `subscription`  | boolean | Optional. Adds as a subscription                            |
| `trial`         | boolean | Optional.  Adds as a trial. Subscription must also be true. |
| `quantity`      | int     | Optional. Product quantity (default: 1)                     |
| `gift_to`       | string  | Optional. Recipient’s platform ID                           |
| `gift_platform` | string  | Optional. Gifting platform (default: `"steam"`)             |
| `gameserver_id` | string  | Optional. ID of selected gameserver                         |

***

### 🛒 Cart

#### 🧾 View Cart

**Route:** `GET /cart`\
**Template:** `cart.html`

***

#### ➕ Add to Cart

**Route:** `POST /cart/add/{product.slug}`

| Query Parameter    | Type    | Description                                                            |
| ------------------ | ------- | ---------------------------------------------------------------------- |
| `quantity`         | integer | Optional. Defaults to 1                                                |
| `gameserver_id`    | string  | Optional. Selected gameserver ID                                       |
| `custom_variables` | object  | Optional.  Object containing custom key-value pairs for the cart line. |
| `subscription`     | boolean | Optional. Adds as a subscription.                                      |
| `trial`            | boolean | Optional.  Adds as a trial. Subscription must also be true.            |

***

#### ✏️ Set Cart Line

**Route:** `POST /cart/set/{product.slug}`

| Query Parameter    | Type    | Description                                                            |
| ------------------ | ------- | ---------------------------------------------------------------------- |
| `quantity`         | integer | Optional. New quantity (default: 1)                                    |
| `gameserver_id`    | string  | Optional. Selected gameserver ID                                       |
| `custom_variables` | object  | Optional.  Object containing custom key-value pairs for the cart line. |
| `subscription`     | boolean | Optional. Edits as a subscription.                                     |
| `trial`            | boolean | Optional.  Edits as a trial. Subscription must also be true.           |

> **Note:** This route is also used to **remove from cart** by setting quantity to `0`.

***

#### 🗑 Empty Cart

**Route:** `POST /cart/empty`

Clears all items from the customer's cart.

***

#### ✅ Checkout Cart

**Route:** `POST /cart/checkout`

| Query Parameter | Type   | Description                           |
| --------------- | ------ | ------------------------------------- |
| `return_url`    | string | Optional. Redirect URL after checkout |

***

### 👤 Authentication

#### 🔐 Sign In

**Route:** `POST /auth/sign-in`

| Query Parameter | Type   | Description                           |
| --------------- | ------ | ------------------------------------- |
| `return_url`    | string | Optional. URL to redirect after login |

***

#### 🔓 Sign Out

**Route:** `POST /auth/sign-out`

Signs out the currently logged-in user.

***

### 🔁 Subscriptions

#### 📋 View Subscriptions

**Route:** `GET /subscriptions`\
**Template:** `subscriptions.html`

***

#### ❌ Cancel Subscription

**Route:** `POST /subscriptions/{subscription.id}/cancel`

Cancels the specified subscription.

***

### 🎉 Checkout Complete

**Route:** `GET /complete`\
**Template:** `complete.html`

Displays a confirmation message after a successful transaction.

***

### 📜 Legal Pages

| Page             | Route                         |
| ---------------- | ----------------------------- |
| Terms of Service | `GET /legal/terms-of-service` |
| User Agreement   | `GET /legal/user-agreement`   |
| Privacy Policy   | `GET /legal/privacy`          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paynow.gg/hosted-webstores/routes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
