# Reimburse

The reimburse endpoint should be used when the lender owes money to a borrower on a given loan.
The endpoint will execute a reimbursement according to the specified `reimbursementAmount`. If the `reimbursementAmount` is greater than the amount owed to the borrower, the system will not process the reimbursement and return an error. Funds are reimbursed to a specified payment instrument. The endpoint will update the ledger and create a new transaction.
If the loan type is installment, the loan must be in `paidOff` status to process reimbursement.
If the loan type is line of credit, the loan can be in `active`, `accelerated`, `chargedOff` or `paidOff` status to process reimbursement.
If `paymentInstrumentId` is `isExternal=true`, the payment method can be of any type (e.g. bank account, card, etc.)
If `paymentInstrumentId` is `isExternal=false` and Peach is processing payments (per company configuration), the payment method must be a bank account.
Please note for external reimbursements, the lender is responsible for transitioning the transaction status.

Endpoint: POST /people/{personId}/loans/{loanId}/reimburse
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.

## Request fields (application/json):

  - `caseId` (string)
    An identifier for an existing case.

  - `contactId` (string)
    An identifier of an existing contact. Required if the `paymentInstrumentType` is `check` and the check is processed/sent by Peach.

  - `customDisplayName` (string)
    A friendly description of the transaction. If provided, this value will be displayed in Peach UI/App and Statements (or can be used by lender in their App). If the value is not provided, the Peach UI/App and Statements logic will render the transaction name based on type and status. Make sure you provide value that makes sense to the borrower.
This is NOT what the borrower will see in their online bank or card account.

  - `externalTransactionId` (string)
    A transaction external identifier. If passed, the new reimbursement transaction that the system will create will have the `externalTransactionId`.

  - `isExternal` (boolean)
    If set to `true`, the lender assumes responsibility for transferring funds to the borrower. If set to `false`, Peach handles the transfer of funds to the borrower.

  - `paymentInstrumentId` (string)
    Peach's unique or lender's external identifier. Not required if the paymentInstrumentType=check and the check is processed/sent by Peach.

  - `paymentInstrumentType` (string, required)
    Enum: "bankAccount", "card", "check", "payroll", "paymentNetwork"

  - `reimbursementAmount` (number, required)
    The requested reimbursement amount.

  - `transactionStatus` (string)
    Only applicable if isExternal=true. The status in which the new reimbursement transaction will be created. If the status is set to pending, the caller
can later update the transaction status via Update transaction endpoint. Only applicable if isExternal=true.
    Enum: "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

