# Access to Buy

## Introduction

“Access to Buy” defines how users enter the secondary market purchase flow.  
While *Access to Sell* always starts from **My Tickets** within your platform, access to buy begins from event-level user journeys—also within your platform—such as:

- Event page  
- Sold-out primary sale page  
- Category listings  
- Experiences with an embedded map  

The integration model determines:

- How buyers see resale inventory  
- Where and how CTAs appear  
- Whether the UI is rule-based and contextual  
- How native the integration feels inside your platform  
- Whether availability, floor prices, and marketplace signals are shown  

menta supports two integration models to enable the resale purchase flow.

---

# Access to Buy — Comparison Table

{% table highlight-first=true highlight-row=2 %}
| Model | Description | When it makes sense | Benefits | Limitations |
|-------|-------------|---------------------|----------|-------------|
| **Smart Access Layer (SAL) — Buy Mode** *(Recommended)* | The platform calls SAL with event context, and SAL returns all necessary UI components | When you want a native, contextual experience | Dynamic components; rule-based UI; real-time availability | Requires component rendering and a SAL call per context |
| **Static URL / Redirect to menta** | A link sends the user to the resale page on menta | When speed to launch is the priority | Minimal implementation effort | No dynamic UI or contextual integration |
{% /table %}

{% conditionaltabs id="tabs-1765463808480" %}
{% tab label="Smart Access Layer" %}
# Smart Access Layer *(Recommended)*

## Overview

The **Smart Access Layer (SAL)** in buy mode generates **all the UI components needed** to run the resale purchase experience.

The platform makes the following request:

```
GET /v1/wrapper/accesslayer?type=buy&eventId={eventId}&showId={showId}
```

SAL evaluates:

- Resale configuration by category  
- Visibility rules  
- Floor prices, availability, and distribution  
- Marketplace signals  
- Rule-based UI behaviors  

And returns a complete structure of preconfigured components, such as:

- Purchase banner  
- Purchase modal  
- Buy button  
- Category list (with availability and CTAs)  
- Integrated venue map  

All components come ready to render and reflect, in real time, the rules configured in the dashboard.

---

## Sample SAL Response (simplified)

## How to interpret the response

The response includes a collection of UI components that the platform must render:

{% columns gap="2rem" align="start" %}

{% column width="1" valign="center" %}
```
{
    "status": 200,
    "data": [
        {
            "type": "banner",
            "class": "buyBanner",
            "buyBanner": {
                "title": "Buy Tickets Now",
                "description": "Best seats available",
                "image": "https://cdn.example.com/sal/banner.png",
                "visible": true,
                "quantityForSale": 12,
                "colors": {
                    "background": "#0A1F44",
                    "text": "#FFFFFF"
                },
                "callToAction": {
                    "text": "View options",
                    "url": "http://event.mentatickets.com",
                    "enabled": true
                }
            }
        },
        {
            "type": "modal",
            "class": "buyModal",
            "buyModal": {
                "title": "Complete Your Purchase",
                "description": "Secure checkout in seconds",
                "image": "https://cdn.example.com/sal/modal.png",
                "visible": true,
                "quantityForSale": 12,
                "callToAction": {
                    "text": "Continue",
                    "url": "http://event.mentatickets.com",
                    "enabled": true
                }
            }
        },
        {
            "type": "button",
            "class": "buyButton",
            "buyButton": {
                "visible": true,
                "quantityForSale": 12,
                "callToAction": {
                    "text": "Buy Tickets",
                    "url": "http://event.mentatickets.com",
                    "enabled": true,
                    "colors": {
                        "background": "#F25C54",
                        "text": "#FFFFFF"
                    }
                },
                "colors": {
                    "background": "#F25C54",
                    "text": "#FFFFFF"
                }
            }
        },
        {
            "type": "list",
            "class": "categoriesList",
            "categoriesList": {
                "categories": [
                    {
                        "ticketOptionId": "17635820544251",
                        "quantityForSale": 7,
                        "floorPrice": 100,
                        "visible": true,
                        "callToAction": {
                            "text": "Check availability",
                            "url": "http://event.mentatickets.com",
                            "enabled": true,
                            "colors": {
                                "background": "#FFFFFF",
                                "text": "#0A1F44"
                            }
                        },
                        "colors": {
                            "background": "#FFFFFF",
                            "text": "#0A1F44"
                        }
                    },
                    {
                        "ticketOptionId": "17635820544252",
                        "quantityForSale": 5,
                        "floorPrice": 200,
                        "visible": true,
                        "callToAction": {
                            "text": "Check availability",
                            "url": "http://event.mentatickets.com",
                            "enabled": true,
                            "colors": {
                                "background": "#FFFFFF",
                                "text": "#0A1F44"
                            }
                        },
                        "colors": {
                            "background": "#FFFFFF",
                            "text": "#0A1F44"
                        }
                    }
                ]
            }
        },
        {
            "type": "map",
            "class": "integratedMap",
            "integratedMap": {
                "map": {
                    "config": {
                        "allowOrphanTicketSelection": true
                    },
                    "totalCount": 0,
                    "bestListing": null,
                    "results": []
                }
            }
        }
    ]
}
```
{% /column %}

