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

# Get charge by ID

> Returns a single charge by its unique identifier. Useful for
idempotency checks and for correlating webhook events with the
charge's current state.



## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/charges/{id}
openapi: 3.0.0
info:
  title: FastPay API
  version: 1.0.0
  description: >-
    API for creating and managing payment charges.


    ## Authentication


    This API uses **Basic Authentication** for direct API access, such as
    creating charges.

    Use your API key as the username and an empty string as password.

    The header should be formatted as:


    `Authorization: Basic {base64(apiKey:)}`.


    For example:


    ```

    Authorization: Basic YWxleG91dG9uOiIi

    ```


    ## Webhooks


    FastPay sends webhooks to notify your application about charge status
    changes in real-time.

    Webhooks are sent via HTTP POST requests to your configured webhook
    endpoints.


    ### Webhook Events


    The following webhook events are available for charges:


    - `charge.created` - Sent when a new charge is created

    - `charge.pending` - Sent when a charge is pending payment

    - `charge.paid` - Sent when a charge is successfully paid

    - `charge.updated` - Sent when a charge is updated


    ### Webhook Payload Structure


    All webhook payloads follow this structure:


    ```json

    {
      "id": "webhook_event_id",
      "event": "charge.paid",
      "data": {
        // Complete charge object
      }
    }

    ```


    ### Webhook Delivery


    - Webhooks are sent via HTTP POST requests

    - Content-Type: `application/json`

    - Retry logic is implemented for failed deliveries

    - Webhook events are stored in the database for audit purposes

    - Delivery logs are maintained for debugging and monitoring


    ### Webhook Security


    - Webhooks are sent to pre-configured endpoints

    - Endpoints can be enabled/disabled per merchant

    - Event filtering is supported (only receive specific events)

    - Failed deliveries are retried with exponential backoff
servers:
  - url: https://api-global.fastpaybrasil.com
    description: Produção e Sandbox (diferenciados pela API key)
security: []
paths:
  /v1/charges/{id}:
    get:
      tags:
        - Charges
      summary: Get charge by ID
      description: |-
        Returns a single charge by its unique identifier. Useful for
        idempotency checks and for correlating webhook events with the
        charge's current state.
      parameters:
        - name: id
          in: path
          required: true
          description: Unique charge identifier
          schema:
            type: string
          example: 2RhQg9M7ZCg3X3nMb9W1kX8Q
      responses:
        '200':
          description: Successfully retrieved the charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
        '401':
          description: Unauthorized - invalid credentials
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: Unauthorized
        '404':
          description: Charge not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: Charge not found
      security:
        - basic: []
