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

# Submit a payment action

> Continue a pending payment that is awaiting a customer action — for example when the initiation response returned `next_action: collect_otp`. Supported actions are `submit_otp`, `verify`, and `cancel`. The payment must be in `pending` status.




## OpenAPI

````yaml /api-reference/external/openapi.yaml post /payments-init/{payment_id}/action
openapi: 3.0.3
info:
  title: PCX API
  description: >
    The PCX integration API. Every request requires two headers: `Authorization`
    (Bearer JWT for user-facing flows, or the literal string `NONE`) and
    `X-Api-Key` (your API key for server-to-server calls, or the literal string
    `NONE`). Pass `NONE` for whichever header you are not using.
  version: '1.0'
servers:
  - url: https://prod-api.pcxpay.com/v1
    description: Production
  - url: https://devs.pcxpay.com/v1
    description: Development
security: []
tags:
  - name: Payment Initiation
    description: Initiate payments and poll for status
  - name: API Keys
    description: Create and manage API keys for programmatic access
  - name: Webhooks
    description: Register endpoints and receive transaction notifications
  - name: Beneficiaries
    description: Manage payment recipients
  - name: Payments
    description: Initiate and track payments
  - name: Bank Validation
    description: Validate bank accounts before initiating a payment
  - name: Transactions
    description: Query the financial transaction ledger
  - name: Virtual Accounts
    description: Multi-currency virtual account provisioning and fund operations
  - name: Payment Links
    description: Generate shareable payment links for customer checkout
  - name: Escrow
    description: Milestone-based escrow projects, parties, contracts, and funding
paths:
  /payments-init/{payment_id}/action:
    parameters:
      - $ref: '#/components/parameters/AuthorizationHeader'
      - $ref: '#/components/parameters/XApiKeyHeader'
    post:
      tags:
        - Payment Initiation
      summary: Submit a payment action
      description: >
        Continue a pending payment that is awaiting a customer action — for
        example when the initiation response returned `next_action:
        collect_otp`. Supported actions are `submit_otp`, `verify`, and
        `cancel`. The payment must be in `pending` status.
      operationId: submitPaymentAction
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
          description: ID of the payment awaiting action.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentActionRequest'
      responses:
        '200':
          description: Action processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentInitiationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Payment not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                    example: Payment not found
                  code:
                    type: string
                    example: PAYMENT_NOT_FOUND
        '409':
          description: Payment is not awaiting action
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                    example: Payment is not awaiting action
                  code:
                    type: string
                    example: INVALID_STATE_TRANSITION
components:
  parameters:
    AuthorizationHeader:
      name: Authorization
      in: header
      required: true
      description: >-
        Bearer JWT for user-facing flows (`Bearer eyJraWQ...`), or the literal
        string `NONE` when authenticating via API key.
      schema:
        type: string
        default: NONE
        example: Bearer eyJraWQ...
    XApiKeyHeader:
      name: X-Api-Key
      in: header
      required: true
      description: >-
        API key for server-to-server flows, or the literal string `NONE` when
        authenticating via JWT.
      schema:
        type: string
        default: NONE
        example: pcx_abc123_xxxx
  schemas:
    PaymentActionRequest:
      type: object
      required:
        - action
        - action_data
      properties:
        action:
          type: string
          enum:
            - submit_otp
            - verify
            - cancel
          description: The action to perform on the pending payment.
        action_data:
          type: object
          description: >
            Action-specific data. `submit_otp` requires `reference` and `otp`.
            `verify` requires `reference`.
          properties:
            reference:
              type: string
              description: Provider reference for the pending charge.
            otp:
              type: string
              description: One-time password entered by the customer.
    PaymentInitiationResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 200
        response:
          type: object
          properties:
            success:
              type: boolean
            payment_id:
              type: string
            transaction_id:
              type: string
            status:
              type: string
            next_action:
              type: string
              enum:
                - redirect
                - wait
                - bank_transfer
                - pay_by_link
                - collect_otp
                - check_status
              description: >
                What the client should do next. Omitted when no action is
                needed:

                  - `redirect` — redirect the customer to `redirect_url`.
                  - `wait` — payment processing, no user action needed.
                  - `bank_transfer` — display the bank account details returned
                    in the response so the customer can send the funds.
                  - `pay_by_link` — send the customer to the returned payment link.
                  - `collect_otp` — collect a one-time password from the customer
                    and submit it via `POST /payments-init/{payment_id}/action`
                    with action `submit_otp`.
                  - `check_status` — poll for the payment outcome.
            redirect_url:
              type: string
              nullable: true
              description: Present when `next_action` is `redirect`.
            provider:
              type: string
              nullable: true
              description: Identifier of the provider that accepted the dispatch.
            message:
              type: string
              nullable: true
            payment_data:
              type: object
              nullable: true
              description: Echo of the amounts and currencies for the initiated payment.
              properties:
                amount:
                  type: number
                  format: float
                currency:
                  type: string
                target_amount:
                  type: number
                  format: float
                target_currency:
                  type: string
                metadata:
                  type: object
          additionalProperties: true
          description: >
            When the provider returns funding instructions (for example a bank
            transfer flow), the instruction fields are merged into this object
            at the top level alongside the fields below.
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          enum:
            - error
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````