Orangepill Docs
Search
K
Comment on page

Apps.Forward

Set automatic forwarding from virtual accounts.
Use SmartApp Forwarding to set template for automatic forwarding of received amount to another Virtual account. Amount of forwarding transaction can be expressed as fixed of percentage amount of incoming transaction. You can add multiple forwarding transactions for each Virtual account.

Create forwarding

Forwarding is transaction post-process routing.
After transaction or deposit is processed all apps.forward are triggered. If any condition is resolved TRUE or condition value is * then array of transactions is executed.
Condition can evaluate {ctx.meta.realm} and {transaction} fields. {transaction} is previous transaction that triggered forwarding.
Set value_type as FIXED or PERCENTAGE and add value value. This fixed or percentage amount of original transaction that is forwarded as transaction.value in new, forwarded transactions.
Use data object to add custom fields for this operation.
cURL
echo 'Automatically forward 0.3% of incoming amount'
curl --location --request POST 'https://api.orangepill.cloud/v1/apps/forward' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
"condition": "transaction.type == 'send' && transaction.destination.alias == 'ALIAS1'",
"transactions": [
"destination": {
"account": "6340be52dffbdb56217f6a7b"
},
"value_type": "PERCENTAGE",
"value": 0.3,
"asset": "BTC",
"data": {
"description": "Pay 0.3% fee"
},
"type": "forward"
],
"data": {
"field1": "value1"
},
"description": "Default fees"
}'
In response we get new forwarding object.
{
"id": "675ab191e9023f356dfa6396",
"condition": {
"transaction.type == 'send' && transaction.destination.alias == 'ALIAS1'"
},
"transactions": [
"destination": {
"account": "6340be52dffbdb56217f6a7b" // or "alias": "ALIAS1"
},
"value_type": "PERCENTAGE",
"value": 0.3,
"asset": "BTC",
"data": {
"description": "Pay 0.3% fee"
},
"type": "forward" // default value is "forward", or any transaction type "payment", "send", "sell", "buy"...
],
"data": {
"field1": "value1"
},
"description": "Default fees",
"owner": "639675ab191e9023f356dfa6",
"created_at": 1671242774572,
"error": null
}

List Forwardings

You can list all Forwardings or filter it by account.
cURL
echo 'list payments with status PENDING'
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/payment/6fbdb56217f6a7b340be52df' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
In response we get array of forwarding objects.
[{
"id": "675ab191e9023f356dfa6396",
"condition": {
"transaction.type == 'send' && transaction.destination.alias == 'ALIAS1'"
},
"transactions": [
"destination": {
"account": "6340be52dffbdb56217f6a7b" // or "alias": "ALIAS1"
},
"value_type": "PERCENTAGE",
"value": 0.3,
"asset": "BTC",
"data": {
"description": "Pay 0.3% fee"
},
"type": "forward" // default value is "forward", or any transaction type "payment", "send", "sell", "buy"...
],
"data": {
"field1": "value1"
},
"description": "Default fees",
"owner": "639675ab191e9023f356dfa6",
"created_at": 1671242774572,
"error": null
}]