# How It Works

The following represents the process for transaction requests using mtnAPI, enabling arbitrary transactions via Solana Pay.

mtnAPI provides a seamless user experience by bundling necessary instructions and returning the desired Solana transaction. It then allows the wallet to simulate the transaction and displays it to the user

This is executed in a quick and simple display while saving merchants and developers time on the back-end.

## **Step by Step Overview: How mtnAPI Works Using QR Code Generation**

1. The user opens a Solana Pay compatible wallet and scans the generated QR Code
   * The wallet generates a data string from the QR code that represents the encoded transaction request URL&#x20;
2. The wallet provides a public key (wallet address) and transaction request URL to mtnAPI
3. mtnAPI collects the public key and URL to build the desired Solana transaction and UI elements in two actions
   * Action 1: The user’s wallet sends a GET request to the mtnAPI server resulting in the return of a name string (merchant name) and an image string (merchant logo) which is displayed to the user
   * Action 2: The user’s wallet sends a POST request that includes the user's public key (user’s wallet address), and the desired Solana transaction is returned to the wallet
4. The transaction is returned to the user's wallet from the mtnAPI server
5. The user’s wallet will simulate the transaction and identify the fees associated with the transaction
   * mtnAPI provides 'gasless' transactions as a service for project teams that want to give their users a low friction transaction experience by removing gas fees (mtnAPI will coordinate and pay for gas fees on behalf of the dApp/project)
   * Within the returned transaction, mtnAPI will include instructions to create new associated token accounts where necessary (if a user or merchant does not have an existing balance for tokens they’re receiving)
6. The user is then able to review the transaction details and sign & send the transaction for execution on the Solana Blockchain
7. If the transaction is successful, a transaction signature is returned to the user’s wallet, and the user can confirm the transaction

![](https://2696725523-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsDzuypCJsJS7KjOn4LO9%2Fuploads%2FtfnpThicd7YhsUYS2cat%2FGroup%2015.png?alt=media\&token=75135375-26fa-42b7-88d5-927c37e276e6)

#### Disclaimer / Considerations

The performance of mtnAPI is dependent on support technologies such as Jupiter Aggregator, The Metaplex Protocol, and Solana Network.


---

# 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/how-it-works.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.
