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

# 理财服务状态变更

> 开通或关闭子账户的理财服务。`X-GatePay-On-Behalf-Of` 指定被代理的机构账户 ID。

## 概述

本页说明 `POST /merchant/open/institution/v1/wealth/action` 接口。完整的请求参数、响应结构与示例由上方关联的 OpenAPI 定义渲染。

## 说明

* 认证方式使用 GatePay 标准签名请求头。
* 这个机构专属接口需要携带 `X-GatePay-On-Behalf-Of`，表示被代理的机构账户 ID。
* 请求体中的 `action` 表示操作类型：`SIGN` 开通理财服务，`CANCEL` 关闭理财服务。
* 通用签名规则请参见 [/api-reference/version/100/cn/common/securityAndSignature](/api-reference/version/100/cn/common/securityAndSignature)。


## OpenAPI

````yaml api-reference/version/100/cn/openapi/institutional-openapi.json POST /merchant/open/institution/v1/wealth/action
openapi: 3.1.0
info:
  title: GatePay 机构 API
  description: Gate Pay 机构 API 接口文档
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://openplatform.gateapi.io
security: []
paths:
  /merchant/open/institution/v1/wealth/action:
    post:
      summary: 理财服务状态变更
      description: 开通或关闭子账户的理财服务。`X-GatePay-On-Behalf-Of` 指定被代理的机构账户 ID。
      parameters:
        - $ref: '#/components/parameters/X-GatePay-Certificate-ClientId'
        - $ref: '#/components/parameters/X-GatePay-Timestamp'
        - $ref: '#/components/parameters/X-GatePay-Nonce'
        - $ref: '#/components/parameters/X-GatePay-Signature'
        - $ref: '#/components/parameters/X-GatePay-On-Behalf-Of'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WealthActionRequest'
            examples:
              default:
                summary: 开通理财服务
                value:
                  action: SIGN
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WealthActionResponseWrapper'
              examples:
                success:
                  summary: 成功响应
                  value:
                    status: SUCCESS
                    code: '000000'
                    errorMessage: ''
                    data:
                      status: SIGN
                      account_id: '2124766106'
components:
  parameters:
    X-GatePay-Certificate-ClientId:
      name: X-GatePay-Certificate-ClientId
      in: header
      required: true
      description: 商户在Gate商户后台注册应用时分配的clientId
      schema:
        type: string
        example: 4186d0c6-6a35-55a9-8dc6-5312769dbff8
    X-GatePay-Timestamp:
      name: X-GatePay-Timestamp
      in: header
      required: true
      description: 毫秒级时间戳，与服务端时间偏差不得超过30秒
      schema:
        type: string
        example: '1672905655498'
    X-GatePay-Nonce:
      name: X-GatePay-Nonce
      in: header
      required: true
      description: 随机字符串，字符符合HTTP Header头部的规范，建议长度在32个字符以内，字符串组成为数字和字母
      schema:
        type: string
        example: '9578'
    X-GatePay-Signature:
      name: X-GatePay-Signature
      in: header
      required: true
      description: 请求签名。GatePay通过此签名来确定此请求是否合法
      schema:
        type: string
    X-GatePay-On-Behalf-Of:
      name: X-GatePay-On-Behalf-Of
      in: header
      required: true
      schema:
        type: string
      description: 必填代理归属请求头。请填写本次交易的发起方账户 ID，可填写机构账户 ID 或子账户 ID。
  schemas:
    WealthActionRequest:
      type: object
      required:
        - action
      properties:
        action:
          type: string
          description: 操作类型：CANCEL 关闭；SIGN 开通
          enum:
            - CANCEL
            - SIGN
          example: SIGN
    WealthActionResponseWrapper:
      type: object
      properties:
        status:
          type: string
          example: SUCCESS
        code:
          type: string
          example: '000000'
        errorMessage:
          type: string
        data:
          $ref: '#/components/schemas/WealthActionResponse'
    WealthActionResponse:
      type: object
      properties:
        account_id:
          type: string
          description: 子账户 ID
        status:
          type: string
          description: 理财状态：CANCEL 关闭；SIGN 开通
          enum:
            - CANCEL
            - SIGN

````