# Reverse transaction

Endpoint: POST /people/{personId}/loans/{loanId}/transactions/{transactionId}/reverse
Version: 2025-03-26
Security: oauth2, bearerAuth, apiKeyHeader

## Path parameters:

  - `personId` (string, required)
    A Borrower's unique identifier, tied to a person or a business. Can be Peach or a lender's external identifier.

  - `loanId` (string, required)
    The unique identifier of the Loan we wish to retrieve. Can be
Peach or lender's external identifier.

  - `transactionId` (string, required)
    Transaction ID. Can be Peach or lender's external identifier.

## Query parameters:

  - `sync` (boolean)
    Make the process synchronous.

## Request fields (application/json):

  - `amount` (number)
    The amount of the reversal. For regular transactions, it may be a partial or full reversal; however, the sum of all successful reversals for the same
transaction may not exceed the transaction's `effectiveAmount`. If `amount` is not provided, it will default to the
`effectiveAmount` of the original transaction.
For past transactions, only full reversals are supported.

  - `caseId` (string)
    The identifier of an existing case.

  - `externalId` (string)
    The external ID of the reversal transaction. This is separate from the `externalId` of the transaction being reversed in the request parameters.

  - `scheduledDate` (string)
    The scheduled date of the reversal transaction. Can only be set for external transactions. If this value is provided, the `status` cannot be set
to a status other than `scheduled`, and the system will automatically set `status=scheduled` if the field is not specified.

  - `status` (string)
    The status of the reversal transaction, not the original transaction. Status may only be set for external transactions. If a status is not passed,
the system will default the status to `scheduled`.
- `scheduled` - reversal was scheduled for a future date that has not arrived yet. The reversal has not applied to a loan yet and is not included
in the original transaction's `effectiveAmount`.
- `initiated` - reversal was initiated and sent to a payment processor. The reversal is applied to a loan and impacts the original transaction's
`effectiveAmount`. This status is used normally for ACH.
- `pending` - reversal was acknowledged by the payment processor and is being processed.
- `succeeded` - reversal was completed successfully. This status is only allowed for past transactions that were created as part of line of credit
migration. `status=succeeded` is the only status that can be passed for past transaction reversals. Regular transaction reversals can only be set
to `scheduled`, `initiated`, or `pending`.
    Enum: "scheduled", "initiated", "pending", "succeeded"

## Response 201 fields (application/json):

  - `message` (string)
    Description of the server action or error.

  - `status` (integer)
    HTTP status code.

  - `data` (object)

  - `data.autopayPaymentIds` (array)
    Peach identifiers of the autopay expected payments.

  - `data.autopayPlanId` (string)
    Peach identifier of the autopay plan.

  - `data.consentDocumentId` (string)
    The document ID of a one-time payment consent given by the
borrower to debit their payment instrument.  The document is
stored in the HTML format and contains the disclosure shown to
the borrower at the time of the payment.  Required if
`previewMode=false` and Peach is processing payments (aka
`isExternal=false`) on behalf of the lender.

  - `data.drawId` (string)
    The draw identifier for the transaction.

  - `data.enablePrepayments` (boolean)
    **DEPRECATED ATTRIBUTE**
`true` if the borrower opts to apply any overpayment amount to prepayment of future obligations.
`false` if the borrower opts to apply overpayments to the current obligation.
If this field is not passed, we reference the `allowPrepayments` configuration on the loan type.

  - `data.evidenceDocumentId` (string)
    The document ID of a one-time payment consent screenshot
captured when a borrower made the payment.  Only applicable when
Peach App is used and company's
`config.evidence.captureScreenshot=true`.

  - `data.initiatingBorrowerId` (string)
    The ID of the borrower who initiated the transaction.

  - `data.isExternal` (any)
    A transaction marked `isExternal=true` is for record purposes only. A transaction with
an external `paymentInstrument` is automatically marked external.

  - `data.isVirtual` (any)
    A transaction marked `isVirtual=true` is not a real transaction, but represents a part of another transaction.
This is used to store the principal/interest split on draws in Line of Credits as well as splits between multiple
installment loans that were applied as a single payment.

  - `data.loanId` (string)
    The unique identifier of the Loan.

  - `data.mainBorrowerId` (string)
    The Peach identifier for the main borrower on the loan.

  - `data.paidFeesAmount` (any)
    The paid rounded amount allocated to fees

  - `data.paidInterestAmount` (any)
    The paid rounded amount allocated to interest

  - `data.paidOverAmount` (any)
    Stores any excess rounded amount that was not allocated to principal, interest or fees.

  - `data.paidPrincipalAmount` (any)
    The paid rounded amount allocated to principal

  - `data.unroundedPaidFeesAmount` (number)
    The paid unrounded amount allocated to fees

  - `data.unroundedPaidInterestAmount` (number)
    The paid unrounded amount allocated to interest

  - `data.unroundedPaidOverAmount` (number)
    Stores any excess unrounded amount that was not allocated to principal, interest or fees.

  - `data.unroundedPaidPrincipalAmount` (number)
    The paid unrounded amount allocated to principal

## Response 423 fields (application/json):

  - `message` (string)
    Enum: "Loan is locked for updates. Please try again.", "Loan is locked for updates. Please check back again in a few minutes.", "Previous purchase is processing."

