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

# Get a transaction



## OpenAPI

````yaml get /transactions/{id}
openapi: 3.0.0
info:
  title: Customer API
  version: v1
servers:
  - url: https://sandbox-api.fedapay.com/v1
  - url: https://api.fedapay.com/v1
security: []
paths:
  /transactions/{id}:
    get:
      summary: Get a transaction
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: Transaction ID.
      responses:
        '200':
          description: Transaction retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Transaction ID.
                  reference:
                    type: string
                    description: Transaction reference.
                  amount:
                    type: integer
                    description: Transaction amount.
                  description:
                    type: string
                    description: Transaction description.
                  callback_url:
                    type: string
                    description: Transaction callback URL.
                  status:
                    type: string
                    description: >-
                      Transaction status (e.g., 'pending', 'approved',
                      'canceled').
                  customer_id:
                    type: integer
                    description: Customer ID associated with the transaction.
                  currency_id:
                    type: integer
                    description: Currency ID associated with the transaction.
                  mode:
                    type: string
                    description: Transaction mode.
                  metadata:
                    type: object
                    description: Additional metadata related to the transaction.
                  commission:
                    type: integer
                    description: Transaction commission.
                  fees:
                    type: integer
                    description: Transaction fees.
                  fixed_commission:
                    type: integer
                    description: Fixed commission applied to the transaction.
                  amount_transferred:
                    type: integer
                    description: Amount transferred to the beneficiary.
                  created_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction creation.
                  updated_at:
                    type: string
                    format: date-time
                    description: Date and time of last transaction update.
                  approved_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction approval.
                  canceled_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction cancellation.
                  declined_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction decline.
                  refunded_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction refund.
                  transferred_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction transfer.
                  deleted_at:
                    type: string
                    format: date-time
                    description: Date and time of transaction deletion.
                  last_error_code:
                    type: string
                    description: Last error code encountered during the transaction.
                  custom_metadata:
                    type: object
                    description: Custom metadata associated with the transaction.
                  amount_debited:
                    type: integer
                    description: Amount debited from the payer.
                  receipt_url:
                    type: string
                    format: url
                    description: URL to the transaction receipt.
                  payment_method_id:
                    type: integer
                    description: Payment method ID used for the transaction.
                  sub_accounts_commissions:
                    type: array
                    description: Commissions applied to sub-accounts.
                  transaction_key:
                    type: string
                    description: Unique key associated with the transaction.
                  merchant_reference:
                    type: string
                    description: Merchant reference provided for the transaction.
                  account_id:
                    type: integer
                    description: Account ID associated with the transaction.
                  balance_id:
                    type: integer
                    description: Balance ID associated with the transaction.
        '404':
          description: Transaction not found.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          label: NodeJs
          source: >-
            const { FedaPay, Transaction } = require('fedapay');

            /* Replace YOUR_SECRETE_API_KEY with your real API key */

            FedaPay.setApiKey("YOUR_SECRETE_API_KEY");

            /* Specify whether you want to run your query in test mode or live
            mode */

            FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');

            /* Show transactions */

            const transaction = await Transaction.retrieve(ID, params = {},
            headers = {});
        - lang: PHP
          source: >-
            \FedaPay\Fedapay::setApiKey(MY_API_KEY);

            $transaction = \FedaPay\Transaction::retrieve(ID, params = {},
            header = {});
        - lang: Ruby
          source: |-
            require 'fedapay';
            # configure FedaPay library
            FedaPay.api_key = '' # Your secret api key
            FedaPay.environment = '' # sandbox or live
            transactions = FedaPay::Transaction.retrieve(ID);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````