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

# 查询可用订阅模板

> 查询授权商户及指定业务范围内可用的订阅模板。仅返回 ACTIVE、已启用、非阶梯且非 By agreement 的模板，按创建时间倒序排列。价格筛选针对模板最新价格。区间参数须由调用方保证起点不大于终点。

列表用于选择候选模板，创建订阅时仍须校验模板定价、启用的收费段和所需日期；不满足创建条件时返回业务失败。

所有示例均为格式示例，客户、订单、卡及账户数据须替换为测试环境获准使用的数据。BASE_URL 为服务根域名，不附加 /api/v2；ACCESS_TOKEN 为 /oauth/token 返回的 access_token。日期示例为 2030 年，执行时请改为满足当前日期限制的实际日期。



## OpenAPI

````yaml /openapi/billbuddy-v2-openapi.yaml get /api/v2/plan/list
openapi: 3.0.3
info:
  title: BillBuddy API 接入文档
  version: 2.0.0
  description: >
    BillBuddy API
    接入文档，本文收录第三方服务端主动调用的认证、交易和订阅接口。请求与响应示例均使用完整但虚构的业务数据及离线生成的演示令牌，不能用于实际认证或交易。


    ## 接入步骤

    1. 向 BillBuddy 获取 Client ID、Client Secret、商户标识及业务标识。如启用 IP 白名单，请使用已获准的固定出口
    IP 调用。

    2. 通过 POST /oauth/token 获取 access_token。业务请求携带 Authorization: Bearer
    {access_token} 和 Accept: application/json。JSON 请求使用 Content-Type:
    application/json；获取令牌使用表单。

    3. 按需调用支付或订阅接口。客户通过 activation_url 打开托管激活页；Client Secret 仅可保存在商户服务端。


    ## 标识及金额

    商户身份由 OAuth 凭据确定，无需在请求中传 business_id。需要指定业务的接口使用 merchant_id；单笔交易查询和批次结果查询的
    merchant_id 可选，省略或为空时在当前商户全部业务范围内查询；交易列表使用可选的
    Mid（区分大小写），省略时查询当前商户的全部业务。业务标识必须属于凭据所属商户。响应中的标识请按各接口字段说明读取。

    除 TXT 批量上传文件及其 amount_cents/declared_total_amount_cents
    使用分外，金额使用主货币单位，最多两位小数，例如 10.50 表示 AUD 10.50。银行账号、卡号、月份、年份和邮编建议使用字符串，以保留前导零。


    ## 成功和失败

    业务 JSON 成功 code=0，常规失败 code=1。交易及订阅业务接口参数校验失败通常为 code=400、data={}，HTTP 状态仍为
    200。V2 业务接口认证失败为 code=1，plan/list 标识业务校验失败为 code=1。HTTP 429 表示请求超过频率限制。OAuth
    端点采用标准 OAuth 响应（HTTP 200/400/401/429）。

    code=0 表示接口处理成功，扣款结果须另行判断：批量 accepted 仅表示请求已受理，将异步处理；银行 Pending、预约 Pending 和
    3DS 待验证均不代表支付成功。交易、DDR 订阅和扣费计划各自使用不同的 status 枚举，请参阅对应字段说明。


    ## 日期及频率

    请求日期建议使用 YYYY-MM-DD。今天及明天均按服务业务时区 Australia/Sydney 计算（适用夏令时）；预约取消时间以
    Australia/Sydney 为准（适用夏令时），仅允许在处理日 08:15 之前取消，到达该时刻即不可取消。支付 complete_date
    与收银台 expires_at 使用 DD/MM/YYYY HH:mm:ss，其他时间格式见字段说明。

    RRULE 标准示例：Daily FREQ=DAILY;INTERVAL=1；Weekly
    FREQ=WEEKLY;INTERVAL=1;BYDAY=MO；Fortnightly
    FREQ=WEEKLY;INTERVAL=2;BYDAY=MO；Monthly
    FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=15；Quarterly
    FREQ=MONTHLY;INTERVAL=3;BYMONTHDAY=15；Half Yearly
    FREQ=MONTHLY;INTERVAL=6;BYMONTHDAY=15；Yearly
    FREQ=YEARLY;INTERVAL=1;BYMONTH=2;BYMONTHDAY=15。星期缩写为
    MO/TU/WE/TH/FR/SA/SU。Weekly/Monthly 省略具体扣费日时按起算日确定；单一 BYDAY=SA 或 SU
    按周一处理，未指定具体日期且起算日在周末时也按周一处理。单值 BYMONTHDAY=29/30/31 在短月按月末处理；BYMONTHDAY=-1
    表示月底。所有规则须符合有效 RRULE 格式。

    非标准频率（如每 10 天）须同时传 process_type=12、custom_cycle_type=1、custom_cycle=10，且
    day_of_debit=FREQ=DAILY;INTERVAL=10。单位 1/2/3/4 对应
    DAILY/WEEKLY/MONTHLY/YEARLY，以天为单位时间隔最小为 5，其余单位最小为 1，INTERVAL 须等于
    custom_cycle。季度、半年及年度还须提供 day_of_debit_dtstart；完整日期须严格晚于同段
    start_date，并在其后一个计费周期内。createSchedule 的实际首次扣费日期由 DDR 起算日、扣费频率及最早明天的限制共同确定。


    ## 使用示例

    参数类型、可空、长度、枚举及数值范围见 Schema；条件必填、日期及业务限制见字段 description。请结合两者使用。curl 示例中的
    BASE_URL、ACCESS_TOKEN、CLIENT_ID 和 CLIENT_SECRET 需由调用方设置；实际测试或生产域名由 BillBuddy
    提供。示例中的客户、订单、卡号、账户及日期须替换为测试环境允许使用且满足日期限制的数据。


    ## 托管订阅接入

    调用 POST /api/v2/subscription/create 创建订阅，取得 activation_url 后原样用于浏览器跳转或
    iframe 的 src；也可将 activation_html 用作 iframe 的 srcdoc。客户在 BillBuddy
    提供的页面填写支付信息并完成授权和激活。请使用返回的完整链接，无需自行拼接地址或解析链接中的凭证。Client Secret 和
    access_token 仅保存在商户服务端，不得放入 iframe 地址或页面内容。


    周期订阅及 By agreement 须在 start_date 当天之前激活；纯一次性订阅须在创建后 30
    天内提交激活。页面可以打开不保证仍可提交，以激活接口结果为准。


    ## 示例数据约定

    示例中的商户、客户、订单、支付 Token、会话链接和 OAuth 凭据均为虚构，不能用于真实调用。银行卡使用标准测试卡号；银行账户为虚构账户；邮箱使用
    example.com 保留域名，电话号码使用澳大利亚保留的演示号码。请求中的 BASE_URL、ACCESS_TOKEN、CLIENT_ID 和
    CLIENT_SECRET 仍需替换为获准测试环境的实际值。示例中必要的空字符串、null、空数组、0 和 false
    表示实际接口状态，不能统一替换为非空值。

    支付响应的 sign 按各支付场景的签名规则，使用公开演示密钥 bb_docs_demo_signing_key_2030 离线计算。3DS
    待验证响应的 html 不参与签名计算。该密钥仅用于文档，不能用于实际签名或认证。


    ## TXT 批量交易

    使用 multipart/form-data 上传固定宽度 TXT 文件。文件金额及
    amount_cents、declared_total_amount_cents 均以分计，不含附加费；文件格式和示例文件见“上传 TXT
    批量交易文件”。上传成功仅表示已接收，请保存 batch_id 和 file_identifier，并使用批次结果接口查询逐笔状态。批次
    completed 不代表所有支付成功。查询结果须使用同一商户的 OAuth 凭据；merchant_id
    可省略，如传入则须与原上传请求的业务标识一致。响应字段含义以对应接口说明为准。


    ## 开发语言请求示例

    请求示例提供 cURL、Python、JavaScript、PHP、Go、Java 和 Ruby，同一语言下可切换各业务场景。各语言使用与 cURL
    对应场景相同的请求参数和类型。


    运行环境：cURL；Python 3.9+（标准库）；JavaScript 使用 Node.js 18+，保存为 .mjs 后运行；PHP 8+ 并启用
    cURL 扩展；Go 1.20+；Java 11+（示例类名为 Example，保存为 Example.java）；Ruby 3+（标准库）。


    运行前设置 BASE_URL；业务接口还需设置 ACCESS_TOKEN，获取令牌需设置 CLIENT_ID 和
    CLIENT_SECRET。BASE_URL 使用 API 根地址，不附加 /api/v2。TXT 上传示例从当前目录读取
    payments.txt。请先替换为获准测试数据，并结合响应 code 和业务状态判断结果。
