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

# 구독 취소

> 구독을 취소합니다. 활성화, 일시정지, 결제실패 상태의 구독만 취소할 수 있습니다.



## OpenAPI

````yaml /steppay_v1.json post /api/v1/subscriptions/{subscriptionId}/cancel
openapi: 3.0.1
info:
  title: STEPPAY
  version: '1.0'
  contact:
    name: Steppay
    url: https://www.steppay.kr
    email: contact@steppay.kr
servers:
  - url: https://api.steppay.kr
    description: Generated server url
security:
  - Secret-Token: []
paths:
  /api/v1/subscriptions/{subscriptionId}/cancel:
    post:
      tags:
        - 구독 API
      summary: 구독 취소
      description: 구독을 취소합니다. 활성화, 일시정지, 결제실패 상태의 구독만 취소할 수 있습니다.
      operationId: v1_cancelSubscription
      parameters:
        - name: subscriptionId
          in: path
          description: 구독 번호
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionCancelDTO'
        required: true
      responses:
        '200':
          description: 정상적으로 처리됨
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ProductApiresponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ProductErrorresponse'
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ProductErrorresponse'
        '404':
          description: 구독을 찾지 못 함
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiResponseUnit'
components:
  schemas:
    SubscriptionCancelDTO:
      title: 구독 취소 정보
      required:
        - whenToCancel
      type: object
      properties:
        whenToCancel:
          type: string
          description: >-
            언제 취소되는지를 설정합니다. NOW일 경우 바로 취소되며, 이외에는 설정 시점이 되었을 때까지 취소 대기중 상태가
            됩니다.
          enum:
            - NOW
            - END_OF_PERIOD
            - SPECIFIC_DATE_TIME
        when:
          type: string
          description: >-
            whenToCancel 이 SPECIFIC_DATE_TIME 일 경우 필수값입니다. 취소되는 시점을 설정할 수 있으며,
            시점이 되기 전까지는 취소 대기중 상태가 됩니다.
          format: date-time
      description: 취소 정보 - 취소 시점을 설정합니다.
    ProductApiresponse:
      title: 단순 API 응답
      required:
        - message
      type: object
      properties:
        message:
          type: string
          description: 결과에 대한 메세지
        body:
          type: object
          description: 관련 데이터
    ProductErrorresponse:
      required:
        - errorCode
      type: object
      properties:
        traceId:
          type: string
        errorCode:
          type: string
        errorMessage:
          type: string
        details:
          $ref: '#/components/schemas/ReturnError'
    ApiResponseUnit:
      title: 단순 API 응답
      required:
        - message
      type: object
      properties:
        message:
          type: string
          description: 결과에 대한 메세지
        body:
          $ref: '#/components/schemas/Unit'
    ReturnError:
      type: object
    Unit:
      type: object
  securitySchemes:
    Secret-Token:
      type: apiKey
      in: header
      name: Secret-Token

````