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

# Refunds



## OpenAPI

````yaml POST /v1/{account_id}/refunds
openapi: 3.0.0
info:
  title: Pagos Ingestion API
  description: The Pagos Ingestion API Spec
  version: 1.1.1
  contact: {}
servers:
  - description: sandbox
    url: https://api.sandbox.nest.pagosapi.com
  - description: production
    url: https://api.nest.pagosapi.com
security: []
tags:
  - name: ingestion
    description: Pagos Ingestion API
paths:
  /v1/{account_id}/refunds:
    post:
      operationId: RefundsController_create
      parameters:
        - name: account_id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundUploadRequest'
      responses:
        '201':
          description: ''
components:
  schemas:
    RefundUploadRequest:
      type: object
      properties:
        refund_id:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            A unique value that identifies the refund and will be used as the
            key when making updates to refunds. Maximum 255 characters.
        amount:
          type: integer
          minimum: 0
          description: >-
            The refund amount, represented as a positive integer in the smallest
            currency unit (e.g. two-decimal currency such as $101.50 is
            represented as 10150,  zero-decimal currency such as ¥1095 is
            represented as 1095). Refer to the ISO 4217 currency page for
            guidance.
        currency:
          type: string
          minLength: 3
          maxLength: 3
          description: >-
            The currency of the refund, represented by the 3-letter ISO-4217
            currency code. Must be three characters.
        created:
          type: string
          description: >-
            The date when the refund was initiated, represented in ISO 8601
            format (e.g. 2023-09-04T16:13:05Z).
        transaction_id:
          type: string
          maxLength: 255
          nullable: true
          description: >-
            The transaction ID of the original transaction associated with the
            refund. Maximum 255 characters.
        transaction_order_id:
          type: string
          maxLength: 255
          nullable: true
          description: >-
            The merchant order reference of the original transaction associated
            with the refund. Maximum 255 characters.
        payment_method_details:
          type: object
          properties:
            payment_method_type:
              type: string
              minLength: 1
              maxLength: 255
              description: >-
                The payment method used for the refunded transaction (e.g. card,
                apple pay, paywithgoogle). Maximum 255 characters.
            card:
              type: object
              properties:
                attributes:
                  type: object
                  properties:
                    network:
                      type: string
                      maxLength: 50
                      nullable: true
                      description: >-
                        The card brand used in the refund (e.g. visa,
                        mastercard, discover). Maximum 50 characters.
                    type:
                      type: string
                      nullable: true
                      description: >-
                        The type of payment card used in the refund (e.g. debit
                        or credit).
                    bin:
                      type: string
                      minLength: 5
                      maxLength: 8
                      nullable: true
                      description: >-
                        The first 4-9 digits of the payment card used in the
                        refund.
                    issuer_bank:
                      type: string
                      maxLength: 128
                      nullable: true
                      description: >-
                        The issuing bank for the payment card used in the
                        refund. Maximum 128 characters.
                    issuer_country:
                      type: string
                      minLength: 2
                      maxLength: 2
                      nullable: true
                      description: >-
                        The country where the card used in the refund was
                        issued, represented by a two-letter country code (ISO
                        3166 alpha-2).
                  additionalProperties: false
                  nullable: true
              additionalProperties: false
              nullable: true
          required:
            - payment_method_type
          additionalProperties: false
        refund_response:
          type: object
          properties:
            status:
              type: string
              maxLength: 50
              description: >-
                The status of the refund (e.g. success, pending, rejected).
                Maximum 50 characters.
            processor_response_code:
              type: string
              maxLength: 50
              nullable: true
              description: >-
                The processor response for the refund (e.g. invalid amount,
                expired card). Maximum 50 characters.
            reason:
              type: string
              maxLength: 50
              nullable: true
              description: The reason for the refund. Maximum 50 characters.
          required:
            - status
          additionalProperties: false
        additional_data:
          type: object
          properties:
            merchant_account_id:
              type: string
              maxLength: 100
              nullable: true
              description: >-
                A unique value assigned by the acquirer or processor to identify
                the merchant account. This value could match the merchant
                account ID associated with a region or country. Maximum 100
                characters.
            order_id:
              type: string
              maxLength: 255
              nullable: true
              description: The merchant order reference. Maximum 255 characters.
            description:
              type: string
              maxLength: 500
              nullable: true
              description: The long-form description of the refund. Maximum 500 characters.
            acquirer_reference_number:
              type: string
              maxLength: 255
              nullable: true
              description: >-
                The unique value assigned by the acquiring bank and passed
                through to the card brand and issuer. It's often used to track
                the transaction or link it to refunds, should they occur.
                Maximum 255 characters.
            metadata:
              type: object
              additionalProperties:
                nullable: true
              nullable: true
              description: >-
                A transaction-level label used for segmenting transactions into
                meaningful groups. Metadata is typically used for segmentation
                by customer behavior (e.g. purchases from a particular seller)
                or merchant behavior (e.g. transaction routing or retries).
          additionalProperties: false
          nullable: true
        pagos_codes:
          type: object
          properties:
            pagos_refund_status:
              type: string
              enum:
                - amount_too_high
                - amount_too_low
                - approved
                - blocked_card
                - card_not_active
                - closed_card
                - crash_recovery
                - declined
                - declined_offline
                - disputed
                - do_not_honor
                - duplicate
                - error
                - expired_card
                - failed_to_go_online
                - fraudulent
                - has_chargeback
                - informational_data
                - insufficient_funds
                - invalid_amount
                - invalid_merchant
                - invalid_payment_details
                - invalid_transaction
                - invalid_transaction_type
                - issuer_unavailable
                - lost_or_stolen_card
                - merchant_cancelled
                - no_account
                - no_answer
                - no_such_issuer
                - no_value_provided
                - one_request_per_day
                - only_one_refund_is_supported
                - operation_expired
                - operation_failed
                - operation_maximum_period_allowed
                - operation_not_available
                - partial_capture
                - partial_refund_not_allowed
                - partially_disputed
                - partially_refunded
                - partially_refunded_and_disputed
                - pending
                - pending_refund_disputed
                - pick_up_card
                - processor_unavailable
                - refer_to_issuer
                - refund_more_than_settled_amount
                - refund_not_allowed
                - refund_refused
                - refund_reversed
                - refunded
                - requested_by_customer
                - restricted_card
                - shopper_cancelled
                - shopper_did_not_present_card
                - stop_all_billing
                - suspected_fraud
                - terminal_cancelled
                - timeout
                - tranasction_not_captured
                - transaction_not_found
                - transaction_recaptured
                - transaction_refused
                - unknown
                - unreadable_value
                - voided
                - withdrawals_limits_exceeded
                - wrong_currency
              description: >-
                Assign a Pagos refund status code that corresponds to
                refund_response.status.
          required:
            - pagos_refund_status
          additionalProperties: false
      required:
        - refund_id
        - amount
        - currency
        - created
        - payment_method_details
        - refund_response
        - pagos_codes
      additionalProperties: false

````