Refund a Cash Payment

Localpayment enables you to process refunds for cash payments through both API integration and the Dashboard interface. This guide covers the complete refund workflow for cash transactions, which requires the data-required refunds flow to provide beneficiary and bank account details for processing.

Before You Begin

Ensure you have:


Additional Refund Requirements:

  • Sufficient balance in your Localpayment account to cover the refund amount.
  • User role with refund permissions (see User Roles documentation).
  • The original transaction must be in Completed status.
  • The externalId of the original payment transaction.
  • Complete beneficiary information for data-required refunds.

Implementation Guide

Localpayment provides two methods for processing cash refunds: API integration for automated processing and Dashboard for manual operations.

API Refund Processing

Programmatically process refunds through REST API for automated workflows and integration with your systems.

Dashboard Refund Processing

Manually process refunds through the Localpayment Dashboard with a user-friendly interface. Note: All Dashboard refunds require approval.


Data-Required Refunds for Cash Payments

Cash refunds are processed as Data-Required Refunds, meaning you need both the original transaction's externalId and complete beneficiary information. Unlike card payments where funds can be returned to the original payment method, cash payments require explicit bank account details since there's no digital payment method to reverse.

⚠️

Important: Only full refunds are permitted for cash transactions. Partial refunds are not supported. The beneficiary and destination account information must be the same as the data from which the payment originates.


Step 1: Process Refund via API

To refund a cash payment through API, send a PATCH request to the Refund endpoint.

Key Request Parameters

The request requires several key parameters:

ParameterDescriptionRequired
externalIdThe original transaction's externalId
commentOptional note about the refund reason
beneficiaryRecipient details including bank information
beneficiary.typeBeneficiary type (INDIVIDUAL or COMPANY)
beneficiary.nameFirst name of the beneficiary
beneficiary.lastNameLast name of the beneficiary
beneficiary.document.typeDocument type of the beneficiary
beneficiary.document.idDocument ID of the beneficiary
beneficiary.bank.nameName of the beneficiary's bank
beneficiary.bank.codeBank code
beneficiary.bank.account.typeAccount type
beneficiary.bank.account.numberAccount number of the beneficiary

Example Request

Below is an example using curl:

curl --request PATCH \
  --url 'https://api.stage.localpayment.com/api/payin/{{externalId}}/refund' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <your_access_token>' \
  --data '{
    "comment": "Refund cash",
    "beneficiary": {
      "type": "INDIVIDUAL",
      "name": "John",
      "lastName": "Doe",
      "document": {
        "type": "RFC",
        "id": "EXTF900101NI1"
      },
      "bank": {
        "name": "BBVA MEXICO",
        "code": "012",
        "account": {
          "type": "S",
          "number": "322000180511735471"
        }
      }
    }
  }'

See all available parameters in the request.


Step 2: Handle the Response

Successful Response

A successfully processed refund returns confirmation details:

{
  "externalId": "1c364061-1f3d-4b94-c270-bf915c22e8f5",
  "internalId": "8a9abd31-31e0-429a-32a6-cca8b9e1e536",
  "status": {
    "code": "902",
    "description": "REFUNDED",
    "detail": "The payin was refunded"
  }
}

Key Response Fields

ParameterDescriptionUse Case
externalIdYour reference for the original transaction.Reconciliation and tracking.
internalIdLocalpayment's unique refund identifier.Support and audit purposes.
status.codeRefund status code (902 for successful refund).Status monitoring.

Error Response

When a refund request fails, you'll receive error information:

{
  "status": {
    "code": "400",
    "description": "ERROR",
    "detail": "Invalid operation"
  }
}

Common Error Scenarios

ErrorDescriptionSolution
Insufficient FundsYour Localpayment account balance is insufficient to cover the refund amountAdd funds to your Localpayment account or wait for pending settlements to clear
Transaction Not FoundThe provided externalId does not exist or is invalidVerify the externalId is correct and the transaction exists in your transaction history
Invalid StatusThe original transaction is not in a refundable state (must be Completed)Check the transaction status and ensure it has been successfully processed before attempting refund
Permission DeniedYour user role lacks necessary refund permissionsContact your account administrator to grant appropriate refund permissions for your role
Duplicate RefundAttempting to refund an already refunded transactionVerify the transaction hasn't been refunded previously by checking the refund status
Invalid AmountAttempting a partial refund when only full refunds are allowedProcess refund for the full transaction amount only

Dashboard Refunds

Cash refunds can also be processed through the Localpayment Dashboard interface. This method provides a visual workflow for managing refunds and is particularly useful for:

  • Occasional refunds that don't require API automation.
  • Administrative oversight where approval workflows are needed.
  • Quick refund processing without development resources.

For detailed instructions on processing refunds through the Dashboard, including step-by-step guidance and interface walkthroughs, please refer to the Dashboard Refunds Guide .

⚠️

Approval Required: All refunds initiated through the Localpayment Dashboard require approval through the designated authorization workflow. Ensure you have the necessary user permissions before attempting Dashboard refunds.


Step 3: Track Refund Status

After initiating a refund, monitor its progress through these methods:

Common Refund Status Codes

CodeStatusDescription
400ERRORRefund request failed due to validation errors or invalid parameters.
902REFUNDEDThe payin was successfully refunded.
📝

Note: For complete status code reference, see the Transaction Status documentation.


Testing Your Integration

Test Scenarios

Verify your integration handles these scenarios:

  1. Successful Refund: Process refund with valid externalId and sufficient funds.
  2. Insufficient Funds: Attempt refund with inadequate account balance.
  3. Invalid Transaction: Try to refund non-existent externalId.
  4. Duplicate Refund: Attempt to refund already refunded transaction.
  5. Permission Validation: Test with users having different permission levels.

Next Steps