Skip to main content
POST
https://api.lite.sa/v1
/
payments
/
{payment_id}
/
refund
Refund a captured payment
curl --request POST \
  --url https://api.lite.sa/v1/payments/{payment_id}/refund \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "amount": 5000,
  "reason": "Customer returned item",
  "metadata": {
    "refund_type": "partial"
  }
}
'
import requests

url = "https://api.lite.sa/v1/payments/{payment_id}/refund"

payload = {
"amount": 5000,
"reason": "Customer returned item",
"metadata": { "refund_type": "partial" }
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 5000,
reason: 'Customer returned item',
metadata: {refund_type: 'partial'}
})
};

fetch('https://api.lite.sa/v1/payments/{payment_id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 5000,
reason: 'Customer returned item',
metadata: {refund_type: 'partial'}
})
};

fetch('https://api.lite.sa/v1/payments/{payment_id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.lite.sa/v1/payments/{payment_id}/refund"

payload := strings.NewReader("{\n \"amount\": 5000,\n \"reason\": \"Customer returned item\",\n \"metadata\": {\n \"refund_type\": \"partial\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lite.sa/v1/payments/{payment_id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 5000,
'reason' => 'Customer returned item',
'metadata' => [
'refund_type' => 'partial'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "payment": {
    "id": "baf6a8e2-0c89-46ef-9ca5-faa65b99bcd5",
    "status": "PENDING",
    "merchant_reference": "ORD-123456"
  },
  "_links": {
    "self": {
      "href": "<string>",
      "method": "POST"
    },
    "capture": {
      "href": "<string>",
      "method": "POST"
    },
    "void": {
      "href": "<string>",
      "method": "POST"
    },
    "refund": {
      "href": "<string>",
      "method": "POST"
    },
    "redirect": {
      "href": "<string>",
      "method": "POST"
    }
  }
}
{
"error": {
"code": "PAYMENT_DETAILS_MISMATCH",
"message": "The request was invalid or malformed",
"timestamp": "2024-12-16T10:30:00.000Z",
"details": {},
"correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "PAYMENT_DETAILS_MISMATCH",
"message": "The request was invalid or malformed",
"timestamp": "2024-12-16T10:30:00.000Z",
"details": {},
"correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "PAYMENT_DETAILS_MISMATCH",
"message": "The request was invalid or malformed",
"timestamp": "2024-12-16T10:30:00.000Z",
"details": {},
"correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "PAYMENT_DETAILS_MISMATCH",
"message": "The request was invalid or malformed",
"timestamp": "2024-12-16T10:30:00.000Z",
"details": {},
"correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "PAYMENT_DETAILS_MISMATCH",
"message": "The request was invalid or malformed",
"timestamp": "2024-12-16T10:30:00.000Z",
"details": {},
"correlationId": "550e8400-e29b-41d4-a716-446655440000"
}
}

Authorizations

x-api-key
string
header
required

API key for service-to-service or merchant authentication.

Headers

x-correlation-id
string<uuid>

Unique identifier for request tracing. Generated by the client or server if not provided.

Example:

"550e8400-e29b-41d4-a716-446655440000"

x-idempotency-key
string<uuid>

Unique key for idempotent request processing. Duplicate requests with the same key are safely ignored.

Example:

"baf6a8e2-0c89-46ef-9ca5-faa65b99bcd5"

Path Parameters

payment_id
string<uuid>
required

Unique identifier of the payment

Example:

"9822ffb8-26de-423b-ad15-0d129cf1b4ac"

Body

application/json

Refund a captured payment

Refund amount, reason, and metadata. If amount is omitted, the full remaining captured amount is refunded.

amount
integer

Amount to refund in minor units. Omit to refund full remaining captured amount.

Required range: x >= 1
Example:

5000

reason
string

Reason for the refund

Example:

"Customer returned item"

metadata
object

Additional metadata

Example:
{ "refund_type": "partial" }

Response

Payment accepted for processing.

payment
object
required

Available action links (HATEOAS)