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

# Check a checkout session

> Returns the session. Fulfil the order only when `status` is `complete`.




## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/checkout/sessions/{id}
openapi: 3.1.0
info:
  title: PrimePay API
  version: '1.0'
  description: >-
    Collect mobile money payments, send transfers and make payouts with the
    PrimePay API.
servers:
  - url: https://api.primepay.mw
    description: Live API (live keys, `sk_live_…`)
  - url: https://sandbox-api.primepay.mw
    description: Sandbox API (test keys, `sk_test_…`)
security:
  - bearerAuth: []
tags:
  - name: Operators
  - name: Payments
  - name: Refunds
  - name: Transfers
  - name: Payouts
  - name: Payment links
  - name: Checkout sessions
paths:
  /v1/checkout/sessions/{id}:
    get:
      tags:
        - Checkout sessions
      summary: Check a checkout session
      description: |
        Returns the session. Fulfil the order only when `status` is `complete`.
      operationId: getCheckoutSession
      parameters:
        - $ref: '#/components/parameters/CheckoutSessionId'
      responses:
        '200':
          description: The session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
        '404':
          $ref: '#/components/responses/CheckoutError'
components:
  parameters:
    CheckoutSessionId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
        example: 3c0f6f4e-7a1b-4c59-9a3e-0d5b7f2c8e11
      description: The session's `id`.
  schemas:
    CheckoutSession:
      type: object
      properties:
        id:
          type: string
          format: uuid
        object:
          type: string
          example: checkout.session
        url:
          type: string
          nullable: true
          description: The payment page. `null` once the session can no longer be paid.
        status:
          type: string
          enum:
            - open
            - processing
            - complete
            - expired
            - cancelled
        livemode:
          type: boolean
        amount:
          type: number
        currency:
          type: string
          example: MWK
        reference:
          type: string
        description:
          type: string
          nullable: true
        customer:
          $ref: '#/components/schemas/CheckoutCustomer'
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/CheckoutLineItem'
        metadata:
          type: object
          additionalProperties: true
          nullable: true
        sub_merchant_account_code:
          type: string
          nullable: true
        return_url:
          type: string
        cancel_url:
          type: string
        payment:
          $ref: '#/components/schemas/CheckoutPayment'
        created_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
          nullable: true
    CheckoutCustomer:
      type: object
      properties:
        first_name:
          type: string
          maxLength: 100
          nullable: true
        last_name:
          type: string
          maxLength: 100
          nullable: true
        email:
          type: string
          format: email
          nullable: true
        phone:
          type: string
          nullable: true
          description: >-
            A Malawi mobile number, for example `0991234567` or `265991234567`.
            Returned as `+265991234567`.
    CheckoutLineItem:
      type: object
      required:
        - name
        - quantity
        - unit_amount
      properties:
        name:
          type: string
          maxLength: 200
        description:
          type: string
          maxLength: 500
          nullable: true
        quantity:
          type: integer
          minimum: 1
        unit_amount:
          type: number
          minimum: 0
    CheckoutPayment:
      type: object
      nullable: true
      description: The payment that completed the session. `null` until it is paid.
      properties:
        transaction_id:
          type: string
          format: uuid
        transaction_reference:
          type: string
          example: TXN-WRYF6S2W3DQW
        method:
          type: string
          example: wallet
        provider:
          type: string
          nullable: true
          example: airtel
        amount:
          type: number
          example: 42500
        fee:
          type: number
          example: 1275
        levy:
          type: number
          example: 0
        aggregator_fee:
          type: number
          example: 0
          description: 'Aggregator sessions: the aggregator''s share.'
        net:
          type: number
          example: 41225
          description: What reaches the account after fees.
        paid_at:
          type: string
          format: date-time
          nullable: true
    CheckoutError:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request_error
            code:
              type: string
              example: line_items_total_mismatch
            param:
              type: string
              nullable: true
              example: line_items
            message:
              type: string
              example: line_items add up to 40000.00 but amount is 42500.00.
  responses:
    CheckoutError:
      description: >-
        An error. `param` names the field at fault. Use `code` in your code;
        show `message` to people.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CheckoutError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Your API key: `sk_live_…` / `sk_test_…` (secret), `pk_live_…` /
        `pk_test_…` (publishable, read-only reference data) or `rk_live_…` /
        `rk_test_…` (payments only).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.