{% column width="0.75" valign="top" sticky=true %}


{% codeannotation highlight-lines="4:23" %}
**Banner**

Shows availability, key messages, or marketplace status.
{% /codeannotation %}

{% codeannotation highlight-lines="11" %}
**Visibility**
Available on every component: defines whether you should show it. It follows the rules configured in the dashboard, not the inventory.
{% /codeannotation %}

{% codeannotation highlight-lines="12" %}
**Quantity for sale**

`quantityForSale` comes on `buyBanner`, `buyModal` and `buyButton`: the number of active listings for the show, summed across the categories whose rules allow purchase (7 + 5 in the example).

It is independent from `visible`: `visible` tells you whether the secondary market is enabled for the show, `quantityForSale` tells you whether there is anything to buy right now. To hide the component on a show with no inventory, gate on `quantityForSale > 0`.
{% /codeannotation %}


{% codeannotation highlight-lines="24:39" %}
**Modal**

Pop-up window to complete the purchase with highlighted information.
{% /codeannotation %}

{% codeannotation highlight-lines="40:60" %}
**"Buy resale" button**

`visible` follows the dashboard rules, not the inventory. To show it only when there is something to buy, also gate on `quantityForSale > 0`.
{% /codeannotation %}

{% codeannotation highlight-lines="61:106" %}
**Category list**

Includes:

- Title  
- Availability  
- Floor price  
- Category-specific CTA  
{% /codeannotation %}

{% codeannotation highlight-lines="106:122" %}
**Integrated Map**

Enabled only if:

- The event has seating  
- The partner chooses to show it  
- There is inventory distributed by zones  

Each entry in `results` is a zone with its availability and its own **`url`**: use it as-is to send the buyer into the purchase flow for that zone.
{% /codeannotation %}

**Visibility rules**

If a category is disabled or restricted in the dashboard,  
**it will not appear in the SAL response**.

The platform **should not replicate business logic**, only render what SAL provides.
{% /column %}
{% /columns %}


---

## Login Trust (autologin)

SAL can return the components **already authenticated** for the user browsing your platform. Add `loginTrust[user]` — the email (or phone) of the user already logged in on your side — to the same call:

```
GET /v1/wrapper/accesslayer?type=buy&eventId={eventId}&showId={showId}&lang=en&loginTrust[user]=user@example.com&loginTrust[withMethod]=EMAIL
```

menta issues a one-time token for that user and embeds it as `oneTimeToken` in **every URL of the response**: the CTA of the banner, the modal and the button, the CTA of each category and the `url` of each zone of the integrated map. The buyer lands in the resale flow already logged in — no second login and no extra call to `/v1/auth/oneTimeToken`.

- **`loginTrust[withMethod]`** is optional: `EMAIL` (default) or `PHONE`.
- It requires your **private API Key**. With a public key the parameter is ignored and the URLs come back without the token.
- The token is **single use** and is consumed the first time the URL is opened. Request the access layer on every render and do not cache the URLs or strip their query params.
- If the login trust cannot be resolved, the response is still a `200` with all the components — only without `oneTimeToken` in the URLs. That is the signal to check that the parameter and the user are arriving exactly as you send them.

