# Accept Blockchain Payments

To simplify acceptance of digital assets you can use Payment SmartApp. Payment SmartApp will orchestrate automatic forwarding of deposit to related Virtual account.

<figure><img src="/files/fK2i42R3bQf3lRLuHT5V" alt=""><figcaption></figcaption></figure>

Amount received to Virtual account will be diminished for the amount of blockchain fee paid for automatic withdrawal from Deposit account to Ramp account.

## Create Payment

Use `seal` object to store immutable data about the payment.

Use `data` object to store variable data about the payment.

{% hint style="info" %}
Source Deposit account is automatically created.
{% endhint %}

{% hint style="info" %}
Target Virtual account must have related Ramp account assigned.
{% endhint %}

To create Payment you must provide target Virtual account address or alias.

Provide expected `amount` of deposit transaction to be able to track if it is paid in full.

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

<pre class="language-shell"><code class="lang-shell"><strong>echo 'Create payment request for 0.03 BTC'
</strong>
curl --location --request POST 'https://api.orangepill.cloud/v1/apps/deposit/payment' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "destination": {
        "account": "6340be52dffbdb56217f6a7b"
    },
    "amount": 0.03,
    "asset": "BTC",
    "original_amount": 120.40,
    "original_currency": "USD",
    "valid_until": 1671242779881,
    "external": "INV12345",
    "seal": {
        "my_signature_field": "my_signature_value"
    },
    "data": {
        "description": "Payment 0.03 BTC",
        "invoice": "INV12345"
    }
}'
</code></pre>

{% endtab %}
{% endtabs %}

In response we get new `payment` with status `PENDING` if validation was succeful. Notice that Deposit account is automatically created for `source`.

```json
{
    "id": "639d2416cd7325b35f409452",
    "source": {
        "account": "634b56217f6a7b0be52dffbd",
        "deposit_address": "bc1q7pna7w7462uruh8m54tcnzspva8xd98wmc546u",
        "owner": "639675ab191e9023f356dfa6"
    },
    "destination": {
        "account": "6340be52dffbdb56217f6a7b",
        "owner": "639675ab191e9023f356dfa6"
    },
    "amount": "0.03",
    "asset": "ETH",
    "original_amount": 120.40,
    "original_currency": "USD",    
    "valid_until": 1671242779881,
    "external": "INV12345",    
    "seal": {
        "my_signature_field": "my_signature_value"
    },
    "data": {
        "description": "Payment 0.03 BTC",
        "invoice": "INV12345"
    },
    "owner": "639675ab191e9023f356dfa6",
    "created_at": 1671242774572,
    "status": "PENDING",
    "error": null
}
```

### Payment status

<table><thead><tr><th width="161">Status</th><th>Description</th></tr></thead><tbody><tr><td><code>PENDING</code></td><td>Awaiting for deposit.</td></tr><tr><td><code>PROCESSING</code></td><td>Deposit received, withdrawal and forwarding in process.</td></tr><tr><td><code>DONE</code></td><td>Payment processing was successful.</td></tr><tr><td><code>INCOMPLETE</code></td><td>Payment is on time but amount received is not full.</td></tr><tr><td><code>OVERPAID</code></td><td>Payment is on time but amount received is overpaid.</td></tr><tr><td><code>LATE</code></td><td>Payment was received in full but after valid time.</td></tr><tr><td><code>FAILED</code></td><td>Payment creation or processing has failed.</td></tr><tr><td><code>REFUND</code></td><td>Payment is ready for refund to source.</td></tr><tr><td><code>REFUNDED</code></td><td>Payment has been refunded to source payer.</td></tr></tbody></table>

## List payments

You can apply filters to get list of payments.

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

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

{% endtab %}
{% endtabs %}

In response we get array of `payment` objects.&#x20;

```json
[{
    "id": "639d2416cd7325b35f409452",
    "source": {
        "account": "634b56217f6a7b0be52dffbd",
        "deposit_address": "bc1q7pna7w7462uruh8m54tcnzspva8xd98wmc546u",        
        "owner": "639675ab191e9023f356dfa6"
    },
    "destination": {
        "account": "6340be52dffbdb56217f6a7b",
        "owner": "639675ab191e9023f356dfa6"
    },
    "amount": "0.03",
    "asset": "BTC",
    "original_amount": 120.40,
    "original_currency": "USD",    
    "valid_until": 1671242779881,
    "external": "INV12345",        
    "seal": {
        "my_signature_field": "my_signature_value"
    },
    "data": {
        "description": "Payment 0.03 Bitcoin",
        "invoice": "INV12345"
    },
    "owner": "639675ab191e9023f356dfa6",
    "created_at": 1671242774572,
    "status": "PENDING",
    "error": null
}]
```


---

# 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.orangepill.cloud/smartapps/accept-blockchain-payments.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.
