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

# Apply Transaction to a Refund

> Manually apply an existing transaction as payment of a refund.

**Scopes:** `invoice:create`



## OpenAPI

````yaml /api-reference/openapi.json post /v0/business/{business_id}/refund-payment
openapi: 3.1.0
info:
  title: Asset API
  version: '0.1'
servers:
  - url: https://api.sandbox.getasset.com
    description: Sandbox
  - url: https://api.getasset.com
    description: Production
security: []
paths:
  /v0/business/{business_id}/refund-payment:
    post:
      tags:
        - Invoice
      summary: Apply Transaction to a Refund
      description: |-
        Manually apply an existing transaction as payment of a refund.

        **Scopes:** `invoice:create`
      operationId: apply_refund_payment_v0_business__business_id__refund_payment_post
      parameters:
        - name: business_id
          in: path
          required: true
          schema:
            description: The id of the business
            examples:
              - biz_GA6EG2qFxA97NZHtxeLPUy
            type: string
            format: biz_string
            title: Business Id
          description: The id of the business
        - name: x-user-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Optional external entity identifier that performed the action
            title: X-User-Id
          description: Optional external entity identifier that performed the action
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefundPaymentCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefundSuccess'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          description: >-
            Conflict. Payment cannot be applied due to refund or transaction
            state
          content:
            application/json:
              example:
                message: string
                data: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
      security:
        - OAuth2PasswordBearer:
            - invoice:create
components:
  schemas:
    RefundPaymentCreate:
      properties:
        refund_id:
          type: string
          format: rfu_string
          title: Refund Id
          description: The ID of the refund to apply payment to
          examples:
            - rfu_Lq5AyApd4pdL1VvakpY5aJ
        transaction_id:
          type: string
          format: txn_string
          title: Transaction Id
          description: The ID of the transaction to apply as payment
          examples:
            - txn_oiL7THC5RDi2PVUbVyyoJ
        payment_amount:
          anyOf:
            - type: number
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Payment Amount
          description: The amount to apply as payment. Defaults to the transaction amount.
      type: object
      required:
        - refund_id
        - transaction_id
      title: RefundPaymentCreate
    RefundSuccess:
      properties:
        data:
          $ref: '#/components/schemas/RefundPublic'
      type: object
      required:
        - data
      title: RefundSuccess
    ErrorResponse:
      properties:
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: A description of the error
        data:
          title: Data
          description: Data associated with the error
      type: object
      required:
        - error
        - data
      title: ErrorResponse
    RefundPublic:
      properties:
        business_id:
          type: string
          format: biz_string
          title: Business Id
          description: The ID of the Business that the refund is associated with
          examples:
            - biz_Pk2fNFDd8wj7EFeLWJywc7
        external_id:
          type: string
          maxLength: 255
          title: External Id
          description: The external ID of the refund
        amount:
          type: number
          title: Amount
          description: The amount of the refund
        amount_paid:
          type: number
          title: Amount Paid
          description: The amount of the refund that has been paid
          default: 0
        memo:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Memo
          description: Description of the refund
        processor:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Processor
          description: The entity that processed the refund
        method:
          $ref: '#/components/schemas/RefundMethod'
          description: Method of refund
        is_return:
          type: boolean
          title: Is Return
          description: Whether the refund is a return
          default: false
        refunded_at:
          type: string
          format: date-time
          title: Refunded At
          description: The date and time the refund was created
        status:
          $ref: '#/components/schemas/RefundStatus'
          description: The status of the refund
          default: pending
        id:
          type: string
          format: rfu_string
          title: Id
          description: The ID of the refund
          examples:
            - rfu_WQMDNUHpBThYSNh4AprDBo
        payments:
          anyOf:
            - items:
                $ref: '#/components/schemas/RefundPaymentPublic'
              type: array
            - type: 'null'
          title: Payments
          description: The payments for this refund
        refund_invoices:
          anyOf:
            - items:
                $ref: '#/components/schemas/RefundInvoicePublic'
              type: array
            - type: 'null'
          title: Refund Invoices
          description: The invoices refunded
        tags:
          anyOf:
            - additionalProperties:
                items:
                  $ref: '#/components/schemas/TagValueInput-Output'
                type: array
              type: object
            - type: 'null'
          title: Tags
          description: >-
            Tag field name to the list of values attached to the refund. Each
            value carries its allocated amount; a single-value field is still
            returned as a one-element list.
          examples:
            - Job:
                - amount: '60.00'
                  value: Maple Street Remodel
                - amount: '40.00'
                  value: Downtown Office Rewire
      type: object
      required:
        - business_id
        - external_id
        - amount
        - method
        - refunded_at
        - id
      title: RefundPublic
    RefundMethod:
      type: string
      enum:
        - cash
        - check
        - credit_card
        - ach
        - credit_balance
        - other
      title: RefundMethod
    RefundStatus:
      type: string
      enum:
        - pending
        - completed
        - voided
      title: RefundStatus
    RefundPaymentPublic:
      properties:
        amount:
          type: number
          title: Amount
          description: The amount of the refund that has been paid
        id:
          type: string
          format: rfp_string
          title: Id
          description: The ID of the payment
          examples:
            - rfp_WQMDNUHpBThYSNh4AprDBo
        transaction_id:
          type: string
          format: txn_string
          title: Transaction Id
          description: The ID of the transaction that the refund payment is associated with
          examples:
            - txn_WQMDNUHpBThYSNh4AprDBo
      type: object
      required:
        - amount
        - id
        - transaction_id
      title: RefundPaymentPublic
    RefundInvoicePublic:
      properties:
        external_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: External Id
          description: The external ID of the refund
        amount:
          type: number
          title: Amount
          description: The amount of the refund
        memo:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Memo
          description: Description of the refund
        id:
          type: string
          format: rfi_string
          title: Id
          description: The ID of the invoice
          examples:
            - rfi_WQMDNUHpBThYSNh4AprDBo
        invoice_id:
          type: string
          format: inv_string
          title: Invoice Id
          description: The ID of the invoice that the refund invoice is associated with
          examples:
            - inv_WQMDNUHpBThYSNh4AprDBo
        invoice_line_id:
          anyOf:
            - type: string
              format: inl_string
            - type: 'null'
          title: Invoice Line Id
          description: >-
            The ID of the invoice line that the refund invoice is associated
            with
          examples:
            - inl_WQMDNUHpBThYSNh4AprDBo
      type: object
      required:
        - amount
        - id
        - invoice_id
        - invoice_line_id
      title: RefundInvoicePublic
    TagValueInput-Output:
      properties:
        value:
          type: string
          title: Value
          description: The tag value (option string)
          examples:
            - NYC
        amount:
          anyOf:
            - type: number
            - type: 'null'
          title: Amount
          description: >-
            Portion of the source object allocated to this tag value. If
            omitted: with one value on a field the full source amount is used;
            with multiple values on a field the amount is split evenly. Mixed
            (some amounts set, some omitted) is rejected.
          examples:
            - '75.00'
      type: object
      required:
        - value
      title: TagValueInput
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /v0/auth/token

````