Toss Payments Billing API

Recurring (automatic) payments via billing keys.

OpenAPI Specification

toss-payments-billing-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Toss Payments Core Billing API
  description: 'The Toss Payments Core API is a REST interface for accepting and managing online payments in South Korea across cards, easy-pay wallets (Toss Pay, KakaoPay, Naver Pay), virtual accounts, bank transfer, and mobile-phone billing. This document models a representative, grounded subset of the Core API: payment confirmation and cancellation, recurring billing keys, virtual account issuance, cash receipts, transaction and settlement queries, and marketplace payouts. All requests authenticate with HTTP Basic auth - the secret API key is used as the username with an empty password, Base64 encoded (`Authorization: Basic base64(secretKey:)`). Asynchronous results (virtual account deposits, foreign payment cancellations, Brandpay and payout status changes) are delivered by webhooks, which are out of scope for this REST document. Field names follow the Korean documentation, translated where helpful. This is a modeled subset authored by API Evangelist from the public documentation, not an official Toss Payments OpenAPI artifact.'
  version: '2022-11-16'
  contact:
    name: Toss Payments Developer Center
    url: https://docs.tosspayments.com/en
  termsOfService: https://www.tosspayments.com
servers:
- url: https://api.tosspayments.com
  description: Toss Payments Core API (test and live selected by secret key prefix)
security:
- basicAuth: []
tags:
- name: Billing
  description: Recurring (automatic) payments via billing keys.
paths:
  /v1/billing/authorizations/issue:
    post:
      operationId: issueBillingKey
      tags:
      - Billing
      summary: Issue a billing key from an authKey
      description: Issues a billing key for recurring payments from the authKey returned by the billing authorization window and the merchant's customerKey.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssueBillingKeyRequest'
      responses:
        '200':
          description: The issued Billing object with billingKey.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Billing'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/billing/authorizations/card:
    post:
      operationId: issueBillingKeyFromCard
      tags:
      - Billing
      summary: Issue a billing key from card credentials
      description: Issues a billing key directly from card credentials without the authorization window. Requires an additional contract.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssueBillingKeyFromCardRequest'
      responses:
        '200':
          description: The issued Billing object with billingKey.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Billing'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/billing/{billingKey}:
    parameters:
    - name: billingKey
      in: path
      required: true
      description: The billing key issued for the customer (max 200 chars).
      schema:
        type: string
    post:
      operationId: payWithBillingKey
      tags:
      - Billing
      summary: Charge a billing key
      description: Approves a recurring payment using a previously issued billing key and the matching customerKey.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingChargeRequest'
      responses:
        '200':
          description: The approved Payment object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    Unauthorized:
      description: Missing or invalid secret key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request was invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Cancel:
      type: object
      properties:
        cancelAmount:
          type: integer
        cancelReason:
          type: string
        canceledAt:
          type: string
          format: date-time
        transactionKey:
          type: string
        cancelStatus:
          type: string
    Billing:
      type: object
      properties:
        billingKey:
          type: string
        customerKey:
          type: string
        method:
          type: string
        cardCompany:
          type: string
        cardNumber:
          type: string
        authenticatedAt:
          type: string
          format: date-time
    VirtualAccount:
      type: object
      properties:
        accountType:
          type: string
          enum:
          - 일반
          - 고정
        accountNumber:
          type: string
        bankCode:
          type: string
        customerName:
          type: string
        dueDate:
          type: string
          format: date-time
        refundStatus:
          type: string
        settlementStatus:
          type: string
    IssueBillingKeyRequest:
      type: object
      required:
      - authKey
      - customerKey
      properties:
        authKey:
          type: string
          description: The authKey returned by the billing authorization window.
        customerKey:
          type: string
          description: Merchant-assigned customer identifier (2-300 chars).
    Payment:
      type: object
      description: A Toss Payments Payment object.
      properties:
        version:
          type: string
        paymentKey:
          type: string
        orderId:
          type: string
        orderName:
          type: string
        status:
          type: string
          enum:
          - READY
          - IN_PROGRESS
          - WAITING_FOR_DEPOSIT
          - DONE
          - CANCELED
          - PARTIAL_CANCELED
          - ABORTED
          - EXPIRED
        method:
          type: string
          enum:
          - 카드
          - 가상계좌
          - 간편결제
          - 휴대폰
          - 계좌이체
          - 문화상품권
          - 도서문화상품권
          - 게임문화상품권
          description: Payment method (Korean label). English enum equivalents include CARD, VIRTUAL_ACCOUNT, EASY_PAY, MOBILE_PHONE, TRANSFER.
        totalAmount:
          type: integer
        balanceAmount:
          type: integer
        suppliedAmount:
          type: integer
        vat:
          type: integer
        taxFreeAmount:
          type: integer
        currency:
          type: string
        requestedAt:
          type: string
          format: date-time
        approvedAt:
          type: string
          format: date-time
        card:
          $ref: '#/components/schemas/Card'
        virtualAccount:
          $ref: '#/components/schemas/VirtualAccount'
        easyPay:
          type: object
          properties:
            provider:
              type: string
            amount:
              type: integer
            discountAmount:
              type: integer
        cancels:
          type: array
          items:
            $ref: '#/components/schemas/Cancel'
    IssueBillingKeyFromCardRequest:
      type: object
      required:
      - customerKey
      - cardNumber
      - cardExpirationYear
      - cardExpirationMonth
      - customerIdentityNumber
      properties:
        customerKey:
          type: string
        cardNumber:
          type: string
        cardExpirationYear:
          type: string
        cardExpirationMonth:
          type: string
        customerIdentityNumber:
          type: string
    BillingChargeRequest:
      type: object
      required:
      - customerKey
      - amount
      - orderId
      - orderName
      properties:
        customerKey:
          type: string
        amount:
          type: integer
        orderId:
          type: string
        orderName:
          type: string
        customerEmail:
          type: string
        customerName:
          type: string
        taxFreeAmount:
          type: integer
    Card:
      type: object
      properties:
        company:
          type: string
        number:
          type: string
        installmentPlanMonths:
          type: integer
        approveNo:
          type: string
        cardType:
          type: string
          enum:
          - 신용
          - 체크
          - 기프트
        ownerType:
          type: string
          enum:
          - 개인
          - 법인
    Error:
      type: object
      description: Standard Toss Payments error body.
      properties:
        code:
          type: string
          description: Machine-readable error code (for example INVALID_CARD_EXPIRATION).
        message:
          type: string
          description: Human-readable error message (Korean by default).
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication. Use your Toss Payments secret key as the username and leave the password empty, then Base64 encode `secretKey:` for the Authorization header. Test keys are prefixed `test_sk_` / `test_gsk_` and live keys `live_sk_` / `live_gsk_`.