跳转到主要内容
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>"
    }
  ]
}

授权

Authorization
string
header
必填

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

路径参数

credit_entitlement_id
string
必填

Credit Entitlement ID

customer_id
string
必填

Customer ID

查询参数

page_size
integer<int32>

Page size default is 10 max is 100

必填范围: x >= 0
page_number
integer<int32>

Page number default is 0

必填范围: x >= 0
status
enum<string>

Filter by grant status: active, expired, depleted

可用选项:
active,
expired,
depleted

响应

List of customer grants

items
object[]
必填