> ## 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 get /api/v1/subscriptions/{subscriptionId}/calculate
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}/calculate:
    get:
      tags:
        - 사용량 API
      summary: 사용량 정산
      description: 구독 중간에 사용량과 예상 결제 금액을 확인할 때 사용합니다.
      operationId: v1_calculateSubscription
      parameters:
        - name: subscriptionId
          in: path
          description: 구독 번호
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: 정상적으로 조회됨
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/SubscriptionCalculatedDTO'
        '400':
          description: 사용량을 사용할 수 있는 가격 플랜임
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ProductErrorresponse'
        '404':
          description: 구독을 찾지 못 함
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/SubscriptionCalculatedV1DTO'
components:
  schemas:
    SubscriptionCalculatedDTO:
      title: 사용량 정산 정보
      required:
        - amount
        - endDate
        - items
        - startDate
      type: object
      properties:
        amount:
          type: number
          description: 예상 결제 금액
        items:
          type: array
          description: 예상 결제 금액 항목들
          items:
            $ref: '#/components/schemas/SubscriptionCalculatedItemDTO'
        startDate:
          type: string
          description: 측정 시작 시점
          format: date-time
        endDate:
          type: string
          description: 측정 종료 시점
          format: date-time
    ProductErrorresponse:
      required:
        - errorCode
      type: object
      properties:
        traceId:
          type: string
        errorCode:
          type: string
        errorMessage:
          type: string
        details:
          $ref: '#/components/schemas/ReturnError'
    SubscriptionCalculatedV1DTO:
      title: 사용량 정산 정보
      required:
        - amount
        - endDate
        - items
        - startDate
      type: object
      properties:
        amount:
          type: number
          description: 예상 결제 금액
        items:
          type: array
          description: 예상 결제 금액 항목들
          items:
            $ref: '#/components/schemas/SubscriptionCalculatedItemV1DTO'
        startDate:
          type: string
          description: 측정 시작 시점
          format: date-time
        endDate:
          type: string
          description: 측정 종료 시점
          format: date-time
    SubscriptionCalculatedItemDTO:
      required:
        - amount
        - currency
        - name
        - quantity
        - subscriptionItemId
        - type
      type: object
      properties:
        subscriptionItemId:
          type: integer
          description: 구독 항목 번호
          format: int64
        count:
          type: number
          description: 현재 사용량
        amount:
          type: number
          description: 예상 결제 금액
        quantity:
          type: integer
          description: 수량
          format: int32
        name:
          type: string
          description: 이름
        type:
          type: string
          description: 타입
          enum:
            - SKU
            - TAX
            - SHIPPING
            - DISCOUNT
            - OFFLINE
            - FEE
            - ADDS
            - INSTANT
            - USAGE
        unit:
          type: string
          description: 단위
        additionalBillings:
          $ref: '#/components/schemas/PriceAdditionalBillingDTO'
        usageFormula:
          type: string
          description: 사용량 기반 과금 계산식
        currency:
          type: string
          description: 통화
      description: 예상 결제 금액 항목들
    ReturnError:
      type: object
    SubscriptionCalculatedItemV1DTO:
      required:
        - amount
        - name
        - subscriptionItemId
        - type
      type: object
      properties:
        subscriptionItemId:
          type: integer
          description: 구독 항목 번호
          format: int64
        count:
          type: number
          description: 현재 사용량
        amount:
          type: number
          description: 예상 결제 금액
        name:
          type: string
          description: 이름
        type:
          type: string
          description: 타입
          enum:
            - SKU
            - TAX
            - SHIPPING
            - DISCOUNT
            - OFFLINE
            - FEE
            - ADDS
            - INSTANT
            - USAGE
        unit:
          type: string
          description: 단위
        additionalBillings:
          $ref: '#/components/schemas/PriceAdditionalBillingV1DTO'
      description: 예상 결제 금액 항목들
    PriceAdditionalBillingDTO:
      title: 추가 과금 정보
      required:
        - id
        - ranges
        - type
      type: object
      properties:
        id:
          type: integer
          description: 추가 과금 번호
          format: int64
        type:
          type: string
          description: 추가 과금 타입
          enum:
            - USAGE_BASED_WITH_RANGE
            - USAGE_BASED_WITH_RANGE_AND_FIXED_PRICE
        ranges:
          type: array
          description: 추가 과금 범위 정보
          items:
            $ref: '#/components/schemas/PriceAdditionalBillingRangeDTO'
      description: 추가 과금 정보
    PriceAdditionalBillingV1DTO:
      title: 추가 과금 정보
      required:
        - id
        - ranges
        - type
      type: object
      properties:
        id:
          type: integer
          description: 추가 과금 번호
          format: int64
        type:
          type: string
          description: 추가 과금 타입
          enum:
            - USAGE_BASED_WITH_RANGE
            - USAGE_BASED_WITH_RANGE_AND_FIXED_PRICE
        ranges:
          type: array
          description: 추가 과금 범위 정보
          items:
            $ref: '#/components/schemas/PriceAdditionalBillingRangeV1DTO'
      description: 추가 과금 정보
    PriceAdditionalBillingRangeDTO:
      title: 추가 과금 범위 정보
      required:
        - id
        - price
        - until
      type: object
      properties:
        id:
          type: integer
          description: 추가 과금 범위 번호
          format: int64
        until:
          type: integer
          description: 범위가 어디까지인지
          format: int64
        price:
          type: number
          description: 범위에 적용되는 금액
      description: 추가 과금 범위 정보
    PriceAdditionalBillingRangeV1DTO:
      title: 추가 과금 범위 정보
      required:
        - id
        - price
        - until
      type: object
      properties:
        id:
          type: integer
          description: 추가 과금 범위 번호
          format: int64
        until:
          type: integer
          description: 범위가 어디까지인지
          format: int64
        price:
          type: number
          description: 범위에 적용되는 금액
      description: 추가 과금 범위 정보
  securitySchemes:
    Secret-Token:
      type: apiKey
      in: header
      name: Secret-Token

````