Skip to main content
GET
/
credit-entitlements
/
{credit_entitlement_id}
/
balances
/
{customer_id}
/
grants
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const balanceListGrantsResponse of client.creditEntitlements.balances.listGrants(
  'customer_id',
  { credit_entitlement_id: 'credit_entitlement_id' },
)) {
  console.log(balanceListGrantsResponse.id);
}
{
  "items": [
    {
      "created_at": "2023-11-07T05:31:56Z",
      "credit_entitlement_id": "<string>",
      "customer_id": "<string>",
      "id": "<string>",
      "initial_amount": "<string>",
      "is_expired": true,
      "is_rolled_over": true,
      "remaining_amount": "<string>",
      "rollover_count": 123,
      "source_type": "subscription",
      "updated_at": "2023-11-07T05:31:56Z",
      "expires_at": "2023-11-07T05:31:56Z",
      "metadata": {},
      "parent_grant_id": "<string>",
      "source_id": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

credit_entitlement_id
string
required

Credit Entitlement ID

customer_id
string
required

Customer ID

Query Parameters

page_size
integer<int32>

Page size default is 10 max is 100

Required range: x >= 0
page_number
integer<int32>

Page number default is 0

Required range: x >= 0
status
enum<string>

Filter by grant status: active, expired, depleted

Available options:
active,
expired,
depleted

Response

List of customer grants

items
object[]
required