# Get Invoice

Once an invoice is created, it is essential to provide a means for another party to receive the invoice and proceed with the payment. The response from the "/invoice" endpoint, typically in JSON format, can be utilized to extract the relevant information required for this process. \
\
There are 2 ways to resolve an invoice:

* Using an internal invoice ID query for any invoices that may be stored locally.&#x20;
* Using the URL extension in the [/URI](/payments/uri.md) endpoint that can be resolved externally.

### Get Invoice by paymentRequest invoice endpoint

In this method simply pass in the invoice Id value returned from the create invoice step which will return an invoice JSON related to that service ID.\ <br>

<pre class="language-javascript"><code class="lang-javascript">var parameters = {
<strong>    invoiceId : "8f9f4c27-3782-46e2-b76f-1ef956f52c61"
</strong>}
const response = await relysia.transaction.v1.paymentRequest(parameters)
</code></pre>

## Get invoice JSON

<mark style="color:blue;">`GET`</mark> `https://api.relysia.com/v1/paymentRequest/:invoiceId`

Return Invoice JSON from an internal service using the invoice Id value.

#### Headers

| Name                                        | Type   | Description                               |
| ------------------------------------------- | ------ | ----------------------------------------- |
| invoiceId<mark style="color:red;">\*</mark> | String | Invoice Id provided from creating invoice |

{% tabs %}
{% tab title="200: OK Success" %}

{% endtab %}
{% endtabs %}

### Get Invoice by URI endpoint

In this method, invoices can be obtained by utilizing a [URI ](/payments/uri.md)endpoint with a specific URL extension. This approach serves as a way to externally receive invoices from the system. \
Here is an example of the URL extended format that is used in the URI endpoint to resolve the invoice and can be found in the "uri" field when creating the invoice.

```javascript
var parameters = {
    uri: "pay:?r=https://api.relysia.com/v1/paymentRequest/8f9f4c27-3782-46e2-b76f-1ef956f52c61"
}
const response = await relysia.utility.v1.uri(parameters)
```

## Resolve address, paymail aliias and invoice information

<mark style="color:blue;">`GET`</mark> `https://api.relysia.com/v1/URI`

The URI endpoint helps developers to resolve addresses, paymails and invoices and puts them into a standardized response format.

#### Headers

| Name                                  | Type | Description                                                      |
| ------------------------------------- | ---- | ---------------------------------------------------------------- |
| URI<mark style="color:red;">\*</mark> |      | Invoice URI provided in the /invoice response in the "uri" field |

{% tabs %}
{% tab title="200: OK Success" %}

{% endtab %}
{% endtabs %}

### Response types

\
Depending whether your invoice is DPP or BIP270 will determine the type of response returned. Here are both examples.

{% tabs %}
{% tab title="DPP" %}

```json
{
  "statusCode": 200,
  "status": "success",
  "msg": "Operation Completed Successfully",
  "network": "mainnet",
  "uri": "pay:?r=https://api.relysia.com/v1/paymentRequest/8f9f4c27-3782-46e2-b76f-1ef956f52c61",
  "memo": "paying for testing",
  "type": "bip272",
  "paymentUrl": "https://api.relysia.com/v1/paymentRequest/pay/8f9f4c27-3782-46e2-b76f-1ef956f52c61",
  "mainProtocol": "bip272",
  "creationTimestamp": 1686814941,
  "modes": {
    "ef63d9775da5": {
      "PaymentOption_0": {
        "transactions": [
          {
            "outputs": {
              "stas": [
                {
                  "tokenId": "00b91626e0a4b97f624bc1f0d8fa3a3ef35ac664-TIGLdA",
                  "tokenAmount": 1,
                  "tokenRecipient": "1HQKnJ5FfCjcgvr6AAqNPYhY7NKuZXByMF"
                }
              ]
            },
            "policies": {
              "fees": {
                "standard": {
                  "bytes": 1000,
                  "satoshis": 50
                },
                "data": {
                  "bytes": 1000,
                  "satoshis": 50
                }
              }
            }
          }
        ]
      }
    }
  },
  "beneficiary": {
    "name": "vaionex test",
    "email": "test@vaionex.com",
    "paymentReference": "8f9f4c27-3782-46e2-b76f-1ef956f52c61",
    "address": "19702 Newark, Delaware, USA"
  },
  "expirationTimestamp": 1686816741,
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="BIP270" %}

```json
{
  "statusCode": 200,
  "status": "success",
  "msg": "Operation Completed Successfully",
  "mainProtocol": "bip272",
  "merchantData": "a3621ebf-97a4-476f-a028-a7a9c55b27e8",
  "expirationTimestamp": 1686560853,
  "memo": "paying for testing",
  "outputs": [
    {
      "description": "paying 1$ for testing",
      "script": "76a9140bb9eb13c821d10af1f5fbf01c04577305c24d3788ac",
      "satoshis": 3971132
    }
  ],
  "version": "2.0.0",
  "uri": "pay:?r=https://api.relysia.com/v1/paymentRequest/f3a7f350-2e2e-4e8b-af0d-58eb5eb3728a",
  "creationTimestamp": 1686560793,
  "type": "bip272",
  "network": "mainnet",
  "paymentUrl": "https://api.relysia.com/v1/paymentRequest/pay/f3a7f350-2e2e-4e8b-af0d-58eb5eb3728a"
}
```

{% endtab %}
{% endtabs %}

These responses can be directly used to make a payment. In the next section we will see how to use these response values.


---

# 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.relysia.com/payments/invoices/get-invoice.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.
