Refund a Card Payment

Localpayment enables you to process refunds for card payments, allowing you to return funds to customers' credit or debit cards through both API integration and the Dashboard interface. This guide covers the complete refund workflow for card transactions.

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.

Implementation Guide

Localpayment provides two methods for processing card 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.


Direct Refunds for Card Payments

For card transactions, refunds are processed as Direct Refunds, meaning you only need the original transaction's externalId. No additional beneficiary or bank details are required since funds are returned to the original card used for payment.


Step 1: Process Refund via API

To refund a card payment through API, send aPATCH request to the Refund endpoint.

Key Request Parameters

The request requires several key parameters:

ParameterDescriptionRequired
externalIdThe original transaction's externalId.

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 API Credit Card"
  }'

See all available parameters in the request.


Step 2: Handle the Response

Successful Response

A successfully processed refund returns confirmation details:

{
  "externalId": "d260ae17-0978-4429-bda1-8dfed9da6c6b",
  "internalId": "53c91969-147e-4273-a659-ee5012ce9c83",
  "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

Card 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