openapi: 3.0.0
info:
  title: Redirect API
  version: 1.0.0
paths:
  /integrations/checkout/client/initiate:
    post:
      operationId: initiateCheckoutSession
      summary: Initiate checkout session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateCheckoutSessionRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateCheckoutSessionResponse'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Paystar-Api-Key
  schemas:
    InitiateCheckoutSessionRequest:
      type: object
      properties:
        accountNumber:
          type: string
        accountName:
          type: string
        amount:
          type: number
          description: In minor units i.e. 15029 = $150.29
        successUrl:
          type: string
          description: Client URL to redirect to after payment succeeds
        returnUrl:
          type: string
          description: Client URL to redirect to after payment fails or is cancelled
    InitiateCheckoutSessionResponse:
      type: object
      properties:
        paymentLogInLink:
          type: string
          description: Paystar link with session token
        paymentSessionIdentifier:
          type: string
          description: GUID
servers:
  - url: https://dev-gateway.paystar.io
security:
  - ApiKeyAuth: []
