Link Search Menu Expand Document

Assets

Centrapay digital assets are resources that represent the ability for a Centrapay account to perform transactions where value is exchanged. Assets can be spent to satisfy Payment Requests, withdrawn to a bank account via Funds Transfers and sent to other Centrapay users via Asset Transfers.

Assets are categorized as either Money, Gift Cards or Tokens. Depending on its asset category, an asset will have different attributes available and different rules governing how it can be obtained, shared or spent.

Contents

Models

Asset

All assets have the following fields along with the additional fields that are specific to its category.

Required Fields

Field Type Description
id String The asset’s unique identifier.
accountId String The asset’s owning Centrapay account id.
category String Asset category (“money”, “giftcard”, or “token”).
type String Asset type id used by payment option asset types.
liveness String Either “main” (live payments allowed) or “test”.
description String Displayable asset description.
createdAt Timestamp Date when the asset was created or issued.
status String “active” if the asset can be used for payments.

Money

Money assets, being backed by real currency, are the most flexible asset types. Money is accepted for most payment requests, can be sent in arbitrary amounts and does not expire.

Money assets have the following fields along with the base asset fields.

Required Fields

Field Type Description
currency String Currency code, eg “NZD”
balance BigNumber Current balance in the currency’s smallest denomination (ie. cents).

Gift Cards

Gift cards are similar to money but have greater spending restrictions and are not always backed by real currency. Gift cards usually have an expiry date, are typically tied to a small number of merchants, and can only be sent in their entirety.

Gift cards have the following fields along with the base asset fields.

Required Fields

Field Type Description
issuer String The identifier for the issuer of the gift card.
currency String Currency code, eg “NZD”
balance BigNumber Current balance in the currency’s smallest denomination (ie. cents).
initialBalance BigNumber The balance when the asset was created.

Optional Fields

Field Type Description
externalId String The asset identifier from the issuing system.
expiresAt Timestamp The date when the asset expires.
balanceUpdatedAt Timestamp The date when the balance was last observed to be updated.

Tokens (EXPERIMENTAL)

Tokens are assets which can be spent only once. They are usually tied to a small set of merchants and have an expiry date. Token value may be set in multiple currencies and is the same for all tokens of the same type.

Tokens have the following fields along with the base asset fields.

Required Fields

Field Type Description
value Array The Monetary Amounts representing the token’s nominal value in its supported currencies.

Optional Fields

Field Type Description
validFrom Timestamp The date when the asset becomes spendable.
expiresAt Timestamp The date when the asset expires.

Operations

Get Asset

GET https://service.centrapay.com/api/assets/${id}

Get asset by asset id. Returned response can be any supported asset type (wallet or gift card).

curl -X GET "https://service.centrapay.com/api/assets/L75M3L56N2PtBSt8g7uXLU" \
  -H "x-api-key: 1234"

Example response payload

{
  "id": "L75M3L56N2PtBSt8g7uXLU",
  "accountId": "Te2uDM7xhDLWGVJU3nzwnh",
  "category": "giftcard",
  "type": "epay.nzd.main",
  "issuer": "ezipay",
  "externalId": "23403283262",
  "description": "$60 Acme Giftcard",
  "initialBalance": "6000",
  "balance": "6000",
  "balanceUpdatedAt": "2021-01-01T00:00:00.000Z",
  "expiresAt": "2020-12-31T00:00:00.000Z",
  "createdAt": "2020-05-01T12:30:00.000Z"
}

List Assets for Account

GET https://service.centrapay.com/api/accounts/${id}/assets

List asset by account id. Returned response can be an array of any supported asset types (wallet or gift card).

curl -X GET "https://service.centrapay.com/api/accounts/Te2uDM7xhDLWGVJU3nzwnh/assets" \
  -H "x-api-key: 1234"

Example response payload

{
  "items": [
    {
      "id": "L75M3L56N2PtBSt8g7uXLU",
      "accountId": "Te2uDM7xhDLWGVJU3nzwnh",
      "category": "giftcard",
      "type": "epay.nzd.main",
      "issuer": "ezipay",
      "externalId": "23403283262",
      "description": "$60 Acme Giftcard",
      "initialBalance": "6000",
      "balance": "6000",
      "balanceUpdatedAt": "2021-01-01T00:00:00.000Z",
      "expiresAt": "2020-12-31T00:00:00.000Z",
      "createdAt": "2020-05-01T12:30:00.000Z"
    },
    {
      "id": "3aKubx3wr9cUHFecRq5nFL",
      "accountId": "Te2uDM7xhDLWGVJU3nzwnh",
      "ledgerId": "centrapay.nzd.main",
      "type": "centrapay.nzd.main",
      "category": "money",
      "currency": "NZD",
      "balance": "2000"
    },
    {
      "id": "Aj7rtHmd7rDeWoJgw9MPHe",
      "accountId": "Te2uDM7xhDLWGVJU3nzwnh",
      "type": "cca.coke.main",
      "description": "Coke™ Token",
      "category": "token",
      "value": [
        {
          "currency": "NZD",
          "amount": "400"
        }
      ],
      "expiresAt": "2020-12-31T00:00:00.000Z",
      "createdAt": "2020-05-01T12:30:00.000Z"
    }
  ]
}

Archive Asset (EXPERIMENTAL)

POST https://service.centrapay.com/api/assets/${id}/archive

Archive supported asset types by asset id, currently only gift cards may be archived.

curl -X POST "https://service.centrapay.com/api/assets/L75M3L56N2PtBSt8g7uXLU/archive" \
  -H "x-api-key: 1234"

Example response payload

{
  "id": "L75M3L56N2PtBSt8g7uXLU",
  "accountId": "Te2uDM7xhDLWGVJU3nzwnh",
  "category": "giftcard",
  "type": "epay.nzd.main",
  "issuer": "ezipay",
  "externalId": "23403283262",
  "description": "$60 Acme Giftcard",
  "initialBalance": "6000",
  "balance": "0",
  "balanceUpdatedAt": "2021-01-01T00:00:00.000Z",
  "expiresAt": "2020-12-31T00:00:00.000Z",
  "createdAt": "2020-05-01T12:30:00.000Z",
  "status": "archived"
}

Error Responses

Status Code Description
403 UNSUPPORTED_ASSET_TYPE Asset type can not be archived