> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vultlocal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Refund Payment

> Refund a previous POS transaction

<Warning>
  Refunds are submitted through the POS HMAC integration and reverse funds from the processor back to the subscriber.
</Warning>

## Request

<ParamField header="X-API-Key-ID" type="string" required>
  API key ID assigned to the POS integration
</ParamField>

<ParamField header="X-Timestamp" type="string" required>
  RFC3339 timestamp used in the HMAC signature
</ParamField>

<ParamField header="X-Signature" type="string" required>
  Hex-encoded HMAC-SHA256 of the request
</ParamField>

### Body Parameters

<ParamField body="original_transaction_id" type="string" required>
  ID of transaction to refund
</ParamField>

<ParamField body="amount" type="string" required>
  Amount to refund (can be partial)
</ParamField>

<ParamField body="reason" type="string" required>
  Reason for refund
</ParamField>

<ParamField body="initiated_by" type="string" required>
  Admin/User ID authorizing refund
</ParamField>

***

## Response

<ResponseField name="success" type="boolean">
  Whether refund succeeded
</ResponseField>

<ResponseField name="refund_transaction_id" type="string">
  Refund transaction ID
</ResponseField>

<ResponseField name="amount" type="string">
  Formatted refunded amount
</ResponseField>

***

## Examples

<RequestExample>
  ```bash cURL theme={null}
  BODY='{"original_transaction_id":"txn_pos_12345","amount":"1500.00","reason":"Customer returned item","initiated_by":"admin_user_01"}'
  TIMESTAMP='2026-03-10T12:00:00Z'
  SIGNATURE=$(printf 'POST\n/api/v1/pos/refund\n%s\n%s' "$TIMESTAMP" "$BODY" | openssl dgst -sha256 -hmac "$OLIVE_HMAC_SECRET" -hex | sed 's/^.* //')

  curl -X POST "https://demo.api.vultlocal.com/api/v1/pos/refund" \
    -H "X-API-Key-ID: $OLIVE_API_KEY_ID" \
    -H "X-Timestamp: $TIMESTAMP" \
    -H "X-Signature: $SIGNATURE" \
    -H "Content-Type: application/json" \
    -d "$BODY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "message": "Refund processed successfully",
    "refund_transaction_id": "rfnd_abc789",
    "amount": "1,500.00 SLE"
  }
  ```

  ```json 400 Already Refunded theme={null}
  {
    "success": false,
    "error": "Transaction already fully refunded"
  }
  ```
</ResponseExample>

***

## Errors

| Status | Code                         | Description                                                     |
| ------ | ---------------------------- | --------------------------------------------------------------- |
| 400    | Validation or business error | Invalid amount or refund not allowed                            |
| 401    | HMAC auth error              | Missing/invalid `X-API-Key-ID`, `X-Timestamp`, or `X-Signature` |
| 500    | Internal error               | Server error                                                    |


## OpenAPI

````yaml olive-openapi.json POST /pos/refund
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths: {}

````