> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Liệt kê Quyền lợi Khách hàng

> Liệt kê tất cả các quyền lợi của một khách hàng trên mọi quyền, mỗi hàng một quyền, với các bộ lọc tùy chọn theo trạng thái và loại tích hợp. Các quyền cấp cờ tính năng bao gồm payload tính năng kiểu.



## OpenAPI

````yaml get /customers/{customer_id}/entitlement-grants
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.106.2
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
  - name: Payment Connector Webhooks
paths:
  /customers/{customer_id}/entitlement-grants:
    get:
      tags:
        - Entitlements
      summary: |-
        List all of a customer's entitlement grants across every entitlement.
        One row per grant.
      operationId: list_customer_grants_public_handler
      parameters:
        - name: customer_id
          in: path
          description: Customer ID
          required: true
          schema:
            type: string
          example: cus_TV52uJWWXt2yIoBBxpjaa
        - name: page_size
          in: query
          description: Page size (default 10, max 100)
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
          style: form
        - name: page_number
          in: query
          description: Page number (default 0)
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
          style: form
        - name: status
          in: query
          description: Filter by grant status
          required: false
          schema:
            type: string
            enum:
              - Pending
              - Delivered
              - Failed
              - Revoked
          style: form
        - name: integration_type
          in: query
          description: Filter by integration type (e.g. `feature_flag`)
          required: false
          schema:
            type: string
            enum:
              - discord
              - telegram
              - github
              - figma
              - framer
              - notion
              - digital_files
              - license_key
              - feature_flag
          style: form
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListEntitlementGrantsResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Customer not found
        '422':
          description: Validation error
        '500':
          description: Something went wrong
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            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 entitlementGrant of
            client.customers.listEntitlementGrants(
              'cus_TV52uJWWXt2yIoBBxpjaa',
            )) {
              console.log(entitlementGrant.id);
            }
        - lang: Python
          source: |-
            import os
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),  # This is the default and can be omitted
            )
            page = client.customers.list_entitlement_grants(
                customer_id="cus_TV52uJWWXt2yIoBBxpjaa",
            )
            page = page.items[0]
            print(page.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\tpage, err := client.Customers.ListEntitlementGrants(\n\t\tcontext.TODO(),\n\t\t\"cus_TV52uJWWXt2yIoBBxpjaa\",\n\t\tdodopayments.CustomerListEntitlementGrantsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - lang: Java
          source: >-
            package com.dodopayments.api.example;


            import com.dodopayments.api.client.DodoPaymentsClient;

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;

            import
            com.dodopayments.api.models.customers.CustomerListEntitlementGrantsPage;

            import
            com.dodopayments.api.models.customers.CustomerListEntitlementGrantsParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

                    CustomerListEntitlementGrantsPage page = client.customers().listEntitlementGrants("cus_TV52uJWWXt2yIoBBxpjaa");
                }
            }
        - lang: Kotlin
          source: >-
            package com.dodopayments.api.example


            import com.dodopayments.api.client.DodoPaymentsClient

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient

            import
            com.dodopayments.api.models.customers.CustomerListEntitlementGrantsPage

            import
            com.dodopayments.api.models.customers.CustomerListEntitlementGrantsParams


            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val page: CustomerListEntitlementGrantsPage = client.customers().listEntitlementGrants("cus_TV52uJWWXt2yIoBBxpjaa")
            }
        - lang: Ruby
          source: >-
            require "dodopayments"


            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )


            page =
            dodo_payments.customers.list_entitlement_grants("cus_TV52uJWWXt2yIoBBxpjaa")


            puts(page)
        - lang: PHP
          source: |-
            <?php

            require_once dirname(__DIR__) . '/vendor/autoload.php';

            use Dodopayments\Client;
            use Dodopayments\Core\Exceptions\APIException;

            $client = new Client(
              bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
              environment: 'test_mode',
            );

            try {
              $page = $client->customers->listEntitlementGrants(
                'cus_TV52uJWWXt2yIoBBxpjaa',
                integrationType: 'discord',
                pageNumber: 0,
                pageSize: 0,
                status: 'Pending',
              );

              var_dump($page);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using DodoPayments.Client;
            using DodoPayments.Client.Models.Customers;

            DodoPaymentsClient client = new();

            CustomerListEntitlementGrantsParams parameters = new()
            {
                CustomerID = "cus_TV52uJWWXt2yIoBBxpjaa"
            };

            var page = await client.Customers.ListEntitlementGrants(parameters);
            await foreach (var item in page.Paginate())
            {
                Console.WriteLine(item);
            }
        - lang: Rust
          source: |-
            use dodopayments::Client;

            #[tokio::main]
            async fn main() -> dodopayments::Result<()> {
                let client = Client::from_env()?;
                let customer_id = "customer_id";
                let result = client
                    .customers()
                    .list_entitlement_grants()
                    .customer_id(customer_id)
                    .query(serde_json::json!({}))
                    .await?;
                println!("{result:?}");
                Ok(())
            }
components:
  schemas:
    ListEntitlementGrantsResponse:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/EntitlementGrantResponse'
    EntitlementGrantResponse:
      type: object
      description: |-
        Detailed view of a single entitlement grant: who it's for, its
        lifecycle state, and any integration-specific delivery payload.
      required:
        - id
        - business_id
        - entitlement_id
        - customer_id
        - status
        - metadata
        - integration_type
        - created_at
        - updated_at
        - brand_id
      properties:
        brand_id:
          type: string
          description: Brand id this grant belongs to.
        business_id:
          type: string
          description: Identifier of the business that owns the grant.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the grant was created.
        customer_id:
          type: string
          description: Identifier of the customer the grant was issued to.
        delivered_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Timestamp when the grant transitioned to `delivered`, when
            applicable.
        digital_product_delivery:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DigitalProductDelivery'
              description: |-
                Digital-product-delivery payload, present when the entitlement
                integration is `digital_files`.
        entitlement_id:
          type: string
          description: Identifier of the entitlement this grant was issued from.
        error_code:
          type:
            - string
            - 'null'
          description: >-
            Machine-readable code reported when delivery failed, when
            applicable.
        error_message:
          type:
            - string
            - 'null'
          description: >-
            Human-readable message reported when delivery failed, when
            applicable.
        feature:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Feature'
              description: >-
                Typed feature payload, present only when the entitlement
                integration is

                `feature_flag`; `null` for every other integration type.
        id:
          type: string
          description: Unique identifier of the grant.
        integration_type:
          $ref: '#/components/schemas/EntitlementIntegrationType'
          description: >-
            The integration type of the grant's entitlement (e.g.
            `license_key`).
        license_key:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LicenseKeyGrant'
              description: >-
                License-key delivery payload, present when the entitlement
                integration

                is `license_key`.
        metadata:
          $ref: '#/components/schemas/Metadata'
          description: Arbitrary key-value metadata recorded on the grant.
        oauth_expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp when `oauth_url` stops being valid, when applicable.
        oauth_url:
          type:
            - string
            - 'null'
          description: |-
            Customer-facing OAuth URL for OAuth-style integrations. Populated
            during the customer-portal accept flow; `null` until the customer
            completes that step, and on grants for non-OAuth integrations.
        payment_id:
          type:
            - string
            - 'null'
          description: >-
            Identifier of the payment that triggered this grant, when
            applicable.
        revocation_reason:
          type:
            - string
            - 'null'
          description: Reason recorded when the grant was revoked, when applicable.
        revoked_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp when the grant transitioned to `revoked`, when applicable.
        status:
          $ref: '#/components/schemas/EntitlementGrantStatus'
          description: Lifecycle status of the grant.
        subscription_id:
          type:
            - string
            - 'null'
          description: >-
            Identifier of the subscription that triggered this grant, when
            applicable.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the grant was last modified.
    DigitalProductDelivery:
      type: object
      title: Digital Product Delivery
      description: |-
        Digital-product-delivery payload, present on grants for `digital_files`
        entitlements. Each file carries a short-lived presigned download URL.
      required:
        - files
      properties:
        external_url:
          type:
            - string
            - 'null'
          description: |-
            Optional external URL, passed through from the entitlement
            configuration.
        files:
          type: array
          items:
            $ref: '#/components/schemas/DigitalProductDeliveryFile'
          description: One entry per attached file.
        instructions:
          type:
            - string
            - 'null'
          description: |-
            Optional human-readable delivery instructions, passed through from
            the entitlement configuration.
    Feature:
      type: object
      description: Capability conferred by a `feature_flag` grant.
      required:
        - feature_type
        - feature_id
      properties:
        feature_id:
          type: string
          description: Identifier of the capability this grant confers.
        feature_type:
          $ref: '#/components/schemas/FeatureType'
          description: Type of capability conferred.
    EntitlementIntegrationType:
      type: string
      enum:
        - discord
        - telegram
        - github
        - figma
        - framer
        - notion
        - digital_files
        - license_key
        - feature_flag
    LicenseKeyGrant:
      type: object
      description: |-
        License-key delivery payload, present on grants for `license_key`
        entitlements. The grant's top-level `status` is the source of truth
        for the grant's lifecycle.
      required:
        - key
        - activations_used
      properties:
        activations_limit:
          type:
            - integer
            - 'null'
          format: int32
          description: Maximum activations allowed by the entitlement, when set.
        activations_used:
          type: integer
          format: int32
          description: Number of activations consumed so far.
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the license key expires, when applicable.
        key:
          type: string
          description: Issued license key.
    Metadata:
      type: object
      title: Metadata
      description: >-
        Arbitrary key-value metadata. Values can be string, integer, number, or
        boolean.
      additionalProperties:
        oneOf:
          - type: string
            title: String
          - type: integer
            title: Integer
            format: int64
          - type: number
            title: Number
            format: double
          - type: boolean
            title: Boolean
        title: Metadata Value
        description: Metadata value can be a string, integer, number, or boolean
    EntitlementGrantStatus:
      type: string
      enum:
        - Pending
        - Delivered
        - Failed
        - Revoked
    DigitalProductDeliveryFile:
      type: object
      title: Digital Product Delivery File
      description: One file in a digital-product delivery payload.
      required:
        - file_id
        - download_url
        - filename
        - expires_in
      properties:
        content_type:
          type:
            - string
            - 'null'
          description: Optional content-type declared at upload.
        download_url:
          type: string
          description: Short-lived presigned URL for downloading the file.
        expires_in:
          type: integer
          format: int64
          description: Seconds until `download_url` expires.
        file_id:
          type: string
          description: Identifier of the attached file.
        file_size:
          type:
            - integer
            - 'null'
          format: int64
          description: Optional size of the file in bytes.
        filename:
          type: string
          description: Original filename of the attached file.
    FeatureType:
      type: string
      description: Type of capability a `feature_flag` entitlement confers.
      enum:
        - boolean
      x-stainless-const: true
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````