KOMOJU Sessions API

Hosted checkout sessions that collect payment or customer details.

OpenAPI Specification

komoju-sessions-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: KOMOJU Barcodes Sessions API
  description: 'KOMOJU is a Japan-focused global payment gateway operated by Degica. The REST API accepts payments across Japanese and international payment methods - credit cards, convenience store (konbini), bank transfer, Pay-easy (ATM), and e-money / mobile wallets such as PayPay, Merpay, au PAY, Rakuten Pay, LINE Pay, Alipay, and WeChat Pay - plus a hosted checkout (Sessions), tokenization, saved customers, subscriptions, and webhook events.


    Base URL: https://komoju.com/api/v1. Authentication is HTTP Basic: send your secret (or publishable, where allowed) API key as the username and leave the password empty (for example `curl -u secret_key: ...`). Separate live and test key pairs are issued per merchant account. POST requests support idempotency via the `X-KOMOJU-IDEMPOTENCY` header, and an optional `X-KOMOJU-API-VERSION` header pins the API version.


    This description is grounded in the public KOMOJU API reference (doc.komoju.com). Paths, methods, and authentication are confirmed against that reference. Request/response schemas below are a representative, partly modeled subset - some object properties are simplified or marked additionalProperties where the full field list is extensive; consult the official reference for exhaustive field-level detail.'
  version: '1.0'
  contact:
    name: KOMOJU (Degica)
    url: https://en.komoju.com
  license:
    name: Proprietary
    url: https://en.komoju.com/terms/
servers:
- url: https://komoju.com/api/v1
  description: KOMOJU API (live and test share this host; the key pair selects the environment)
security:
- basicAuth: []
tags:
- name: Sessions
  description: Hosted checkout sessions that collect payment or customer details.
paths:
  /sessions:
    post:
      operationId: createSession
      tags:
      - Sessions
      summary: Create a session
      description: 'Creates a hosted checkout session. Three modes are supported: `payment` (default; creates a payment when the user completes the session), `customer` (creates or updates a customer for delayed billing or subscriptions), and `customer_payment` (charges upfront and saves the customer''s payment details in one flow).'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionCreateInput'
      responses:
        '200':
          description: The created session, including a hosted `session_url`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /sessions/{id}:
    parameters:
    - $ref: '#/components/parameters/SessionId'
    get:
      operationId: showSession
      tags:
      - Sessions
      summary: Show a session
      description: Retrieves a session by its ID. A session's status changes when the user completes or cancels payment; poll this endpoint or listen via webhooks.
      responses:
        '200':
          description: The requested session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /sessions/{id}/cancel:
    parameters:
    - $ref: '#/components/parameters/SessionId'
    post:
      operationId: cancelSession
      tags:
      - Sessions
      summary: Cancel a session
      description: Cancels a session.
      responses:
        '200':
          description: The cancelled session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /sessions/{id}/pay:
    parameters:
    - $ref: '#/components/parameters/SessionId'
    post:
      operationId: paySession
      tags:
      - Sessions
      summary: Pay for a session
      description: Provides customer payment details to pay for a session directly. This endpoint may be called with a publishable key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payment_details:
                  $ref: '#/components/schemas/PaymentDetails'
      responses:
        '200':
          description: The session after the pay attempt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    Unauthorized:
      description: Invalid authorization (missing or invalid API key).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: The request payload failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    PaymentDetails:
      description: Payment method details. Either an object whose `type` selects the method (credit_card, konbini, bank_transfer, pay_easy, paypay, merpay, au_pay, rakutenpay, linepay, alipay, wechatpay, paidy, ...) plus the attributes for that method, or a token string from Create Token / Create Secure Token.
      oneOf:
      - type: string
        description: A token or secure token ID.
      - type: object
        properties:
          type:
            type: string
            enum:
            - credit_card
            - konbini
            - bank_transfer
            - pay_easy
            - paypay
            - merpay
            - au_pay
            - rakutenpay
            - linepay
            - alipay
            - wechatpay
            - paidy
        additionalProperties: true
    Session:
      type: object
      properties:
        id:
          type: string
        resource:
          type: string
          example: session
        mode:
          type: string
          enum:
          - payment
          - customer
          - customer_payment
        status:
          type: string
          enum:
          - pending
          - completed
          - cancelled
          - expired
        amount:
          type: integer
        currency:
          type: string
        session_url:
          type: string
          format: uri
          description: The hosted checkout URL to redirect the customer to.
        return_url:
          type: string
          format: uri
        payment:
          type: object
          nullable: true
          additionalProperties: true
        customer:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
    SessionCreateInput:
      type: object
      required:
      - amount
      - currency
      properties:
        amount:
          type: integer
        currency:
          type: string
          example: JPY
        mode:
          type: string
          enum:
          - payment
          - customer
          - customer_payment
          default: payment
        capture:
          type: string
          enum:
          - auto
          - manual
        return_url:
          type: string
          format: uri
        default_locale:
          type: string
          example: ja
        payment_types:
          type: array
          description: Restrict the session to specific payment method types.
          items:
            type: string
        customer:
          type: string
        external_order_num:
          type: string
        metadata:
          type: object
          additionalProperties: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            param:
              type: string
  parameters:
    SessionId:
      name: id
      in: path
      required: true
      description: The session ID.
      schema:
        type: string
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: 'HTTP Basic Authentication. Use your KOMOJU API key as the username and leave the password empty (for example `curl -u secret_key: ...`). Secret keys grant full access; publishable keys are limited to creating tokens and paying for sessions. Separate live and test key pairs exist per merchant.'