{% callout type="info" %}
**Tip:** Login Trust works the same way on the bulk endpoint (`POST /v1/wrapper/accesslayer/bulk`): the token is embedded in the URLs of every event/show of the batch.
{% /callout %}

For more details on Login Trust, see the [authentication guide](/en/guides/auth).

---

## When this model makes sense

- You want a native experience integrated within your platform  
- You need real-time visibility of availability by category  
- The UI must automatically adapt to dashboard rules  
- The partner does not want to maintain eligibility or pricing logic  
- You want to unify primary + secondary experiences  

---

## Benefits

### 1. Fully dynamic, rule-based UI
SAL controls what appears and under which conditions.

### 2. A single endpoint for all components
Banner, buttons, categories, and map in one call.

### 3. Automatic adaptation
Dashboard changes reflect immediately without extra development.

### 4. Native, consistent experience
Users do not feel a jump between systems.

### 5. No duplicated logic
All intelligence stays centralized in menta.

---

## Limitations

- Requires rendering the components returned by SAL  
- Needs one call per purchase context  
- Does not allow custom behaviors outside the SAL model  

{% /tab %}
{% tab label="Static URL" %}
# Static URL

## Overview

The platform adds a button or link such as:

**"Buy resale tickets"**

It redirects the user to a menta domain.  
No dynamic components or contextual visibility are shown in the primary UI.

---

## URL Generation

There are two ways to generate static URLs for the purchase flow:

### 1. Via API (Recommended)

The recommended approach is to use menta's API endpoint to generate dynamic URLs with all available configuration options.

{% apiembed endpoint="get-marketplace-buyingflow-url-entrypoint" show="description,parameters,requestBody,responses" /%}

#### Main parameters

- **externalReferenceEventId**: Event identifier
- **showId**: Show identifier (required)
- **ticketOptionId**: Access category identifier (optional)
- **returnTo**: URL to redirect users after purchase (required)
- **lang**: Language code for the interface (optional)
- **loginTrust[user]**: Email or phone number of the authenticated user when using Login Trust (optional)

#### Usage example

```bash
GET /v1/marketplace/buyingflow/url/entrypoint?externalReferenceEventId=123&showId=456&returnTo=https://example.com
Authorization: Bearer {your_api_key}
```

The response includes the complete URL ready to use:

```json
{
  "status": 200,
  "data": "https://events.mentatech.io/es/123/456?ticketSellerId=1010",
  "errors": null
}
```

### 2. Manual URL

Alternatively, you can construct the URL manually following menta's standard format, though this option offers less flexibility and does not include all configuration options available via API.

---

## Authentication and registration

### Login Trust

You can add the `loginTrust[user]` parameter to any generated URL to enable transparent authentication. This allows users already authenticated on your platform to access the marketplace without needing to log in again.

For more details on Login Trust implementation, see the [authentication guide](/en/guides/auth).

{% callout type="info" %}
**Tip:** The generated URL can include Login Trust by adding the `loginTrust[user]` parameter with the authenticated user's email or phone number. This works with both API-generated URLs and manual URLs.
{% /callout %}

### Force registration without Login Force

If you don't implement Login Force but need users to be registered before they can purchase, you can configure your ticket synchronization endpoint to return an HTTP **404** status code when an unauthenticated user tries to access.

#### Implementation

In your ticket synchronization endpoint (the one menta queries to validate ticket ownership), when you detect that the user is not authenticated or doesn't have an account:

**Return HTTP status code 404**

This will make menta redirect the user to your registration or login page before allowing them to continue with the purchase.

---

## When it makes sense

- When the goal is to enable resale quickly  
- When integrating SAL is not possible for now  
- When you do not need to show availability or floor prices on the event page  
- When SAL is planned for a later phase  

---

## Benefits

- Extremely simple implementation  
- Requires only adding a link  
- Lets you enable resale in very little time  
- Flexibility to add authentication and parameters via API

---

## Limitations

### 1. No dynamic components
Availability, categories, maps, and floor prices are not shown.

### 2. No visibility logic
If resale is disabled, the primary UI will not reflect it.

### 3. No support for advanced capabilities
Future features require SAL.

{% /tab %}
{% /conditionaltabs %}