components:
  schemas:
    Charge:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the charge
          example: 2vorkDcXyvzifL63YX09S9VqcnI
        status:
          type: string
          enum:
            - paid
            - pending
            - refused
            - failed
            - refunded
            - in_analysis
            - authentication_required
            - pre_chargeback
            - chargeback
          description: The status of the charge
          example: paid
        chargebackAlertRefunded:
          type: boolean
          nullable: true
          description: >-
            Presente em cobranças com alerta de pré-chargeback (`status:
            pre_chargeback`). `true` = o valor já foi estornado ao portador como
            parte do tratamento do alerta; `false` = disputa aberta sem estorno.
            `null` quando não há alerta.
          example: true
        chargebackAlertReason:
          type: string
          nullable: true
          description: Motivo/referência informado no alerta de pré-chargeback.
          example: Chargeback - NSU 123456789
        pspRefId:
          type: string
          nullable: true
          description: >-
            The reference identifier in the PSP (Payment Service Provider)
            system
          example: ch_123456789
        amount:
          type: number
          description: The total amount of the charge
          example: 100.5
        currency:
          type: string
          description: The currency of the charge in ISO 4217 format
          example: USD
        spread:
          type: number
          description: The spread applied to the charge
          example: 2.5
        net:
          type: number
          description: The net amount after applying the spread
          example: 98
        customer:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier of the customer
              example: 2vorkDcXyvzifL63YX09S9VqcnI
            name:
              type: string
              description: The name of the customer
              example: John Doe
            email:
              type: string
              description: The email address of the customer
              example: john.doe@example.com
            document:
              type: string
              description: The document identifier of the customer
              example: 123.456.789-00
        paymentMethod:
          oneOf:
            - title: Credit Card
              type: object
              required:
                - type
                - firstSix
                - lastFour
                - expirationMonth
                - expirationYear
                - holderName
                - installments
              properties:
                type:
                  type: string
                  enum:
                    - credit_card
                  description: The payment method type.
                  example: credit_card
                firstSix:
                  type: string
                  description: Credit card first six digits.
                  example: '123456'
                lastFour:
                  type: string
                  description: Credit card last four digits.
                  example: '7890'
                expirationMonth:
                  type: string
                  description: Credit card expiration month.
                  example: '08'
                expirationYear:
                  type: string
                  description: Credit card expiration year.
                  example: '2024'
                holderName:
                  type: string
                  description: Credit card holdername.
                  example: John Doe
                installments:
                  type: number
                  description: Number of installments used.
                  example: 3
            - title: Rapipago
              type: object
              required:
                - type
                - identifyType
                - identifyNumber
              properties:
                type:
                  type: string
                  enum:
                    - rapipago
                  description: The payment method type
                  example: rapipago
                identifyType:
                  type: string
                  enum:
                    - dni
                    - cuit
                    - cuil
                    - cdi
                  description: The type of identity document
                  example: dni
                identifyNumber:
                  type: string
                  description: The identification number
                  example: '12345678'
                  minLength: 8
                  maxLength: 11
            - title: Khipu
              type: object
              required:
                - type
                - bankName
                - identifyType
                - identifyNumber
              properties:
                type:
                  type: string
                  enum:
                    - khipu
                  description: The payment method type
                  example: khipu
                bankName:
                  type: string
                  description: The name of the bank
                  example: Bank of America
                identifyType:
                  type: string
                  enum:
                    - dni
                    - cuit
                    - cuil
                    - cdi
                  description: The type of identity document
                  example: dni
                identifyNumber:
                  type: string
                  description: The identification number
                  example: '12345678'
                  minLength: 8
                  maxLength: 11
            - title: QRCode
              type: object
              required:
                - type
                - identifyType
                - identifyNumber
              properties:
                type:
                  type: string
                  enum:
                    - qrcode
                  description: The payment method type
                  example: qrcode
                identifyType:
                  type: string
                  enum:
                    - dni
                    - cuit
                    - cuil
                    - cdi
                  description: The type of identity document
                  example: dni
                identifyNumber:
                  type: string
                  description: The identification number
                  example: '12345678'
                  minLength: 8
                  maxLength: 11
        merchantId:
          type: string
          description: The merchant identifier
          example: 2vorkDcXyvzifL63YX09S9VqcnI
        paymentDetails:
          type: object
          nullable: true
          description: >-
            Additional payment details. Its different based on the payment
            method.
          example:
            authorization_code: '123456'
          oneOf:
            - title: Credit Card
              type: object
              required:
                - firstSix
                - lastFour
                - expirationMonth
                - expirationYear
                - holderName
                - installments
              properties:
                firstSix:
                  type: string
                  description: Credit card first six digits.
                  example: '123456'
                lastFour:
                  type: string
                  description: Credit card last four digits.
                  example: '7890'
                expirationMonth:
                  type: string
                  description: Credit card expiration month.
                  example: '08'
                expirationYear:
                  type: string
                  description: Credit card expiration year.
                  example: '2024'
                holderName:
                  type: string
                  description: Credit card holdername.
                  example: John Doe
                installments:
                  type: number
                  description: Number of installments used.
                  example: 3
            - title: Rapipago
              type: object
              required:
                - barcode
                - paymentCode
                - paymentUrl
              properties:
                barcode:
                  type: string
                  description: Barcode number. (e.g., "3335008****05200211740749")
                  example: 3335008****05200211740749
                paymentCode:
                  type: string
                  description: The ticket number that the user needs to use for payment.
                  example: '1111111111'
                paymentUrl:
                  type: string
                  description: |-
                    Link to complete the payment. This link is
                    dynamically created by the provider (PSP).
                  example: http://payment.link
            - title: Khipu
              type: object
              required:
                - payUrl
              properties:
                payUrl:
                  type: string
                  description: |-
                    Link to complete the payment. This link is
                    dynamically created by the provider (PSP).
                  example: http://payment.link
            - title: Pix
              type: object
              required:
                - endToEndId
                - copyPaste
              properties:
                endToEndId:
                  type: string
                  description: End to End Pix ID.
                  example: '1231389'
                copyPaste:
                  type: string
                  description: |-
                    Pix "copy and paste" code (BR Code EMV). The payer pastes it
                    in their banking app to complete the payment.
                  example: >-
                    00020101021226870014br.gov.bcb.pix2565qrcode.example.com/pix/v2/cobv/9d36b84f-c70b-478f-b95c-12729b90ca255204000053039865406100.005802BR5913EXAMPLE
                    STORE6009SAO PAULO62070503***6304ABCD
                qrCodeBase64:
                  type: string
                  nullable: true
                  description: |-
                    Pix QR Code image (PNG, 256x256) encoded as a data URI,
                    generated from `copyPaste`. Can be used directly as the
                    `src` of an `<img>` tag. Returned for Pix charges created
                    after this field was introduced; `null` or absent when the
                    QR Code could not be generated — fall back to rendering
                    `copyPaste` in that case.
                  example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
            - title: QRCode
              type: object
              required:
                - payUrl
              properties:
                payUrl:
                  type: string
                  description: |-
                    Link to complete the payment. This link is
                    dynamically created by the provider (PSP).
                  example: http://payment.link
        metadata:
          type: object
          nullable: true
          description: Custom metadata associated with the charge
          example:
            order_id: '123'
            user_id: '456'
        paidAt:
          type: string
          format: date-time
          nullable: true
          description: The date and time when the charge was paid
          example: '2023-01-15T14:30:00Z'
        createdAt:
          type: string
          format: date-time
          description: The date and time when the charge was created
          example: '2023-01-15T14:30:00Z'
        updatedAt:
          type: string
          format: date-time
          description: The date and time when the charge was last updated
          example: '2023-01-15T14:30:00Z'
  securitySchemes:
    basic:
      type: http
      scheme: basic
      description: |-
        HTTP Basic authentication. Use your secret key as the
        username and an empty string as password. The API key
        should be base64 encoded in the format 'username:' when
        sending the Authorization header.

````

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