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

# Get one order

> Returns the order plus `payment` and `redirect`. For unpaid gateway
orders this prepares (or reuses) the payment session so `payment_url`
is the current Duitku payment page. List endpoint does not start a
gateway session.




## OpenAPI

````yaml /openapi.yaml get /orders/{order_id}
openapi: 3.1.0
info:
  title: Kawan Digital Public API
  version: 1.0.0
  summary: Store-scoped Order API
  description: >
    External systems can create and read **store orders** using API keys, and

    receive lifecycle events via signed webhooks.


    - **Access:** Growth and Scale stores only

    - **Auth:** `Authorization: Bearer {API_KEY}`

    - **Manage keys / webhooks:** [Dashboard → Developer
    API](https://kawan.digital/dashboard/settings/developers)

    - **Tutorial:** [Integrasi API](/integrasi)

    - **Webhooks:** [Dokumentasi webhook](/webhooks)

    - **Docs hub:** [Ringkasan](/)


    All JSON responses use `{ "success": true, "data": … }` or

    `{ "success": false, "error": { "code", "message" } }`.


    Amounts are IDR integers. Keys are scoped to **one store**.
  contact:
    name: Kawan Digital
    email: halo@kawan.digital
    url: https://kawan.digital/kontak
servers:
  - url: https://api.kawan.digital/v1
    description: Production
  - url: http://api.lvh.me:3000/v1
    description: Local (requires NEXT_PUBLIC_ROOT_DOMAIN=lvh.me)
security:
  - bearerAuth: []
tags:
  - name: Catalog
    description: Published products and bundles for the authenticated store.
  - name: Payments
    description: Checkout methods available for the store.
  - name: Orders
    description: Create and read store orders.
  - name: Webhooks
    description: |
      Signed HTTPS callbacks for order lifecycle events.
      See [Webhook documentation](/webhooks).
paths:
  /orders/{order_id}:
    get:
      tags:
        - Orders
      summary: Get one order
      description: |
        Returns the order plus `payment` and `redirect`. For unpaid gateway
        orders this prepares (or reuses) the payment session so `payment_url`
        is the current Duitku payment page. List endpoint does not start a
        gateway session.
      operationId: getOrder
      parameters:
        - in: path
          name: order_id
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    OrderResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          required:
            - order
            - payment
            - redirect
          properties:
            order:
              $ref: '#/components/schemas/Order'
            payment:
              $ref: '#/components/schemas/Payment'
            redirect:
              $ref: '#/components/schemas/Redirect'
    Order:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/OrderStatus'
        payment_reference:
          type:
            - string
            - 'null'
        amount:
          type: integer
        subtotal:
          type: integer
        currency:
          type: string
          const: IDR
        settlement_channel:
          type: string
        payment_provider:
          type:
            - string
            - 'null'
        payment_method:
          type:
            - string
            - 'null'
        buyer:
          type: object
          properties:
            name:
              type: string
            email:
              type: string
              format: email
            phone:
              type:
                - string
                - 'null'
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItem'
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        checkout_url:
          type:
            - string
            - 'null'
          format: uri
          description: Kawan hosted pay page on the store custom domain or free subdomain.
        payment_url:
          type:
            - string
            - 'null'
          format: uri
          description: |
            Best URL to send the buyer to pay. On create / get-one this is the
            Duitku payment URL. List and webhook payloads use the hosted
            checkout page.
        requires_payment:
          type: boolean
    Payment:
      type: object
      required:
        - kind
        - amount
        - currency
        - checkout_url
        - payment_url
      properties:
        kind:
          type: string
          enum:
            - none
            - seller_bank
            - gateway
        provider:
          type:
            - string
            - 'null'
          description: Usually duitku, or null for seller bank.
        method:
          type:
            - string
            - 'null'
        amount:
          type: integer
        currency:
          type: string
          const: IDR
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        checkout_url:
          type:
            - string
            - 'null'
          format: uri
          description: Hosted pay page on the store custom domain or free subdomain.
        payment_url:
          type:
            - string
            - 'null'
          format: uri
          description: Direct Duitku payment URL, or checkout_url for seller bank.
        seller_bank:
          type:
            - object
            - 'null'
          properties:
            bank_name:
              type:
                - string
                - 'null'
            bank_code:
              type:
                - string
                - 'null'
            account_number:
              type:
                - string
                - 'null'
            account_holder:
              type:
                - string
                - 'null'
            payment_reference:
              type:
                - string
                - 'null'
            unique_amount_code:
              type:
                - integer
                - 'null'
            transfer_amount:
              type: integer
              description: Exact amount to transfer (already includes unique_amount_code).
        snap:
          type:
            - object
            - 'null'
          description: Present only if the store uses Midtrans Snap instead of Duitku.
          properties:
            token:
              type: string
            client_key:
              type: string
            snap_script_url:
              type: string
              format: uri
    Redirect:
      type: object
      required:
        - success_url
        - return_url
        - error_url
      properties:
        success_url:
          type: string
          format: uri
          description: |
            Where the buyer is sent after the order is paid. If you passed
            `success_url` on create, this is that URL with `?order={id}`.
            Otherwise Kawan's thank-you page. Do not treat a visit here as paid
            until webhook `order.paid` (or GET order status `paid`).
        return_url:
          type: string
          format: uri
          description: |
            Payment-gateway return URL (order may still be unpaid). Kawan
            checkout success with `?result=pending`.
        error_url:
          type: string
          format: uri
          description: >-
            Payment-gateway error return (Kawan checkout success with
            `?result=error`).
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - INVALID_REQUEST
                - UNAUTHORIZED
                - FORBIDDEN
                - PLAN_REQUIRED
                - NOT_FOUND
                - CONFLICT
                - RATE_LIMITED
                - INTERNAL_ERROR
            message:
              type: string
    OrderStatus:
      type: string
      enum:
        - pending
        - awaiting_verification
        - paid
        - failed
        - expired
        - refunded
    OrderItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - product
            - bundle
        title:
          type: string
        quantity:
          type: integer
        unit_price:
          type: integer
        line_total:
          type: integer
        product_id:
          type:
            - string
            - 'null'
          format: uuid
        bundle_id:
          type:
            - string
            - 'null'
          format: uuid
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Missing or invalid Authorization header.
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded (Retry-After header)
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until the client may retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: RATE_LIMITED
              message: Rate limit exceeded.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key from Dashboard → Developer API. Shown once when created.

````