Transactions

Transaction is instant movement of liability.

Balance moved in transaction from account to account is not affecting assets, only liabilities in balance.available and balance.total.

Create

Use seal object to store immutable data about the transaction.

Use data object to store variable data about the transaction.

echo 'move 0.0000001 BTC from account to account'

curl --location --request POST 'https://api.orangepill.cloud/v1/transactions' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "source": {
        "account": "634b56217f6a7b0be52dffbd"
    },
    "destination": {
        "account": "6340be52dffbdb56217f6a7b"
    },
    "value": 0.0000001,
    "asset": "BTC",
    "seal": {
        "my_signature_field": "my_signature_value"
    },
    "data": {
        "description": "Payment 0.0000001 Bitcoin",
        "external_reference": "PAY002"
    }
}'

In response we get new transaction. This call is async.

{
    "name": "EventStarted",
    "message": "Transaction is in processing pool.",
    "code": 200,
    "type": "transaction.processing",
    "data": {
        "id": "639d2416cd7325b35f409452",
        "source": {
            "account": "634b56217f6a7b0be52dffbd",
            "owner": "639675ab191e9023f356dfa6"
        },
        "destination": {
            "account": "6340be52dffbdb56217f6a7b",
            "owner": "639675ab191e9023f356dfa6"
        },
        "amount": "0.000110075",
        "asset": "ETH",
        "seal": {
            "my_signature_field": "my_signature_value"
        },
        "data": {
            "description": "Payment 0.000110075 ETH",
            "external_reference": "PAY001"
        },
        "owner": "639675ab191e9023f356dfa6",
        "created_at": 1671242774572,
        "status": "PROCESSING",
        "error": null,
        "value": "0.000110075"
    }
}

transaction will change status to DONE or FAILED once processing is finished.

If source and destination are Sub Accounts for different Ramp Account, transaction will generate withdrawal operation to target account address.

Retrieve history

To filter out history of incoming or outgoing transactions for authenticated user, apply ?scope=outgoing or ?scope=incoming in RESTful API query. Those scopes will filter out transactions where authenticated user is owner of source.account or destination.account.

echo 'get all outgoing transactions for authenticated user'

curl --location --request GET 'https://api.orangepill.cloud/v1/transactions?scope=outgoing' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'

In response we get list of transactions.

{
    "rows": [
        {
        "source": {
            "account": "634b56217f6a7b0be52dffbd"
        },
        "destination": {
            "account": "6340be52dffbdb56217f6a7b"
        },
        "value": 0.0000001,
        "currrency": "BTC",
        "seal": {
            "my_signature_field": "my_signature_value"
        },
        "data": {
            "description": "Payment 0.0000001 in Bitcoin",
            "external_reference": "PAY002"
        },
        "charges": null,
        "amount": 0.0000001,
        "status": "DONE",
        "created_at": "1519231809434",
        "updated_at": "1519809934211",
        "error": null
        },
    ],
    "total": 1,
    "page": 1,
    "pageSize": 10,
    "totalPages": 1
        
}

Last updated