# Ninjapay URI Intent

Ninjapay supports a URI scheme which allows web pages, apps, or other services to initiate a payment request through the Ninjapay app installed on the user's device.

#### Constructing the Ninjapay URI

The URI should be constructed as follows:

`ninjapay://pay?key=<invoice-key>&tid=<transaction-id>`

where:

* `<invoice-key>` is the unique API [invoice key](/ninjapay-api-docs/how-to/authentication.md) used for authentication.
* `<transaction-id>` is the unique 12-digit number to be used for the payment. Get it using [request payment](/ninjapay-api-docs/coming-soon/api-reference-pro/request-payment.md) method.

For example:

`ninjapay://pay?key=n6bda6e5c9377c21a5cdee98572f08e1&tid=128662902742`

#### Initiating the Payment Request

To initiate the payment request, simply navigate to the constructed URI.

In a web page, this can be done by providing the URI as a hyperlink:

{% code overflow="wrap" %}

```html

<a href="ninjapay://pay?key=n6bda6e5c9377c21a5cdee98572f08e1&tid=128662902742">Pay with Ninjapay</a>

```

{% endcode %}

In a mobile app, this can typically be done by opening the URI:

{% code overflow="wrap" %}

```javascript

window.open("ninjapay://pay?key=n6bda6e5c9377c21a5cdee98572f08e1&tid=128662902742");

```

{% endcode %}

#### Receiving a Payment Response

After the payment has been processed, the Ninjapay app will return control to the calling app along with a response that contains details about the transaction. This response will typically include:

* `tid`: a unique identifier for the transaction.
* `status`: the status of the transaction, e.g., "successful", "failed", etc.

The method of receiving this response will depend on the specific platform and programming language. In general, you will need to set up a callback mechanism to handle the response.

#### User Experience

When a user activates a Ninjapay URI:

1. The Ninjapay app will open on their device, with the payment details pre-filled according to the information provided in the URI.
2. The user will be asked to confirm the payment.

   If the user is not already logged in to the Ninjapay app, they will be asked to log in before they can confirm the payment.
3. Once the user confirms the payment, the transaction will be processed. The user will see a confirmation message in the Ninjapay app, and they can then return to the original app or webpage.

Note:

* Allowing payments to be initiated in this way can be convenient for users, but it also presents security considerations. Ensure that the Ninjapay URIs are only generated and used in a secure manner.
* Make sure to verify [payment status](/ninjapay-api-docs/coming-soon/api-reference-pro/check-payment.md) confirmations from Ninjapay on the server side.

***

This covers the basic usage of the NinjaPay URI intent system. Depending on the specifics of your implementation, you may want to add more details or examples to help users understand how to use it effectively.


---

# 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://ninjapay.gitbook.io/ninjapay-api-docs/coming-soon/api-reference-pro/ninjapay-uri-intent.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.