servers:
  - url: https://staging-api.billbuddyhq.com
    description: Staging 测试环境
security:
  - oauth2: []
tags:
  - name: 认证
    description: OAuth2 Client Credentials。
  - name: 交易
    description: 单笔、批量与预约取消。
  - name: 订阅
    description: 订阅模板、创建订阅、创建并激活 DDR 及推送扣费计划。
paths:
  /api/v2/plan/list:
    get:
      tags:
        - 订阅
      summary: 查询可用订阅模板
      description: >-
        查询授权商户及指定业务范围内可用的订阅模板。仅返回 ACTIVE、已启用、非阶梯且非 By agreement
        的模板，按创建时间倒序排列。价格筛选针对模板最新价格。区间参数须由调用方保证起点不大于终点。


        列表用于选择候选模板，创建订阅时仍须校验模板定价、启用的收费段和所需日期；不满足创建条件时返回业务失败。


        所有示例均为格式示例，客户、订单、卡及账户数据须替换为测试环境获准使用的数据。BASE_URL 为服务根域名，不附加
        /api/v2；ACCESS_TOKEN 为 /oauth/token 返回的 access_token。日期示例为 2030
        年，执行时请改为满足当前日期限制的实际日期。
      operationId: v2PlanList
      parameters:
        - name: merchant_id
          in: query
          required: true
          description: 业务标识，由 BillBuddy 分配；必填，最长 20 字符，须属于 OAuth 凭据所属商户。
          schema:
            type: string
            description: 业务标识，由 BillBuddy 分配；必填，最长 20 字符，须属于 OAuth 凭据所属商户。
            maxLength: 20
        - name: page
          in: query
          required: false
          description: 页码，默认 1。
          schema:
            type: integer
            description: 页码，默认 1。
            minimum: 1
            nullable: true
            default: 1
        - name: page_size
          in: query
          required: false
          description: 每页条数，默认 20，最大值未限定。
          schema:
            type: integer
            description: 每页条数，默认 20，最大值未限定。
            minimum: 1
            nullable: true
            default: 20
        - name: name
          in: query
          required: false
          description: 模板名称模糊匹配。
          schema:
            type: string
            description: 模板名称模糊匹配。
            nullable: true
            maxLength: 255
        - name: frequency
          in: query
          required: false
          description: >-
            模板扣款频率：1 One-off、3 Weekly、4 Fortnightly、5 Monthly、6 Quarterly、7 Half
            Yearly、8 Yearly、12 Custom。
          schema:
            type: integer
            description: >-
              模板扣款频率：1 One-off、3 Weekly、4 Fortnightly、5 Monthly、6 Quarterly、7
              Half Yearly、8 Yearly、12 Custom。
            nullable: true
            enum:
              - 1
              - 3
              - 4
              - 5
              - 6
              - 7
              - 8
              - 12
              - null
        - name: min_price
          in: query
          required: false
          description: >-
            模板最新价格的下限。 金额以主货币单位计，例如 10.50 表示 AUD 10.50，最多两位小数。接受数值或数字字符串，最小
            0，两种类型遵守相同范围限制。
          schema:
            oneOf:
              - type: number
                multipleOf: 0.01
                minimum: 0
                nullable: true
              - type: string
                pattern: ^\d+(\.\d{1,2})?$
            description: >-
              模板最新价格的下限。 金额以主货币单位计，例如 10.50 表示 AUD 10.50，最多两位小数。接受数值或数字字符串，最小
              0，两种类型遵守相同范围限制。
            nullable: true
        - name: max_price
          in: query
          required: false
          description: >-
            模板最新价格的上限。 金额以主货币单位计，例如 10.50 表示 AUD 10.50，最多两位小数。接受数值或数字字符串，最小
            0，两种类型遵守相同范围限制。
          schema:
            oneOf:
              - type: number
                multipleOf: 0.01
                minimum: 0
                nullable: true
              - type: string
                pattern: ^\d+(\.\d{1,2})?$
            description: >-
              模板最新价格的上限。 金额以主货币单位计，例如 10.50 表示 AUD 10.50，最多两位小数。接受数值或数字字符串，最小
              0，两种类型遵守相同范围限制。
            nullable: true
        - name: start_create
          in: query
          required: false
          description: 创建日期起点，含当日 00:00:00。 必须使用 YYYY-MM-DD。
          schema:
            type: string
            description: 创建日期起点，含当日 00:00:00。 必须使用 YYYY-MM-DD。
            format: date
            nullable: true
        - name: end_create
          in: query
          required: false
          description: 创建日期终点，含当日 23:59:59。 必须使用 YYYY-MM-DD。
          schema:
            type: string
            description: 创建日期终点，含当日 23:59:59。 必须使用 YYYY-MM-DD。
            format: date
            nullable: true
        - name: start_update
          in: query
          required: false
          description: 更新日期起点，含当日 00:00:00。 必须使用 YYYY-MM-DD。
          schema:
            type: string
            description: 更新日期起点，含当日 00:00:00。 必须使用 YYYY-MM-DD。
            format: date
            nullable: true
        - name: end_update
          in: query
          required: false
          description: 更新日期终点，含当日 23:59:59。 必须使用 YYYY-MM-DD。
          schema:
            type: string
            description: 更新日期终点，含当日 23:59:59。 必须使用 YYYY-MM-DD。
            format: date
            nullable: true
      responses:
        '200':
          description: HTTP 200。成功、业务失败、参数校验失败或业务鉴权失败以响应体 code 区分。
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PlanListResponse'
                  - $ref: '#/components/schemas/BusinessError'
              examples:
                success:
                  summary: 分页成功
                  value:
                    code: 0
                    message: ok
                    data:
                      data:
                        - plan_id: TPL62038591
                          plan_name: Monthly membership
                          description: Monthly subscription template
                          status: 1
                          invoice_account_code: null
                          invoice_theme_id: null
                          surcharge_config:
                            direct_debit_surcharge: false
                            visa_domestic_surcharge: false
                            visa_international_surcharge: false
                            mastercard_domestic_surcharge: false
                            mastercard_international_surcharge: false
                            amex_domestic_surcharge: false
                            amex_international_surcharge: false
                          surcharge_config_enabled: []
                          surcharge_config_selected: []
                          recurring:
                            enabled: 1
                            schedule_name: Monthly fee
                            recurring_type: 3
                            amount: '25.50'
                            total_amount: null
                            start_date: null
                            end_date: null
                            end_terms: null
                            day_of_debit: FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=15
                            day_of_debit_dtstart: null
                            process_type: 5
                            custom_cycle_type: 0
                            custom_cycle: 0
                            custom_cycle_type_text: ''
                            frequency: Monthly
                          one_off:
                            enabled: 0
                            schedule_name: null
                            amount: null
                            description: null
                            payment_date: null
                          created_at: '2026-10-28 09:00:00'
                          updated_at: '2026-10-28 09:00:00'
                          deleted_at: null
                      current_page: 1
                      per_page: 20
                      total: 1
                invalidIdentifiers:
                  summary: ID 错误
                  value:
                    code: 1
                    message: Business id is invalid
                    data: {}
        '429':
          description: >-
            请求超过频率限制。API 请求共享每分钟 120 次的限额，通常按请求来源 IP 计数，并非每个接口单独 120 次。请遵循
            Retry-After 指定的等待秒数。
          headers:
            Retry-After:
              description: 再次请求前应等待的秒数。
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                description: 请求频率超限响应。
                properties:
                  message:
                    type: string
                    description: 限流提示。
              example:
                message: Too Many Attempts.
      security:
        - oauth2: []
      x-codeSamples:
        - lang: Shell
          label: 请求示例
          source: |-
            curl --get "${BASE_URL}/api/v2/plan/list" \
              -H "Authorization: Bearer ${ACCESS_TOKEN}" \
              -H "Accept: application/json" \
              --data-urlencode merchant_id=48290713 \
              --data-urlencode page=1 \
              --data-urlencode page_size=20
        - lang: Python
          label: 请求示例
          source: >
            import json

            import os

            import urllib.parse

            import urllib.request


            base_url = os.environ["BASE_URL"].rstrip("/")

            url = base_url + "/api/v2/plan/list"

            headers = {"Accept": "application/json"}

            headers["Authorization"] = "Bearer " + os.environ["ACCESS_TOKEN"]

            params = {
                "merchant_id": "48290713",
                "page": "1",
                "page_size": "20",
            }

            url += "?" + urllib.parse.urlencode(params)

            body = None


            request = urllib.request.Request(url, data=body, headers=headers,
            method="GET")

            with urllib.request.urlopen(request, timeout=30) as response:
                print(response.read().decode("utf-8"))
        - lang: JavaScript
          label: 请求示例
          source: |
            const env = (name) => {
              const value = process.env[name];
              if (!value) throw new Error(`Missing environment variable: ${name}`);
              return value;
            };
            const baseUrl = env("BASE_URL").replace(/\/+$/, "");
            const url = new URL(baseUrl + "/api/v2/plan/list");
            const headers = { Accept: "application/json" };
            headers.Authorization = `Bearer ${env("ACCESS_TOKEN")}`;
            const params = new URLSearchParams({
              "merchant_id": "48290713",
              "page": "1",
              "page_size": "20",
            });
            url.search = params.toString();

            const response = await fetch(url, {
              method: "GET",
              headers,
              signal: AbortSignal.timeout(30_000),
            });
            console.log(await response.text());
        - lang: PHP
          label: 请求示例
          source: |
            <?php
            $env = static function (string $name): string {
                $value = getenv($name);
                if ($value === false || $value === '') {
                    throw new RuntimeException("Missing environment variable: " . $name);
                }
                return $value;
            };
            $baseUrl = rtrim($env('BASE_URL'), '/');
            $url = $baseUrl . "/api/v2/plan/list";
            $headers = ['Accept: application/json'];
            $headers[] = 'Authorization: Bearer ' . $env('ACCESS_TOKEN');
            $params = [
                "merchant_id" => "48290713",
                "page" => "1",
                "page_size" => "20",
            ];
            $url .= '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);

            $curl = curl_init($url);
            curl_setopt_array($curl, [
                CURLOPT_CUSTOMREQUEST => "GET",
                CURLOPT_HTTPHEADER => $headers,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_TIMEOUT => 30,
            ]);
            $response = curl_exec($curl);
            if ($response === false) {
                $error = curl_error($curl);
                curl_close($curl);
                throw new RuntimeException($error);
            }
            curl_close($curl);
            echo $response, PHP_EOL;
        - lang: Go
          label: 请求示例
          source: |
            package main

            import (
                "fmt"
                "io"
                "net/http"
                "net/url"
                "os"
                "strings"
                "time"
            )

            func mustEnv(name string) string {
                value := os.Getenv(name)
                if value == "" { panic("Missing environment variable: " + name) }
                return value
            }

            func main() {
                baseURL := strings.TrimRight(mustEnv("BASE_URL"), "/")
                endpoint := baseURL + "/api/v2/plan/list"
                params := url.Values{}
                params.Set("merchant_id", "48290713")
                params.Set("page", "1")
                params.Set("page_size", "20")
                endpoint += "?" + params.Encode()
                req, err := http.NewRequest("GET", endpoint, nil)
                if err != nil { panic(err) }
                req.Header.Set("Accept", "application/json")
                req.Header.Set("Authorization", "Bearer " + mustEnv("ACCESS_TOKEN"))
                client := &http.Client{Timeout: 30 * time.Second}
                response, err := client.Do(req)
                if err != nil { panic(err) }
                defer response.Body.Close()
                result, err := io.ReadAll(response.Body)
                if err != nil { panic(err) }
                fmt.Println(string(result))
            }
        - lang: Java
          label: 请求示例
          source: |
            import java.io.ByteArrayOutputStream;
            import java.net.URI;
            import java.net.URLEncoder;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;
            import java.nio.charset.StandardCharsets;
            import java.nio.file.Files;
            import java.nio.file.Path;
            import java.time.Duration;
            import java.util.LinkedHashMap;
            import java.util.Map;
            import java.util.UUID;
            import java.util.stream.Collectors;

            public class Example {
                static String requireEnv(String name) {
                    String value = System.getenv(name);
                    if (value == null || value.isEmpty()) {
                        throw new IllegalArgumentException("Missing environment variable: " + name);
                    }
                    return value;
                }

                public static void main(String[] args) throws Exception {
                    String baseUrl = requireEnv("BASE_URL").replaceAll("/+$", "");
                    String endpoint = baseUrl + "/api/v2/plan/list";
                    Map<String, String> params = new LinkedHashMap<>();
                    params.put("merchant_id", "48290713");
                    params.put("page", "1");
                    params.put("page_size", "20");
                    String encoded = params.entrySet().stream()
                        .map(e -> URLEncoder.encode(e.getKey(), StandardCharsets.UTF_8) + "="
                            + URLEncoder.encode(e.getValue(), StandardCharsets.UTF_8))
                        .collect(Collectors.joining("&"));
                    endpoint += "?" + encoded;
                    HttpRequest.Builder builder = HttpRequest.newBuilder(URI.create(endpoint))
                        .timeout(Duration.ofSeconds(30))
                        .header("Accept", "application/json");
                    builder.header("Authorization", "Bearer " + requireEnv("ACCESS_TOKEN"));
                    HttpRequest request = builder.method("GET", HttpRequest.BodyPublishers.noBody()).build();
                    HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(30)).build();
                    HttpResponse<String> response = client.send(request,
                        HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
                    System.out.println(response.body());
                }
            }
        - lang: Ruby
          label: 请求示例
          source: |
            require "net/http"
            require "uri"

            base_url = ENV.fetch("BASE_URL").sub(%r{/+$}, "")
            uri = URI(base_url + "/api/v2/plan/list")
            params = {
              "merchant_id" => "48290713",
              "page" => "1",
              "page_size" => "20",
            }
            uri.query = URI.encode_www_form(params)
            request = Net::HTTP::Get.new(uri)
            request["Accept"] = "application/json"
            request["Authorization"] = "Bearer " + ENV.fetch("ACCESS_TOKEN")
            http = Net::HTTP.new(uri.host, uri.port)
            http.use_ssl = uri.scheme == "https"
            http.open_timeout = 30
            http.read_timeout = 30
            puts http.request(request).body
