> For the complete documentation index, see [llms.txt](https://docs.orangepill.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orangepill.cloud/smartapps/payment-request/payment-request-v1.0.md).

# Payment Request v1.0

### Version 1.0

<table><thead><tr><th width="196">Field</th><th>Description</th><th width="190">Example</th><th data-type="checkbox">Mandatory</th></tr></thead><tbody><tr><td>version</td><td>Payment Request version</td><td>1.0</td><td>true</td></tr><tr><td>destination.alias</td><td>Payee alias</td><td>@merchant1</td><td>true</td></tr><tr><td>source.alias</td><td>Payer alias</td><td>@user1</td><td>false</td></tr><tr><td>amount</td><td>Payment amount</td><td>100.12</td><td>false</td></tr><tr><td>asset</td><td>Payment currency</td><td>USD</td><td>false</td></tr><tr><td>description</td><td>Payment description</td><td>Order #1</td><td>false</td></tr><tr><td>tags</td><td>Array of tags</td><td>["online","sport"]</td><td>false</td></tr><tr><td>data.system</td><td>Ecommerce system that generated Payment request.</td><td>VTEX</td><td>false</td></tr><tr><td>data.callback</td><td>Status change callback URL.</td><td>https://domain.com/orangepill/payment</td><td>false</td></tr><tr><td>data.store</td><td>Store name</td><td>Pet shop Barney</td><td>false</td></tr><tr><td>data.merchant</td><td>Merchant name</td><td>Pet shop Ltd.</td><td>false</td></tr><tr><td>data.cart</td><td>Related cart id</td><td>cart737743</td><td>false</td></tr><tr><td>data.order</td><td>Related order id</td><td>623347473</td><td>false</td></tr><tr><td>data.invoice</td><td>Related invoice id</td><td>INV122-3</td><td>false</td></tr><tr><td>data.image</td><td>base64 invoice scan</td><td><pre><code>"png;base64,iVBORw0KGgo...
</code></pre></td><td>false</td></tr><tr><td>data.valid_until</td><td>UNIX timestamp. Validity expiry rule.</td><td>172266633528382</td><td>false</td></tr><tr><td>data.not_before</td><td>UNIX timestamp. Validity expiry rule.</td><td>172266633522332</td><td>false</td></tr></tbody></table>

### Static Payment Requests

Static Payment Requests contain only information about the payee, the receiver of payment and lack the information about exact amounts and payment reference. Example of Static Payment Requests are QR codes exposed at Merchant stores. Payer use this Payment Request to initiate the payment flow, yet needs to add additional information about the exact amount and reference of payment.

```json

{
	version: "1.0",
	destination: {
		alias: "@merchant_alias"
	},
	description: "Static Payment Request Example",
	data: {
		store: "Store name",
		merchant: "Merchant name",
	}
}

```

### Dynamic Payment Requests

Dynamic Payment Requests contain both complete information about the payee and the information about exact amounts and payment reference. Example of Dynamic Payment Requests are QR codes generated at checkout process on e-commerce platforms or printed on POS devices. Payer use this Payment Request to initiate the payment flow with known total amount and reference of payment.

```json

{
	version: "1.0",
	destination: {
		alias: "@merchant_alias"
	},
	asset: "USD",
	amount: 100.24,
	description: "Dynamic Payment Request Example",
	data: {
		store: "Store name",
		merchant: "Merchant name",
		order: "ord_uh2232i"
	}
}

```

### Direct Payment Requests

Direct Payment Requests contain complete information about the payee, payer and the information about exact amounts and payment reference. Example of Direct Payment Requests are subscriptions and recurring payments. Payer receives notification about Payment Request and initiates the payment flow with known total amount and reference of payment.

```json

{
	version: "1.0",
	destination: {
		alias: "@merchant_alias"
	},
	asset: "USD",
	amount: 100.24,
	description: "Dynamic Payment Request Example",
	data: {
		source: [
		   {
			alias: "@alice",
			amount: 50
	   	   },
		   {
			alias: "@bob",
			amount: 50.24
	   	   },
		],
		store: "Store name",
		merchant: "Merchant name",
		order: "ord_uh2232i"
	}
}

```

## Create Payment Request v1.0

When creating new Apps.Payment you can use additional fields.

Use `data` object to add custom fields and data.

Use `description` object to add custom description.

Use data.`valid_until` to define expiry for this Payment Request. Any transaction sent will change status to `LATE`.

Use data.`not_before` to define if there is start date to accept payments for this Payment Request. Any transaction sent will change status to `EARLY`.

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Create payment request'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/apps/payment' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
	"version": "1.0",
	"destination": {
		"alias": "@pet_shop_barney"
	},
	"amount": 100.23,
	"asset": "USD",
	"description": "Order ord_24hhh32 from WooCommerce",
	"data": {
		"system": "WOOCOMMERCE",
		"callback": "https://domain.com/orangepill/payments",
		"store": "Pet shop Barney",
		"merchant": "Pet shop Ltd.",
		"order": "ord_24hhh32"
	}   
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get new Payment Request object.

```json
{
	"id": "MljzDk8qxDsBkXW0wv3r",
	"version": "1.0",
	"destination": {
		"alias": "@pet_shop_barney"
	},
	"amount": 100.23,
	"asset": "USD",
	"description": "Order ord_24hhh32 from WooCommerce",
	"data": {
		"system": "WOOCOMMERCE",
		"callback": "https://domain.com/orangepill/payments",		
		"store": "Pet shop Barney",
		"merchant": "Pet shop Ltd.",
		"order": "ord_24hhh32"
	},   
	"status": "CREATED",
	"owner": "639675ab191e9023f356dfa6",
   	"created_at": 1671242774572,
   	"error": null
}
```

## Get Payment Request details

You can get details of Payment Requests by providing `id`.

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'get Payment Request with id MljzDk8qxDsBkXW0wv3r'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/MljzDk8qxDsBkXW0wv3r' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get Payment Request entity.&#x20;

```json
{
	"id": "MljzDk8qxDsBkXW0wv3r",
	"version": "1.0",
	"destination": {
		"alias": "@pet_shop_barney"
	},
	"amount": 100.23,
	"asset": "USD",
	"description": "Order ord_24hhh32 from WooCommerce",
	"data": {
		"system": "WOOCOMMERCE",
		"callback": "https://domain.com/orangepill/payments",		
		"store": "Pet shop Barney",
		"merchant": "Pet shop Ltd.",
		"order": "ord_24hhh32"
	},   
	"status": "CREATED",
	"owner": "639675ab191e9023f356dfa6",
   	"created_at": 1671242774572,
   	"error": null
}
```

## Delete Payment Request

To delete Payment Request use following call.

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Delete payment request'
</strong>
curl --location --request DELETE 'https://api.orangepill.cloud/v1/apps/payment/MljzDk8qxDsBkXW0wv3r' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
</code></pre>

{% endtab %}
{% endtabs %}

In response we get `id` of deleted Payment Request object.

```json
"MljzDk8qxDsBkXW0wv3r"
```

## List Payment Requests

You can list all Payment Requests or filter them using query method..

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'list Payment Requests with status DONE'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment?query={"status":"DONE"}' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get array of Payment Requests.&#x20;

```json
[
	{
		"id": "MljzDk8qxDsBkXW0wv3r",
		"version": "1.0",
		"destination": {
			"alias": "@pet_shop_barney"
		},
		"amount": 100.23,
		"asset": "USD",
		"description": "Order ord_24hhh32 from WooCommerce",
		"data": {
			"system": "WOOCOMMERCE",
			"callback": "https://domain.com/orangepill/payments",			
			"store": "Pet shop Barney",
			"merchant": "Pet shop Ltd.",
			"order": "ord_24hhh32"
		},   
		"status": "DONE",
		"owner": "639675ab191e9023f356dfa6",
	   	"created_at": 1671242774572,
	   	"error": null
	},
	{
		"id": "XW0wv3rzDk8jqxDMlsBk",
		"version": "1.0",
		"destination": {
			"alias": "@pet_shop_barney"
		},
		"amount": 200.23,
		"asset": "USD",
		"description": "Order ord_36yhgh11 from WooCommerce",
		"data": {
			"system": "WOOCOMMERCE",
			"callback": "https://domain.com/orangepill/payments",			
			"store": "Pet shop Barney",
			"merchant": "Pet shop Ltd.",
			"order": "ord_36yhgh11"
		},   
		"status": "DONE",
		"owner": "639675ab191e9023f356dfa6",
	   	"created_at": 1712427674572,
	   	"error": null
	}
]
```

## Generate QR Code for URL

You can encode URL as QR code. Use it to generate code with link for conversational channels like WhatsApp or custom URL for your mobile application.

Use endpoint GET /v1/apps/payment/qr/:format/:width/:data to get image of QR code form Orangepill platform.

Supported formats are `png` and `base64`.

> Use parameter `width` to define the size of QR code.
>
> Use parameter `data` to provide URL you want to encode.

<figure><img src="/files/qIUoYCMbX21DRLkcctxL" alt=""><figcaption><p>WhatsApp URL QR Code Example</p></figcaption></figure>

{% hint style="warning" %}
Use encodeUrl method for `data` parameter.  For example URL **`https://wa.me/447860034005?text=payment code q0YR6lzpXJiNo5GMjwXk`** should be encoded like **`https%3A%2F%2Fwa.me%2F447860034005%3Ftext%3Dpayment%2520code%2520q0YR6lzpXJiNo5GMjwXk`**.
{% endhint %}

### PNG format of QR Code

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Generate 200x200px PNG QR code for WhatsApp URL https://wa.me/447860034005?text=payment code q0YR6lzpXJiNo5GMjwXk'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/qr/png/200/https%3A%2F%2Fwa.me%2F447860034005%3Ftext%3Dpayment%2520code%2520q0YR6lzpXJiNo5GMjwXk' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get QR code in PNG format.

<figure><img src="/files/qIUoYCMbX21DRLkcctxL" alt=""><figcaption><p>https://wa.me/447860034005?text=payment code q0YR6lzpXJiNo5GMjwXk</p></figcaption></figure>

### base64 format of QR code

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

```shell
echo 'Generate 200x200px base64 QR code for WhatsApp URL https://wa.me/447860034005?text=payment code q0YR6lzpXJiNo5GMjwXk'

curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/BJgJVrqEnQIpYpQpLxrY/qr/base64/200' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

In response we get base64 format of QR code PNG image.

{% code overflow="wrap" %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I/uD/wiVo+Km8kbFWypHxTeoHBVvqbxRcVM5Km4qk4pDZVLxlspR8ZbKUfFPelhrjR7WWqOHtdboh19Q+ZsqbhWTik+oHBUTlUnFTeWoeEvlqJhUTFRuFYfKreITFYfKreITKkfFROVWMVE5Kj7xsNYaPay1Rj98ScU3qHxC5Y2KtyreUPmGit+q+AaVo+KmMlH5RMUbFROVb3tYa40e1lqjh7XW6Ie/ROWNirdU3qi4qRwqt4pD5VZxqHxCZaLyCZVJxVsqR8Wt4lD5NpVvUPmbHtZao4e11uiH/4NUbhWHyqRiUvGWyicq3lB5S+WfVHGo3ComKpOKQ+VWMVH5rYe11uhhrTV6WGuNfvg/ouJQuakcFROVtyoOlbcqDpWbyqTiExUTlUNlUjFRuakcFTeV36r4Jz2stUYPa63RD39JxbdVHCqTipvKoXKreKPirYpD5aZyVNxUfkvlrYqJykTlqLipHCpvVbyhMqn4toe11uhhrTV6WGuNfvgSlX9SxUTlVnGoTCpuKhOVo2JSMVGZVNxUjoqbyhsVE5WJyq3ijYqbykTlqLipHBU3lUPl2x7WWqOHtdbI/mCt9f/1sNYaPay1Rg9rrdHDWmv0sNYaPay1Rg9rrdHDWmv0sNYaPay1Rg9rrdHDWmv0sNYa/T+67UwBCRKuIQAAAABJRU5ErkJggg=="
```

{% endcode %}

## Generate QR Code for Payment Request Unique Code

You can encode Payment Request Unique Code as QR code.&#x20;

Use endpoint GET /v1/apps/payment/:payment\_requst\_unique\_code/qr/:format/:width to get image of QR code form Orangepill platform.

Supported formats are `png` and `base64`.

> Use parameter `width` to define the size of QR code.

<figure><img src="/files/BHpZDvELuYwabAdBHWJz" alt=""><figcaption><p>Payment Request QR Code Example</p></figcaption></figure>

### PNG format of QR Code

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Generate 200x200px PNG QR code for Payment Request Code BJgJVrqEnQIpYpQpLxrY'
</strong>
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/BJgJVrqEnQIpYpQpLxrY/qr/png/200' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get QR code in PNG format.

<figure><img src="/files/BHpZDvELuYwabAdBHWJz" alt=""><figcaption><p>BJgJVrqEnQIpYpQpLxrY</p></figcaption></figure>

### base64 format of QR code

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

```shell
echo 'Generate 200x200px base64 QR code for Payment Request Code BJgJVrqEnQIpYpQpLxrY'

curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/BJgJVrqEnQIpYpQpLxrY/qr/base64/200' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
```

{% endtab %}
{% endtabs %}

In response we get base64 format of QR code PNG image.

{% code overflow="wrap" %}

```json
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAklEQVR4AewaftIAAAXiSURBVO3BUW4j0REEwawG73/l9H4/TwMDDElJdkXEf6iqS0NVrYaqWg1VtRqqajVU1WqoqtVQVauhqlZDVa2GqloNVbUaqmo1VNVqqKrVUFWroapWQ1WthqpaDVW1GqpqNVTV6sWHJOE3UrkrCXep3JGET1A5JeEulbuS8BupvNtQVauhqlZDVa2GqloNVbV68WUq35KEO5Jwl8oTKncl4QmVK0l4N5VvScK3DFW1GqpqNVTVaqiq1YtfIAlPqHyCyrsl4S6VK0k4JeGkckXlW5LwhMpPGqpqNVTVaqiq1VBVqxf1MUk4qVxJwikJV1ROSTgl4S6V+m9DVa2GqloNVbUaqmo1VNXqRa2S8ITKXSrvpnIlCXXPUFWroapWQ1WthqpavfgFVH4jlbuScErCt6jcpXJKwhWVJ1T+sqGqVkNVrYaqWg1VtRqqavXiy5LwlyXhisopCSeVK0k4qVxJwh1JuKLybkn4XzRU1WqoqtVQVauhqlYvPkTlr1C5koSTypUknFTuUvlJKnep/L8Yqmo1VNVqqKrVUFWr+A8/LAknlbuS8AkqpyRcU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VNVqqKrVUFWrF7VSOSXhisodSXgqCSeVUxLuUrmShJPKKQlXVJ5IwknlW4aqWg1VtRqqajVU1WqoqtWLIgmfkISTypUknFSuJOGUhLtUTkm4KwknlStJeLckXFF5t6GqVkNVrYaqWg1VtXrxC6j8JJUrSTipXEnCX6ZyVxI+QeW3GapqNVTVaqiq1VBVqxdfloS/QuUJlbtUTkl4QuVKEu5SuSMJV1ROSbiShJPKKQlXVN5tqKrVUFWroapWQ1WthqpaxX+oqktDVa2GqloNVbUaqmo1VNVqqKrVUFWroapWQ1WthqpaDVW1GqpqNVTVaqiq1VBVq6GqVkNVrYaqWg1VtRqqavUfaQVIm0GP+0MAAAAASUVORK5CYII="
```

{% endcode %}

## Reveal QR Code

You can use Orangepill API to reveal the image of QR code and decode the Payment Request Unique Code.

{% hint style="warning" %}
You must provide QR code in base64 format.
{% endhint %}

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

<pre class="language-shell" data-overflow="wrap"><code class="lang-shell"><strong>echo 'Reveal Payment Request Unique Code from QR image'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/apps/payment/qr/reveal' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json' \
--data-raw '{
	"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAklEQVR4AewaftIAAAXiSURBVO3BUW4j0REEwawG73/l9H4/TwMDDElJdkXEf6iqS0NVrYaqWg1VtRqqajVU1WqoqtVQVauhqlZDVa2GqloNVbUaqmo1VNVqqKrVUFWroapWQ1WthqpaDVW1GqpqNVTV6sWHJOE3UrkrCXep3JGET1A5JeEulbuS8BupvNtQVauhqlZDVa2GqloNVbV68WUq35KEO5Jwl8oTKncl4QmVK0l4N5VvScK3DFW1GqpqNVTVaqiq1YtfIAlPqHyCyrsl4S6VK0k4JeGkckXlW5LwhMpPGqpqNVTVaqiq1VBVqxf1MUk4qVxJwikJV1ROSTgl4S6V+m9DVa2GqloNVbUaq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CsqT6icknBF5ZSEJ1SeUnkiCackXFE5JeGk8i1DVa2GqloNVbUaqmr14kOS8BupfEsSnlC5koSTyrck4aRyl8pdKqckXFF5t6GqVkNVrYaqWg1VtXrxZSrfkoSfpHJKwpUknFQ+IQlPqDyRhCsqd6h8y1BVq6GqVkNVrYaqWg1VtXrxCyThCZUnVK4k4d1UriThlIQrKqcknFSeSsK3JOEJlXcbqmo1VNVqqKrVUFWrF7VSOSXhisodSXgqCSeVUxLuUrmShJPKKQlXVJ5IwknlW4aqWg1VtRqqajVU1WqoqtWLIgmfkISTypUknFSuJOGUhLtUTkm4KwknlStJeLckXFF5t6GqVkNVrYaqWg1VtXrxC6j8JJUrSTipXEnCX6ZyVxI+QeW3GapqNVTVaqiq1VBVqxdfloS/QuUJlbtUTkl4QuVKEu5SuSMJV1ROSbiShJPKKQlXVN5tqKrVUFWroapWQ1WthqpaxX+oqktDVa2GqloNVbUaqmo1VNVqqKrVUFWroapWQ1WthqpaDVW1GqpqNVTVaqiq1VBVq6GqVkNVrYaqWg1VtRqqavUfaQVIm0GP+0MAAAAASUVORK5CYII="
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get Payment Request Unique Code.

```json
"BJgJVrqEnQIpYpQpLxrY"
```

## Make payment

To make payment and change status of the Payment Request, you must create transaction of type `payment` and reference Payment Request in `related` object.

Transaction can be in any currency. After the transaction is processed, amount in transaction asset is calculated and compared to amount in Payment Request currency. If transaction amount is equal or greater than the amount of Payment Request, status will be changed to `DONE`. If amount of transaction is less then amount in Payment Request, status will be changed to `INCOMPLETE`.&#x20;

After the Payment Request status is changed, Orangepill core will call callback URL.

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Pay with transaction'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/transaction' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
"source": {
    "account": "6695b47a6b1b76f77fc2116a"
},
"destination": {
	"alias": "@merchantalias"
},
"type": "payment",
"value": 5000,
"asset": "YOUR_POINTS",
"related": [{
    "type": "apps.payment",
    "value": "BJgJVrqEnQIpYpQpLxrY"
}],
"description": "Cart from WooCommerce",
"data": {}
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get new Transaction object.

```json
{
    "id": "6698da2675e2ef1c0a7b18c7",
    "source": {
        "account": "6695b47a6b1b76f77fc2116a",
        "owner": "65c395e9765ee9ee257bd765",
        "holder": "6695b47974444801383847a2"
    },
    "destination": {
        "account": "6667c8baddbdb1bfe0b3e312",
        "alias": "LUISA_POSTRES_YOUR_POINTS",
        "owner": "65c395e9765ee9ee257bd765",
        "holder": "6667c87d3e551062b39dafb1"
    },
    "value": "5000",
    "asset": "YOUR_POINTS",
    "data": {},
    "type": "payment",
    "related": [
        {
            "type": "apps.payment",
            "value": "BJgJVrqEnQIpYpQpLxrY",
            "created_at": 1721141056486
        }
    ],
    "holder": "65c395e9765ee9ee257bd766",
    "owner": "65c395e9765ee9ee257bd765",
    "created_at": 1721293350429,
    "external": [],
    "status": "PROCESSING",
    "error": null,
    "amount": "5000"
}
```
