Skip to content
Last updated

How to find and display a user's available earnings

What are DailyPay Available Earnings?

DailyPay Available Earnings is the portion of a user's balance that they can transfer before payday. The earnings available to transfer will never represent 100% of a user's earnings for a number of reasons, like tax or other withholding.

DailyPay automatically determines the percentage of earnings a user can transfer early. On payday, the user will receive the rest of their paycheck.

Displaying Available Earnings

Option 1: Load the Available Earnings Element

See our guide to embedding the available earnings element.

Option 2: Query the accounts endpoint

Using a user token

Using an authorization token obtained on behalf of a user using authorization code flow filter the accounts endpoint by account type:

curl -i -X GET \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'DailyPay-API-Version: 3' \
  'https://api.dailypay.com/rest/accounts?filter%5Baccount_type%5D=EARNINGS_BALANCE'  
An available earnings of $120.00 USD:
{
  "data": [
    {
      "id": "45298626-591f-4f55-ab31-49d3b8e5760c",
      "type": "accounts",
      "attributes": {
        "name": "DailyPay Available Earnings",
        "account_type": "EARNINGS_BALANCE",
        "subtype": "ODP",
        "balances": {
          "available": 12000, 
          "current": null,
          "currency": "USD"
        },
        ...
      },
      "relationships": {...},
      "links": {...}
    }
  ]
}

With client credentials

Using a client credentials authorization token filter the accounts endpoint by person id:

curl -i -X GET \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'DailyPay-API-Version: 3' \
  'https://api.dailypay.com/rest/accounts?filter%5Bperson.id%5D=b9fae0ef-4a19-4356-9e82-47b25bbe2f3a'  

Results will automatically be limited to EARNINGS_BALANCE account types:

An available earnings of $120.00 USD:
{
  "data": [
    {
      "id": "45298626-591f-4f55-ab31-49d3b8e5760c",
      "type": "accounts",
      "attributes": {
        "name": "DailyPay Available Earnings",
        "account_type": "EARNINGS_BALANCE", 
        "subtype": "ODP",
        "balances": {
          "available": 12000, 
          "current": null,
          "currency": "USD"
        },
        ...
      },
      "relationships": {
        "data": {
          "type": "people",
          "id": "b9fae0ef-4a19-4356-9e82-47b25bbe2f3a"
        }
      },
      "links": {...}
    }
  ]
}