components:
  schemas:
    PlanListResponse:
      type: object
      description: 成功响应。
      properties:
        code:
          type: integer
          description: 0 表示模板列表查询成功。
          enum:
            - 0
        message:
          type: string
          description: 响应说明。
        data:
          type: object
          description: 分页结构；注意模板数组位于 data.data。
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/PlanTemplate'
              description: 当前页模板列表。
            current_page:
              type: integer
              description: 当前页码。
            per_page:
              type: integer
              description: 每页条数。
            total:
              type: integer
              description: 匹配的模板总数。
          required:
            - data
            - current_page
            - per_page
            - total
      required:
        - code
        - message
        - data
    BusinessError:
      type: object
      description: 业务错误。HTTP 通常仍为 200。
      properties:
        code:
          type: integer
          description: 业务失败、认证失败为 1；Request 参数及文件属性校验失败为 400。
          enum:
            - 1
            - 400
        message:
          type: string
          description: 错误原因，具体文案会因失败原因不同而变化。
        data:
          oneOf:
            - type: object
              description: 空对象或错误上下文。
              properties:
                customer_id:
                  type: string
                  description: createDdr 后续步骤失败时，可能返回已创建并保留的客户 ID；重试可使用此 ID。
            - type: array
              items: {}
              description: 通常为空数组。
          description: 错误数据，可能为 []、{} 或包含 customer_id 的客户上下文。
      required:
        - code
        - message
        - data
    PlanTemplate:
      type: object
      description: 可供 V2 创建使用的模板。
      properties:
        plan_id:
          type: string
          description: 模板 ID。
          nullable: true
        plan_name:
          type: string
          description: 模板名称。
          nullable: true
        description:
          type: string
          description: 模板说明。
          nullable: true
        status:
          type: integer
          description: 模板状态，当前列表只返回 1 Active。
          nullable: true
          enum:
            - 1
            - null
        invoice_account_code:
          type: string
          description: 发票会计科目代码。
          nullable: true
        invoice_theme_id:
          type: string
          description: 发票主题 ID。
          nullable: true
        surcharge_config:
          type: object
          description: 各类附加费的启用状态，值为布尔类型。
          properties:
            direct_debit_surcharge:
              type: boolean
              description: 附加费选项 direct_debit_surcharge 是否开启。
            visa_domestic_surcharge:
              type: boolean
              description: 附加费选项 visa_domestic_surcharge 是否开启。
            visa_international_surcharge:
              type: boolean
              description: 附加费选项 visa_international_surcharge 是否开启。
            mastercard_domestic_surcharge:
              type: boolean
              description: 附加费选项 mastercard_domestic_surcharge 是否开启。
            mastercard_international_surcharge:
              type: boolean
              description: 附加费选项 mastercard_international_surcharge 是否开启。
            amex_domestic_surcharge:
              type: boolean
              description: 附加费选项 amex_domestic_surcharge 是否开启。
            amex_international_surcharge:
              type: boolean
              description: 附加费选项 amex_international_surcharge 是否开启。
          nullable: true
        surcharge_config_enabled:
          type: array
          items:
            type: string
            description: 附加费类型。
          description: 已启用的附加费类型列表。
        surcharge_config_selected:
          type: array
          items:
            type: string
            description: 附加费类型或 credit_card_surcharge 分组。
          description: 展示选择列表，卡类可合并为分组。
        recurring:
          type: object
          description: 周期段。
          properties:
            enabled:
              type: integer
              description: 是否启用周期段，0/1。
              enum:
                - 0
                - 1
            schedule_name:
              type: string
              description: 周期段名称。
              nullable: true
            recurring_type:
              type: integer
              description: >-
                订阅结束条件：1 按成功期数；2 按累计金额；3 持续至取消；4 按结束日期；5 By
                agreement，仅用于扣款授权，后续添加扣费计划。
              nullable: true
            amount:
              oneOf:
                - type: number
                  multipleOf: 0.01
                  nullable: true
                - type: string
                  pattern: ^\d+(\.\d{1,2})?$
              description: 模板最新版本的周期单价；未启用时为 null。 金额单位为主货币单位，可返回数值或小数字符串；无适用金额时为 null。
              nullable: true
            total_amount:
              oneOf:
                - type: number
                  multipleOf: 0.01
                  nullable: true
                - type: string
                  pattern: ^\d+(\.\d{1,2})?$
              description: 累计金额上限。 金额单位为主货币单位，可返回数值或小数字符串；无适用金额时为 null。
              nullable: true
            start_date:
              type: string
              description: 模板列表固定返回 null，创建时需要由调用方提供覆盖日期。
              nullable: true
            end_date:
              type: string
              description: 结束日期，可能为 null。
              nullable: true
            end_terms:
              type: integer
              description: 目标成功期数，可能为 null。
              nullable: true
            day_of_debit:
              type: string
              description: RFC 5545 RRULE 字符串，可能为 null。
              nullable: true
            day_of_debit_dtstart:
              type: string
              description: 首次扣费锚点，YYYY-MM-DD 或 MM-DD。
              nullable: true
            process_type:
              type: integer
              description: >-
                频率：1 One-off、2 Daily、3 Weekly、4 Fortnightly、5 Monthly、6
                Quarterly、7 Half Yearly、8 Yearly、9 Minutely、10 Hourly、11
                Datetime、12 Custom、13 Direct Payment、14 By Agreement。
              nullable: true
            custom_cycle_type:
              type: integer
              description: 自定义单位 1 天、2 周、3 月、4 年；非 Custom 可能为 0/null。
              nullable: true
            custom_cycle:
              type: integer
              description: 自定义间隔；非 Custom 可能为 0/null。
              nullable: true
            custom_cycle_type_text:
              type: string
              description: 自定义单位文本 days/weeks/months/years；无匹配时空字符串。
            frequency:
              type: string
              description: 展示用频率说明。
          required:
            - enabled
            - schedule_name
            - recurring_type
            - amount
            - total_amount
            - start_date
            - end_date
            - end_terms
            - day_of_debit
            - day_of_debit_dtstart
            - process_type
            - custom_cycle_type
            - custom_cycle
            - custom_cycle_type_text
            - frequency
        one_off:
          type: object
          description: 一次性段。
          properties:
            enabled:
              type: integer
              description: 是否启用一次性段，0/1。
              enum:
                - 0
                - 1
            schedule_name:
              type: string
              description: 一次性段名称。
              nullable: true
            amount:
              oneOf:
                - type: number
                  multipleOf: 0.01
                  nullable: true
                - type: string
                  pattern: ^\d+(\.\d{1,2})?$
              description: 一次性金额。 金额单位为主货币单位，可返回数值或小数字符串；无适用金额时为 null。
              nullable: true
            description:
              type: string
              description: 一次性说明。
              nullable: true
            payment_date:
              type: string
              description: 模板原一次性日期，可为 null；创建时使用请求覆盖日期。
              nullable: true
          required:
            - enabled
            - schedule_name
            - amount
            - description
            - payment_date
        created_at:
          type: string
          description: 创建时间，格式 YYYY-MM-DD HH:mm:ss。
          nullable: true
        updated_at:
          type: string
          description: 更新时间，格式 YYYY-MM-DD HH:mm:ss。
          nullable: true
        deleted_at:
          type: string
          description: 删除时间，格式 YYYY-MM-DD HH:mm:ss；通常为 null。
          nullable: true
      required:
        - plan_id
        - plan_name
        - description
        - status
        - invoice_account_code
        - invoice_theme_id
        - surcharge_config
        - surcharge_config_enabled
        - surcharge_config_selected
        - recurring
        - one_off
        - created_at
        - updated_at
        - deleted_at
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth2 client_credentials 授权。access_token 到期后重新获取。
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes: {}

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.