All Payments  [Go SDK]

This endpoint represents all payment-related operations that are part of validated transactions. This endpoint can also be used in streaming mode so it is possible to use it to listen for new payments as they get made in the DigitalBits network.

If called in streaming mode Frontier will start at the earliest known payment unless a cursor is set. In that case it will start from the cursor. You can also set cursor value to now to only stream payments created since your request time.

The operations that can be returned in by this endpoint are:

  • create_account
  • payment
  • path_payment
  • account_merge

Request

GET /payments{?cursor,limit,order,include_failed}

Arguments

name notes description example
?cursor optional, any, default null A paging token, specifying where to start returning records from. When streaming this can be set to now to stream object created since your request time. 12884905984
?order optional, string, default asc The order in which to return rows, “asc” or “desc”. asc
?limit optional, number, default: 10 Maximum number of records to return. 200
?include_failed optional, bool, default: false Set to true to include payments of failed transactions in results. true
?join optional, string, default: null Set to transactions to include the transactions which created each of the payments in the response. transactions

curl Example Request

# Retrieve the first 200 payments, ordered chronologically.
curl "https://frontier.testnet.digitalbits.io/payments?limit=200"
# Retrieve a page of payments to occur immediately before the transaction
# specified by the paging token "1234".
curl "https://frontier.testnet.digitalbits.io/payments?cursor=1234&order=desc"

JavaScript Example Request

var DigitalBitsSdk = require('digitalbits-sdk');
var server = new DigitalBitsSdk.Server('https://frontier.testnet.digitalbits.io');

server.payments()
  .call()
  .then(function (paymentResults) {
    console.log(paymentResults.records)
  })
  .catch(function (err) {
    console.log(err)
  })

JavaScript Streaming Example

var DigitalBitsSdk = require('digitalbits-sdk')
var server = new DigitalBitsSdk.Server('https://frontier.testnet.digitalbits.io');

var paymentHandler = function (paymentResponse) {
  console.log(paymentResponse);
};

var es = server.payments()
  .cursor('now')
  .stream({
    onmessage: paymentHandler
  })

Response

This endpoint responds with a list of payments. See operation resource for more information about operations (and payment operations).

Example Response

{
  "_embedded": {
    "records": [
      {
        "_links": {
          "effects": {
            "href": "/operations/77309415424/effects/{?cursor,limit,order}",
            "templated": true
          },
          "precedes": {
            "href": "/operations?cursor=77309415424&order=asc"
          },
          "self": {
            "href": "/operations/77309415424"
          },
          "succeeds": {
            "href": "/operations?cursor=77309415424&order=desc"
          },
          "transactions": {
            "href": "/transactions/77309415424"
          }
        },
        "account": "GBIA4FH6TV64KSPDAJCNUQSM7PFL4ILGUVJDPCLUOPJ7ONMKBBVUQHRO",
        "funder": "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ",
        "id": 77309415424,
        "paging_token": "77309415424",
        "starting_balance": 1e+14,
        "type_i": 0,
        "type": "create_account"
      },
      {
        "_links": {
          "effects": {
            "href": "/operations/463856472064/effects/{?cursor,limit,order}",
            "templated": true
          },
          "precedes": {
            "href": "/operations?cursor=463856472064&order=asc"
          },
          "self": {
            "href": "/operations/463856472064"
          },
          "succeeds": {
            "href": "/operations?cursor=463856472064&order=desc"
          },
          "transactions": {
            "href": "/transactions/463856472064"
          }
        },
        "account": "GC2ADYAIPKYQRGGUFYBV2ODJ54PY6VZUPKNCWWNX2C7FCJYKU4ZZNKVL",
        "funder": "GBIA4FH6TV64KSPDAJCNUQSM7PFL4ILGUVJDPCLUOPJ7ONMKBBVUQHRO",
        "id": 463856472064,
        "paging_token": "463856472064",
        "starting_balance": 1e+09,
        "type_i": 0,
        "type": "create_account"
      }
    ]
  },
  "_links": {
    "next": {
      "href": "?order=asc&limit=2&cursor=463856472064"
    },
    "prev": {
      "href": "?order=desc&limit=2&cursor=77309415424"
    },
    "self": {
      "href": "?order=asc&limit=2&cursor="
    }
  }
}

Example Streaming Event

{
  "_links": {
    "effects": {
      "href": "/operations/77309415424/effects/{?cursor,limit,order}",
      "templated": true
    },
    "precedes": {
      "href": "/operations?cursor=77309415424&order=asc"
    },
    "self": {
      "href": "/operations/77309415424"
    },
    "succeeds": {
      "href": "/operations?cursor=77309415424&order=desc"
    },
    "transactions": {
      "href": "/transactions/77309415424"
    }
  },
  "account": "GBIA4FH6TV64KSPDAJCNUQSM7PFL4ILGUVJDPCLUOPJ7ONMKBBVUQHRO",
  "funder": "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ",
  "id": 77309415424,
  "paging_token": "77309415424",
  "starting_balance": 1e+14,
  "type_i": 0,
  "type": "create_account"
}

Possible Errors


Edit this doc in GitHub

THE FUTURE OF LOYALTY STARTS HERE

Stay up to date on the latest happenings at DigitalBits. Get the latest news.