Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
278 lines (236 sloc) 19.8 KB

Invoice

It is useful for merchant to generate a transaction that has to be performed by its client. To that end, Liquidity SDK allows you to generate invoices. These are prefilled transactions that can be used by any liquidity enabled wallet.

When an invoice is paid, a regular transaction is performed and the invoice is resolved.

Generate

Generate an invoice of :amount wei. If no recipient is provided, the ethereum address of the wallet daemon is used.

Endpoint

.. http:post:: /invoices

Request

Name Required Description Default Value Example
amount required Amount to be transfered in wei   1000000000000000000
recipient optional Ethereum address to sent the transaction to SDK's ethereum address 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
details optional Details associated to the transaction '' "A liquidity transaction "
currency optional Token to be used for payment ETH To be implemented

Response

Name Required Description Default Value Example
uuid required Amount to be transfered in wei   57056981-32b4-422a-9acb-c03ac4a12404
destinations required Array of destinations   [ { networkId: 1, contractAddress: 0xac8c3D5242b425DE1b86b17E407D8E949D994010, walletAddresses: [0x627306090abaB3A6e1400e9345bC60c78a8BEf57] }]
amount required Amount to be transfered in wei   1000000000000000000
currency required Unique identifier of the transaction   ETH
details required Sha3 Hash of provided details "" (empty string) 0x39ebcda37c1aaa7b6467f16d4f03479e5061031cc61b62342c9216d2ac012a5c
nonce required Identifier generated from invoice data   1270040570
encoded.url required Cross platform redirection url   https://lqd.money/?data=eyJ1dWlkIjoiNTQxMmEyZjMz...
encoded.raw required Encoded invoice data   eyJ1dWlkIjoiNTQxMmEyZjMz...

Example

POST /invoices HTTP/1.1
Content-Type: application/json

{
    "recipient": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57",
    "amount": 1
}
HTTP/1.1 200 OK
Content-Type: application/json

{
    "uuid": "288e19e69032480784305838b6158055",
    "destinations": [
        {
            "networkId": 1,
            "contractAddress": "0xac8c3D5242b425DE1b86b17E407D8E949D994010",
            "walletAddresses": ["0x627306090abaB3A6e1400e9345bC60c78a8BEf57"],
        }
    ],
    "amount": "1",
    "currency": "ETH",
    "details": "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563",
    "nonce": 1270040570,
    "encoded": {
        "url": "https://lqd.money/?data=eyJ1dWlkIjoiNTQxMmEyZjMzMzAyNDIwZGExNjU1ZjI5Y2FhMWUxNGMiLCJkZXN0aW5hdGlvbnMiOlt7Im5ldHdvcmtJZCI6MSwiY29udHJhY3RBZGRyZXNzIjoiMHhhYzhjM0Q1MjQyYjQyNURFMWI4NmIxN0U0MDdEOEU5NDlEOTk0MDEwIiwid2FsbGV0QWRkcmVzc2VzIjpbIjB4MDZBYTQxYjQxODlhRGQ3QjBFMTE0NEU3NEVhRmRFZTJiNkQ1MGUxMCJdfV0sImFtb3VudCI6MiwiY3VycmVuY3kiOiJFVEgiLCJkZXRhaWxzIjoiMHhmZTY3OWQyMDE5MDQzN2YxOGIxZGJhNDEzZmNjM2M1OGIyYzMyNjVkZTMwYzcyNGM4YzEyZDQzMzczNjJmMWExIn0%3D"
        "raw": "eyJ1dWlkIjoiNTQxMmEyZjMzMzAyNDIwZGExNjU1ZjI5Y2FhMWUxNGMiLCJkZXN0aW5hdGlvbnMiOlt7Im5ldHdvcmtJZCI6MSwiY29udHJhY3RBZGRyZXNzIjoiMHhhYzhjM0Q1MjQyYjQyNURFMWI4NmIxN0U0MDdEOEU5NDlEOTk0MDEwIiwid2FsbGV0QWRkcmVzc2VzIjpbIjB4MDZBYTQxYjQxODlhRGQ3QjBFMTE0NEU3NEVhRmRFZTJiNkQ1MGUxMCJdfV0sImFtb3VudCI6MiwiY3VycmVuY3kiOiJFVEgiLCJkZXRhaWxzIjoiMHhmZTY3OWQyMDE5MDQzN2YxOGIxZGJhNDEzZmNjM2M1OGIyYzMyNjVkZTMwYzcyNGM4YzEyZDQzMzczNjJmMWExIn0%3D"
    }
}

List

List all transfer performed by the daemon during this round. Filters can be applied.

Endpoint

.. http:get:: /invoices

Request

Name Required Description Default Value Example
count optional Amount to be transfered in wei 100 50
recipient optional Ethereum address to sent the transaction to   0x627306090abaB3A6e1400e9345bC60c78a8BEf57
sender optional Ethereum address used to perform the transaction SDK's ethereum address 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
amount optional Amount transfered in wei   1000000000000000000
nonce optional Identifier generated from invoice data   1270040570
status optional Status of the transaction confirmed confirmed, pending

Response

Array

Name Required Description Default Value Example
recipient required Ethereum address to sent the transaction to   0x627306090abaB3A6e1400e9345bC60c78a8BEf57
sender required Ethereum address used to perform the transaction SDK's ethereum address 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
amount required Amount transfered in wei   1000000000000000000
transactionId required Unique identifier of the transaction   1
status required Status of the transaction   confirmed, pending
nonce required Identifier generated from transaction   1270040570
created_on required Date the transaction has been performed (ISO format)   1970-01-01T00:00:00.000Z

Example

GET /invoices?nonce=1270040570 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
      "sender": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57",
      "recipient": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57",
      "amount": "1",
      "created_on": "2018-07-03T12:33:27.409540Z",
      "nonce": "1270040570",
      "txId": "420",
      "status": "confirmed"
  }
]