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

# Refund

> `REFUND` a settled transaction.  Refund amount cannot exceed settled amount.



## OpenAPI

````yaml https://cdn.ecrypt.dev/swagger/gateway-swagger-v30.json post /v1/transactions/refund
openapi: 3.0.4
info:
  title: Ecrypt.Gateway.Api
  description: Ecrypt API
  contact:
    name: Ecrypt
    url: https://www.ecrypt.com/
    email: Engineering@Ecrypt.com
  version: 1.0.0.0
servers: []
security: []
paths:
  /v1/transactions/refund:
    post:
      tags:
        - Transactions
      summary: Refund
      description: >-
        `REFUND` a settled transaction.  Refund amount cannot exceed settled
        amount.
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionRefundRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionRefundRequest
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionRefundRequest
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionResponse
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ecrypt.Gateway.Api.Core.Model.BadRequest'
        '429':
          description: Too Many Requests
components:
  schemas:
    Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionRefundRequest:
      required:
        - amount
        - transactionId
      type: object
      properties:
        transaction_id:
          minLength: 1
          pattern: ^[0-9]*$
          type: string
          description: Transaction Id to issue the refund against.
        amount:
          maximum: 999999999.99
          minimum: 0.01
          type: number
          description: Amount to refund.  Cannot exceed the original transaction amount.
          format: double
      additionalProperties: false
    Ecrypt.Gateway.Api.Core.Model.Transactions.TransactionResponse:
      required:
        - requestId
      type: object
      properties:
        transaction_id:
          type: string
          description: Ecrypt Transaction Identifier
          nullable: true
        auth_code:
          type: string
          description: >-
            Authorization Code is the underlying payment networks approval code.
            For credit card/terminal transactions this is a 6 character string.
          nullable: true
        response_code:
          type: string
          description: "*** Supported Values ***\r\n- `APPROVED` transaction was approved\r\n- `DECLINED` transaction was declined, review response text\r\n- `ERROR` error processing the transaction"
          nullable: true
        response_text:
          type: string
          description: Text description of the network response.
          nullable: true
        latency:
          type: integer
          description: Latency for request in milliseconds.
          format: int32
        avs:
          $ref: >-
            #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.AvsResponse
        cvv:
          $ref: >-
            #/components/schemas/Ecrypt.Gateway.Api.Core.Model.Transactions.CvvResponse
        amount:
          type: number
          description: Amount transaction was attempted for.
          format: double
        metadata:
          type: object
          additionalProperties: {}
          description: "Metadata for the transaction.\r\n*** Possible Fields ***\r\n- `credit_card_network` for credit card/terminal transactions only\r\n- `credit_card_number` for credit card/terminal transactions only, masked card number\r\n- `credit_card_expires` for credit card/terminal transactions only, expiry formatted as MMyy\r\n- `bank_name` for check/ach transactions only\r\n- `account_number` for check/ach transactions only\r\n- `routing_number` for check/ach transactions only\r\n- `order_tax` when supplied\r\n- `order_tip` when supplied"
          nullable: true
        request_id:
          maxLength: 100
          minLength: 1
          type: string
          description: Ecrypt Request Identifier.
          default: ABCDEF000000000000010
      additionalProperties: false
    Ecrypt.Gateway.Api.Core.Model.BadRequest:
      required:
        - requestId
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Ecrypt.Gateway.Api.Core.Model.BadRequestError'
          nullable: true
        request_id:
          maxLength: 100
          minLength: 1
          type: string
          description: Ecrypt Request Identifier.
          default: ABCDEF000000000000010
      additionalProperties: false
    Ecrypt.Gateway.Api.Core.Model.Transactions.AvsResponse:
      type: object
      properties:
        code:
          type: string
          description: Network address verification response code.
          nullable: true
        text:
          type: string
          description: Text for the code returned.
          nullable: true
      additionalProperties: false
    Ecrypt.Gateway.Api.Core.Model.Transactions.CvvResponse:
      type: object
      properties:
        code:
          type: string
          description: "Card verification value response from the network.\r\n\r\n*** Supported Values ***\r\n- `M` is Card Verification value matches\r\n- `N` is Card Verification value does not match\r\n- `P` is Not Processed\r\n- `S` is Service not supported\r\n- `U` is Issuer is not certified\r\n- `X` is Service is not available\r\n- `E` is Unrecognized or unknown response"
          nullable: true
        text:
          type: string
          description: Text for the code returned.
          nullable: true
      additionalProperties: false
    Ecrypt.Gateway.Api.Core.Model.BadRequestError:
      type: object
      properties:
        type:
          type: string
          nullable: true
        message:
          nullable: true
        exception_name:
          type: string
          nullable: true
      additionalProperties: false

````