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

# Retrieve a transaction

> Check the actual status of a transaction with its iMoney Encaissement reference or your transaction_id.

Use this operation to get the actual status of a transaction, rather than relying on the status returned at creation. This operation (or a [webhook](https://docs.i-pay.money/en/guides/webhooks.md)) is what must trigger the delivery of an order, never the response of [Create a transaction](https://docs.i-pay.money/en/api-reference/transactions/create-a-payment.md).

* **Reference.** It accepts two interchangeable values: the internal reference returned at creation, or your own `transaction_id` (found under the name `external_reference`). There is no need to store both if you only keep `transaction_id` on the merchant side.
* **Status.** A `pending` transaction can still become `succeeded`, `failed` or `refunded`. Wait for a final status (or a webhook) before considering the check complete.
* **Unknown reference.** A reference that does not match any transaction of the authenticated account returns `404`, even if it exists for another account or another environment (Sandbox/Live).

The full list of common error messages is in [Errors](https://docs.i-pay.money/en/api-reference/errors.md).


## OpenAPI

````yaml en/openapi.yaml GET /payments/{reference}
openapi: 3.1.0
info:
  title: iPayMoney Merchant API
  version: 1.0.0
  description: >-
    v1 merchant contracts verified against the Rails routes, controllers and
    services. Partner contracts and non-operational v2 routes are not part of
    this public specification. Payment links must use private random references.
servers:
  - url: https://i-pay.money/api/v1
    description: Sandbox or Live depending on the headers and the key used
security: []
tags:
  - name: Payments
    description: Creation and tracking of merchant transactions
  - name: Payment links
    description: Hosted payment links
paths:
  /payments/{reference}:
    get:
      tags:
        - Payments
      summary: Retrieve a transaction
      description: >-
        Accepts the iPayMoney internal reference or the merchant's external
        reference.
      parameters:
        - name: reference
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/ContentType'
        - $ref: '#/components/parameters/TargetEnvironment'
        - $ref: '#/components/parameters/PaymentType'
      responses:
        '200':
          description: Transaction found for the authenticated account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentStatus'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Transaction not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '406':
          $ref: '#/components/responses/NotAcceptable'
      security:
        - bearerAuth: []
components:
  parameters:
    ContentType:
      name: Content-Type
      in: header
      required: true
      description: >-
        Required by the API authentication, including on GET requests, even
        though they have no body.
      schema:
        type: string
        const: application/json
    TargetEnvironment:
      name: Ipay-Target-Environment
      in: header
      required: true
      schema:
        type: string
        enum:
          - sandbox
          - live
    PaymentType:
      name: Ipay-Payment-Type
      in: header
      required: true
      description: >-
        Payment method. `POST /payments` only supports `mobile` (mobile money).
        Other payment methods (bank card and other channels) are not used here:
        they are available through payment links (`POST /external_payments`).
        Full list: [payment
        methods](/en/guides/payouts-and-fees#fees-by-payment-method).
      x-verified: >-
        Internal verification note (not intended for the public documentation).
        Scope decision: only the `mobile` value is documented for `POST
        /payments`; the other values handled by `Live::PaymentService` are still
        accepted by the API but belong to the "payment link" flow.
        `external_payment` is reserved for `POST /external_payments` (dedicated
        parameter of that operation).
      schema:
        type: string
        const: mobile
        example: mobile
  schemas:
    PaymentStatus:
      type: object
      required:
        - public_reference
        - external_reference
        - reference
        - status
        - msisdn
        - amount
      properties:
        public_reference:
          type: string
        external_reference:
          type: string
        reference:
          type: string
        status:
          type: string
          enum:
            - initiated
            - pending
            - succeeded
            - failed
            - refunded
        msisdn:
          type: string
        amount:
          type: integer
        validated_at:
          type:
            - string
            - 'null'
          format: date-time
    Error:
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          description: >-
            Only present on some application failures, e.g. a duplicate payment
            on `POST /payments`, where `status` is always `failed`. Absent from
            the other errors of this contract (e.g. 404 `Payment Not Found`,
            header/authentication errors).
          x-verified: >-
            Internal verification note (not intended for the public
            documentation). See `Live::PaymentService#error_response`
            (app/services/live/payment_service.rb:994-1005).
          example: failed
  responses:
    BadRequest:
      description: Invalid header or parameter, detected before any business logic.
      x-verified: >-
        Internal verification note (not intended for the public documentation).
        Detected by `ApiAuthService#authenticate`
        (app/services/api_auth_service.rb:20-26) — exact messages verified on
        2026-09-16.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingHeaderParams:
              summary: Missing authentication header
              value:
                message: 'Bad Request: Missing params'
            notAllowedEnvironment:
              summary: Ipay-Target-Environment not allowed
              value:
                message: 'Bad Request: Not Allowed Environment'
            notAllowedPaymentType:
              summary: Ipay-Payment-Type not allowed
              value:
                message: 'Bad Request: Not Allowed Payment Type'
            missingAuthenticationKey:
              summary: Authorization Bearer missing or malformed
              value:
                message: 'Bad Request: Missing Authentication Key'
    Unauthorized:
      description: Invalid key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Account or environment not available
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotAcceptable:
      description: Content-Type other than application/json
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret key of the Sandbox or Live account

````

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