# Create Invoice

In this section, we will explore the various methods for generating invoices, namely the DPP and BIP270 processes, each with its own set of input fields. It's important to note that while DPP enables the creation of invoices using Tokens, BIP270 is specifically designed for generating BSV-type invoices.

Below, you will find examples of the invoice input bodies for both DPP and BIP270. For DPP, it is important to select and include either the "native" or "stas" section in the invoice input body, but does not support both at the same time.

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

```javascript
var parameters = {
  "expirationTimeInMinuts": 0,
  "memo": "string",
  "paymentOptions": [
    {
      "transactions": [
        {
          "native": {
            "amount": 0,
            "to": "string"
          },
          "stas": {
            "tokenAmount": 0,
            "tokenRecipient": "string",
            "tokenId": "string"
          }
        }
      ]
    }
  ],
  "modeId": "ef63d9775da5",
  "beneficiary": {
    "name": "string",
    "email": "string",
    "address": "string",
    "paymentReference": "string"
  }
}
const response = await relysia.transaction.v1.invoice(parameters);
```

{% endtab %}

{% tab title="BIP270" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>var parameters = {
</strong>  "type": "string",
  "amount": 0,
  "address": "string",
  "merchantData": "string",
  "description": "string",
  "expirationTimeInMinuts": 0,
  "memo": "string"
}
const response = await relysia.transaction.v1.invoice(parameters);
</code></pre>

{% endtab %}
{% endtabs %}

### DPP&#x20;

The abbreviation "DPP" stands for Direct Payment Protocol, which is utilized for generating invoices that encompass BSV (Bitcoin SV) or STAS tokens. Note that the payment options cannot include both native and stas and only one is required for the invoice to be created.  The following is the "/invoice" endpoint to be employed when utilizing DPP:

## Create an Invoice

<mark style="color:green;">`POST`</mark> `https://api.relysia.com/v1/invoice`

Create an invoice to receive payments for a merchant product.

#### Request Body

| Name                                                      | Type   | Description                                             |
| --------------------------------------------------------- | ------ | ------------------------------------------------------- |
| expirationTimeInMinuts <mark style="color:red;">\*</mark> | Number | Number of minuites the Invoice is valid for             |
| memo                                                      | String | Notes about the transaction                             |
| paymentOptions<mark style="color:red;">\*</mark>          | Array  | Either Native BSV or STAS token                         |
| modeId<mark style="color:red;">\*</mark>                  | String | Specific identifier for the DPP protocol format used    |
| beneficiary<mark style="color:red;">\*</mark>             | Object | Information about the merchant revieing the transaction |

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

<pre class="language-javascript"><code class="lang-javascript"><strong>{
</strong>  "statusCode": 200,
  "data": {
    "msg": "Operation Completed Successfully !",
    "status": "success",
    "reqUrl": "https://api.relysia.com/v1/payment-request/f339874f-ad98-486d-9359-a8aa2af2e040"
  }
}
</code></pre>

{% endtab %}
{% endtabs %}

### BIP270

BIP270 is a widely recognized invoice standard extensively adopted within the BSV (Bitcoin SV) ecosystem. When utilizing BIP270, the following are the inputs required for the "/invoice" endpoint:

## Create an Invoice

<mark style="color:green;">`POST`</mark> `https://api.relysia.com/v1/invoice`

Create an invoice to receive payments for a merchant product.

#### Request Body

| Name                                                     | Type   | Description                                        |
| -------------------------------------------------------- | ------ | -------------------------------------------------- |
| type                                                     | String | Supported Currencies such as "USD" , "BSV", etc... |
| amount<mark style="color:red;">\*</mark>                 | Number | amount in currency type                            |
| address<mark style="color:red;">\*</mark>                | String | receiving address for the payment                  |
| description                                              | String | Description about the transaction                  |
| expirationTimeInMinuts<mark style="color:red;">\*</mark> | Number | Number of minuites the Invoice is valid for        |
| memo                                                     | String | Notes about the transaction                        |
| merchantData                                             | String | Information about the receiving party/merchant     |

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

<pre class="language-javascript"><code class="lang-javascript"><strong>{
</strong>  "statusCode": 200,
  "data": {
    "msg": "Operation Completed Successfully !",
    "status": "success",
    "reqUrl": "https://api.relysia.com/v1/payment-request/f339874f-ad98-486d-9359-a8aa2af2e040"
  }
}
</code></pre>

{% endtab %}
{% endtabs %}
