Transactions API

Refund Transaction

Changed on

Refunds a transaction. You can either refund the entire amount or specify a partial amount.

post/transactions/{transaction_id}/refund

Request

  • Base URL
    https://sandbox.affirm.com/api/v1
  • URL
    https://sandbox.affirm.com/api/v1/transactions/{transaction_id}/refund
  • Auth
    HTTP basic

Path parameters

transaction_idstring required
Example:ABCD-1234

A unique ID representing the transaction’s loan or charge ID.

Headers

Idempotency-Keystring

Unique identifier pre-generated by the client and used by the server to recognize successive calls to the same endpoint. This is required for Split Capture and encouraged for single transaction functionality. Note: If a request fails or times out, use the same idempotency key to retry the operation without risk of double-processing. For details, see the Idempotency section on About Split Capture.

Request body

amountinteger nullable

The amount to be refunded in cents. If the request omits this parameter, the entire remaining amount on the transaction will be fully refunded.

reference_idstring nullable

An optional, unique identifier that may be associated with each transaction event and reconciled with the system of record used by the merchant.

Example request

{
  "amount": 20000,
  "reference_id": "202307011027"
}

Response

HTTP 200 OK

typestring

The type of event, such as auth, auth_expired, capture, charge_off, confirm, confirmation_expired, expire_authorization, expire_confirmation, refund, split_capture, update, void, partial_void, and refund_voided.

currencystring

The local currency of the transaction with its being a valid subset of the ISO 4217 currency code.

createdstring

The time when the transaction event was created. The value is formatted in RFC 3339.

amountinteger

The total value of the transaction event, including tax and shipping. The value is non-negative and is represented in the smallest currency unit, such as cents instead of dollars. If the type is capture, this field represents the amount captured. If the type is refund, this field represents the amount refunded, including the fee that was refunded.

feeinteger

The correctness of this value may be inaccurate for certain loan types, refer to the settlement reports for the accurate merchant fee information for accounting and reconciliation purposes.

idstring

A unique ID for the transaction event.

Example response

{
  "type": "refund",
  "currency": "USD",
  "created": "2019-01-01T00:00:00.000Z",
  "amount": 20000,
  "fee": 500,
  "id": "ABCD-1234"
}

Changes

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status