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

# 获取支付方式

> 使用 Bright Data 账号管理 API 的 GET /billing/pmethods 列出账户中已激活且已确认的支付方式，以及每种支付方式是否支持自动充值。

`GET /billing/pmethods` 端点返回 Bright Data 账户中已激活且已确认的支付方式。使用支付方式的 `id`，可通过[设置常规自动充值](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_regular_auto_recharge.md)或[设置数据集自动充值](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_dataset_auto_recharge.md)开启自动充值。

> [!TIP]
>
> 将您的 API key 粘贴到授权字段中。要获取 API key，请[创建账号](https://www.bright.cn/?hs_signup=1\&utm_source=docs\&utm_campaign=playground)，并查看[如何生成新的 API key？](https://docs.brightdata.com/cn/api-reference/authentication.md#如何生成新的-api-key？)

## 此端点需要哪种 API key 权限？

`GET /billing/pmethods` 需要 `billing.read` 权限。具有**管理员**或**财务**[权限级别](https://docs.brightdata.com/cn/api-reference/authentication.md#api-key-拥有哪些权限级别？)的 API key 拥有该权限。缺少该权限时，端点返回 HTTP 403 和纯文本消息。请在[账户设置](https://www.bright.cn/cp/setting/users)中管理 API key 权限。

## 如何列出我的支付方式？

调用 `GET /billing/pmethods`。此端点不接受任何参数：

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.brightdata.com/billing/pmethods"
```

响应中包含一个 `pmethods` 数组，每种支付方式对应一个条目。

## 响应结构是怎样的？

`pmethods` 数组中的每个条目描述一种支付方式：

| 字段 | 类型 | 说明 |
| - | - | - |
| `id` | string | 支付方式 ID。将此值作为 `pmethod_id` 传给自动充值端点 |
| `type` | string | 支付方式类型，例如 `ccard` |
| `primary` | boolean | 账户的主要支付方式为 `true` |
| `autorecharge_supported` | boolean | API 可以使用此支付方式开启自动充值时为 `true` |
| `card` | object | 仅限银行卡支付方式：`brand`、`last4`、`exp_month` 和 `exp_year` |
| `paypal` | object | 仅限 PayPal 支付方式：`email` |

## 哪些支付方式可用于自动充值？

使用 `autorecharge_supported` 为 `true` 的支付方式。如只需输出这些支付方式，可使用 [jq](https://jqlang.org/) 过滤响应：

```bash theme={null}
curl -s -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.brightdata.com/billing/pmethods" \
  | jq '.pmethods[] | select(.autorecharge_supported)'
```

如果支付方式不支持自动充值，自动充值端点会返回 HTTP 400，`error_code` 为 `pmethod_not_supported`。

## 账单端点有哪些速率限制？

账单端点允许每分钟 1,000 个请求、每小时 5,000 个请求。超出限制时，端点返回 HTTP 429 和纯文本响应体。

## 相关端点

* [获取自动充值设置](https://docs.brightdata.com/cn/api-reference/account-management-api/Get_auto_recharge_settings.md)。当前的常规自动充值和数据集自动充值设置。
* [设置常规自动充值](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_regular_auto_recharge.md)。开启或关闭常规自动充值，或修改充值金额。
* [总余额](https://docs.brightdata.com/cn/api-reference/account-management-api/Get_total_balance_through_API.md)。账户余额、积分、预付款和待付用量费用。


## OpenAPI

````yaml cn-openapi GET /billing/pmethods
openapi: 3.0.1
info:
  title: Bright Data API
  description: 将 Bright Data API 集成到您的流程中，以实现高端的爬取精度
  version: 1.0.0
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /billing/pmethods:
    get:
      description: 获取账户中已激活且已确认的支付方式。需要 `billing.read` 权限。
      operationId: listPaymentMethods
      responses:
        '200':
          description: 支付方式
          content:
            application/json:
              schema:
                type: object
                required:
                  - pmethods
                properties:
                  pmethods:
                    type: array
                    items:
                      $ref: '#/components/schemas/BillingPaymentMethod'
        '401':
          description: 身份验证失败
          content:
            text/plain:
              schema:
                type: string
              example: User authentication is required
        '403':
          description: API key 缺少所需权限
          content:
            text/plain:
              schema:
                type: string
              example: >-
                Your API key lacks the required permissions for this action. You
                can change your token permissions at
                https://brightdata.com/cp/setting/users
        '429':
          description: 超出速率限制（每分钟 1,000 个请求，每小时 5,000 个请求）
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    BillingPaymentMethod:
      type: object
      description: 账户中的一种支付方式。
      required:
        - id
        - type
        - primary
        - autorecharge_supported
      properties:
        id:
          type: string
          description: 支付方式 ID
          example: 64f0c2a1e4b0a1b2c3d4e5f6
        type:
          type: string
          description: 支付方式类型
          example: ccard
        primary:
          type: boolean
          description: 账户的主要支付方式为 `true`。
        autorecharge_supported:
          type: boolean
          description: API 可以在此支付方式上启用自动充值时为 `true`。
        card:
          type: object
          description: 银行卡详情。仅适用于银行卡支付方式。
          required:
            - brand
            - last4
            - exp_month
            - exp_year
          properties:
            brand:
              type: string
              example: visa
            last4:
              type: string
              pattern: ^[0-9]{4}$
              example: '4242'
            exp_month:
              type: integer
              minimum: 1
              maximum: 12
            exp_year:
              type: integer
              example: 2028
        paypal:
          type: object
          description: PayPal 详情。仅适用于 PayPal 支付方式。
          required:
            - email
          properties:
            email:
              type: string
              format: email
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。


        **认证方法:**

        1. 从 Bright Data 账户设置获取您的 API Key:
        https://brightdata.com/cp/setting/users

        2. 在请求的 Authorization 头中包含 API Key

        3. 格式: `Authorization: Bearer YOUR_API_KEY`


        **示例:**

        ```

        Authorization: Bearer
        b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

        ```


        了解如何获取 Bright Data API Key:
        https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key？
      bearerFormat: API Key

````