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

# 归档产品

> 让已发布的产品停止收款。

请使用属于该产品所在组织、且为全部权限或勾选了 `products:products:write` 权限的 API 密钥进行认证。只有 `Owner` 和 `Admin` 角色可以授予该权限。

* 不需要请求体。
* 只有已发布的产品可以归档。该产品的所有支付链接都会停止收款。再次发布时只会恢复一个链接，而不是全部。
* 响应结构与[读取产品](https://docs.anyway.sh/zh/api-reference/endpoint/get-product.md)相同，`status` 为 `ARCHIVED`。
* 要重新开始销售，请[发布产品](https://docs.anyway.sh/zh/api-reference/endpoint/publish-product.md)。
* 该接口没有 `Idempotency-Key`。

| 状态码 | 错误码 | 含义 |
| - | - | - |
| `401` | | API 密钥缺失或无效。 |
| `403` | `INSUFFICIENT_SCOPE` | 密钥缺少 `products:products:write`。 |
| `404` | | 产品不存在，或属于其他组织。 |
| `409` | `PRODUCT_CONFLICT` | 产品未处于已发布状态。 |


## OpenAPI

````yaml api-reference/openapi.json POST /v1/product/{id}/archive
openapi: 3.0.3
info:
  description: >-
    Organization-scoped commerce API for merchant backends: create and manage
    checkout sessions, and query commerce records.
  title: Anyway Merchant API
  contact: {}
  version: '1.0'
  x-source: anyway-backend-go
servers:
  - url: https://merchant-api-prod.anyway.sh
security: []
paths:
  /v1/product/{id}/archive:
    post:
      tags:
        - products
      summary: Archive a product
      description: >-
        Archives a published product; all of its payment links stop accepting
        payments. Publishing again brings back only one link. Requires Full
        access or the `products:products:write` permission. No request body. The
        response is the same as `GET /v1/product/{id}`. Returns 409
        PRODUCT_CONFLICT if the product is not published. There is no
        Idempotency-Key.
      parameters:
        - description: Product ID
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/response.ApiResponse-product_ProductResponse
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '403':
          description: >-
            Forbidden. The API key lacks the required permission
            (INSUFFICIENT_SCOPE).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '404':
          description: >-
            Not Found. The product does not exist or belongs to another
            organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '409':
          description: Conflict. The product is not published (PRODUCT_CONFLICT).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
      security:
        - APIKeyAuth: []
components:
  schemas:
    response.ApiResponse-product_ProductResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/product.ProductResponse'
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    response.ApiResponse-any:
      type: object
      properties:
        data: {}
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    product.ProductResponse:
      type: object
      properties:
        createdAt:
          type: string
        description:
          type: string
        id:
          description: 'Deprecated: use productId.'
          type: string
          deprecated: true
        name:
          type: string
        orgId:
          type: string
        paymentLinks:
          type: array
          items:
            $ref: '#/components/schemas/product.PaymentLinkResponse'
        productId:
          type: string
        status:
          type: string
        updatedAt:
          type: string
    response.ErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
    product.PaymentLinkResponse:
      type: object
      properties:
        amount:
          type: number
          nullable: true
        createdAt:
          type: string
        currency:
          type: string
        flexibleAmount:
          type: boolean
        isActive:
          type: boolean
        name:
          type: string
        paymentLinkUrl:
          type: string
        pricingId:
          type: string
        pricingType:
          type: string
        provider:
          type: string
        title:
          type: string
        description:
          type: string
        minAmount:
          type: number
          nullable: true
        maxAmount:
          type: number
          nullable: true
        successUrl:
          type: string
          description: >-
            Where the customer is sent after paying. Empty when the Anyway
            receipt is used.
  securitySchemes:
    APIKeyAuth:
      description: 'Merchant API key (format: ak_BASE64)'
      type: apiKey
      name: X-API-Key
      in: header

````

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