# Validate

Ownership validation enables the developer to check if the purchaser is holding an NFT from a specified collection. The transaction will fail if the purchaser does not have the NFT and succeed if they do.

### How it Works

1. Developer specifies an NFT collection or an SPL mint address for an SFT as the verification target. mtnAPI uses the index API to query all the NFTs and SFTs in the user's wallet.
2. mtnAPI verifies whether an NFT belongs to a collection or  an SFT belongs to a specific SPL token address.
3. If mtnAPI validates the above, there is a program with instruction included in the transaction that verifies NFT or SFT collection on-chain to provide a trusted solution.

### Use Case

Let's use a concert as an example where NFTs and SFTs could be used and how they would be different.&#x20;

For SFTs, assume the user holds an SFT granting them general admission to the event. mtnAPI would verify that the user has the specified SPL address of the SFT and verify it on the blockchain. In the case of NFTs, assume the user holds an NFT that includes a specific row and seat number. The verification process is similar, with the only difference being validating the user is holding an NFT of a specific collection.&#x20;

## The POST request will return the desired discounted payment transaction

<mark style="color:green;">`POST`</mark> `https://api.mtnapi.com/validate`

#### Query Parameters

| Name                                         | Type   | Description                                                                                                                                                                               |
| -------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>     | String | The payment amount in USDC.                                                                                                                                                               |
| wallet<mark style="color:red;">\*</mark>     | String | The public key (wallet address) of the merchant being paid.                                                                                                                               |
| devMode                                      | String | <p>Set to TRUE to enable dev mode, otherwise set to FALSE. Dev mode will enable error codes to be sent back for transaction failures.</p><p></p><p>The default value is set to FALSE.</p> |
| decimal                                      | String | <p>Set to TRUE to enable human-readable values (i.e USDC, SOL, etc...), or set to FALSE to use SPL base unit quantity (i.e lamport).</p><p></p><p>The default is set to TRUE.</p>         |
| inputType                                    | String | <p>The token (ticker symbol) provided by the customer as payment and is accepted by the merchant.</p><p></p><p>The default value is set to SOL.</p>                                       |
| collection<mark style="color:red;">\*</mark> | String | The public key of NFT collection.                                                                                                                                                         |
| discount<mark style="color:red;">\*</mark>   | String | The discount applied to the payment. Discount is specified in percentages (i.e 20% should be specified as 0.20)                                                                           |

#### Request Body

| Name                                      | Type   | Description                           |
| ----------------------------------------- | ------ | ------------------------------------- |
| account<mark style="color:red;">\*</mark> | String | The public key of the payer's wallet. |

{% tabs %}
{% tab title="200: OK Transaction was built successfully." %}

```javascript
{
    "transaction": "<transaction>"
}
```

{% endtab %}
{% endtabs %}

## The GET request will return the merchant name and logo.

<mark style="color:blue;">`GET`</mark> `https://api.mtnapi.com/validate`

#### Query Parameters

| Name                                         | Type   | Description                                                                                                                                                                                                             |
| -------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>     | String | The payment amount in USDC.                                                                                                                                                                                             |
| wallet<mark style="color:red;">\*</mark>     | String | The public key (wallet address) of the merchant being paid.                                                                                                                                                             |
| devMode                                      | String | <p>Set to TRUE to enable dev mode, otherwise set to FALSE. Dev mode will enable error codes to be sent back for transaction failures.</p><p></p><p>The default value is set to FALSE.</p>                               |
| cluster                                      | String | <p>Specify Solana devnet or mainnet cluster. </p><p></p><p>The default value is set to MAINNET.</p>                                                                                                                     |
| decimal                                      | String | <p>Set to TRUE to enable human-readable values (i.e USDC, SOL, etc...), or set to FALSE to use SPL base unit quantity (i.e lamport).</p><p></p><p>The default is set to TRUE</p>                                        |
| inputType                                    | String | <p>The token (ticker symbol) provided by the customer as payment. If the <em>input</em> parameter is specified, the <em>output</em> parameter must also be specified.</p><p></p><p>The default value is set to SOL.</p> |
| collection<mark style="color:red;">\*</mark> | String | The pubkey of nft collection.                                                                                                                                                                                           |
| discount<mark style="color:red;">\*</mark>   | String | The discount applied to the payment. Discount is specified in percentages (i.e 20% should be specified as 0.20)                                                                                                         |

#### Request Body

| Name                                      | Type   | Description                           |
| ----------------------------------------- | ------ | ------------------------------------- |
| account<mark style="color:red;">\*</mark> | String | The public key of the payer's wallet. |

{% tabs %}
{% tab title="200: OK Information was returned successfully." %}

```javascript
{
    label: "<Name of the merchant>",
    icon: "https://mtnphotobooth7afc22e0692f4205b848b9c01e02200e211757-dev.s3.amazonaws.com/public/2022-03-25+11.20.17.jpg"
}
```

{% endtab %}
{% endtabs %}


---

# 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://mtnpay.gitbook.io/api-docs/reference/api-reference/validate.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.
