Cards
Refund Payment
This endpoint refunds a captured card payment. You can refund either the full amount or a partial amount.
⚠️ You can only refund payments with waiting and received status.
⚠️ If refund_amount is not provided, the full amount will be refunded by default.
POST
/
v2
/
cards
/
refund_payment
Refund Payment
curl --request POST \
--url https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment \
--header 'Content-Type: application/json' \
--header 'app-id: <api-key>' \
--header 'secret-key: <api-key>' \
--data '
{
"uuid": "PSADT5CE",
"reason": "Partial refund due to customer request",
"refund_amount": 50
}
'import requests
url = "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment"
payload = {
"uuid": "PSADT5CE",
"reason": "Partial refund due to customer request",
"refund_amount": 50
}
headers = {
"app-id": "<api-key>",
"secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'app-id': '<api-key>',
'secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
uuid: 'PSADT5CE',
reason: 'Partial refund due to customer request',
refund_amount: 50
})
};
fetch('https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment",
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([
'uuid' => 'PSADT5CE',
'reason' => 'Partial refund due to customer request',
'refund_amount' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"app-id: <api-key>",
"secret-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment"
payload := strings.NewReader("{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("app-id", "<api-key>")
req.Header.Add("secret-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))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment")
.header("app-id", "<api-key>")
.header("secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["app-id"] = '<api-key>'
request["secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}"
response = http.request(request)
puts response.read_body{
"total_amount": 200,
"refund_amount": 50,
"description": "Testing refund",
"payin_request": {
"uuid": "PSADT5CE",
"name": "Hello Clever",
"email": "test@example.com",
"external_id": "order_test_01",
"status": "return_pending",
"pay_code": null,
"currency": "USD",
"amount": "200.0",
"total": "200.0",
"paid_amount": "0.0",
"is_refundable": false,
"payment_method": "card",
"expired_at": "",
"webhook_notification": {
"endpoint_url": "https://webhook.site/12da7803-c4cf-4f32-812d-aaeaecf20d9d",
"authorization_header": "****"
},
"sender_details": {
"card": {
"card_type": "card",
"card_brand": "visa",
"card_last_4": "1111",
"card_country": "US"
}
},
"created_at": "2025-05-29T01:29:16.826+0000"
}
}{
"errors": {
"code": "REQUIRE_LOGIN",
"message": "Not Authorised"
}
}{
"errors": {
"message": "Reason must greater than 5 characters."
}
}Authorizations
A unique identifier assigned to each application.
A secure token associated with the app-id.
Body
application/json
The unique ID of the succeeded payment (e.g., VMMAOTFQ).
Example:
"PSADT5CE"
The reason for the refund, which must be at least 5 characters long. This is required for record-keeping and can help in cases of partial refunds.
Example:
"Partial refund due to customer request"
The amount to be refunded. If this is not specified, the refund will default to the total original payment amount.
Example:
50
⌘I
Refund Payment
curl --request POST \
--url https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment \
--header 'Content-Type: application/json' \
--header 'app-id: <api-key>' \
--header 'secret-key: <api-key>' \
--data '
{
"uuid": "PSADT5CE",
"reason": "Partial refund due to customer request",
"refund_amount": 50
}
'import requests
url = "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment"
payload = {
"uuid": "PSADT5CE",
"reason": "Partial refund due to customer request",
"refund_amount": 50
}
headers = {
"app-id": "<api-key>",
"secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'app-id': '<api-key>',
'secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
uuid: 'PSADT5CE',
reason: 'Partial refund due to customer request',
refund_amount: 50
})
};
fetch('https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment",
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([
'uuid' => 'PSADT5CE',
'reason' => 'Partial refund due to customer request',
'refund_amount' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"app-id: <api-key>",
"secret-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment"
payload := strings.NewReader("{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("app-id", "<api-key>")
req.Header.Add("secret-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))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment")
.header("app-id", "<api-key>")
.header("secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.lightningpay.me/api/v2/cards/refund_payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["app-id"] = '<api-key>'
request["secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"PSADT5CE\",\n \"reason\": \"Partial refund due to customer request\",\n \"refund_amount\": 50\n}"
response = http.request(request)
puts response.read_body{
"total_amount": 200,
"refund_amount": 50,
"description": "Testing refund",
"payin_request": {
"uuid": "PSADT5CE",
"name": "Hello Clever",
"email": "test@example.com",
"external_id": "order_test_01",
"status": "return_pending",
"pay_code": null,
"currency": "USD",
"amount": "200.0",
"total": "200.0",
"paid_amount": "0.0",
"is_refundable": false,
"payment_method": "card",
"expired_at": "",
"webhook_notification": {
"endpoint_url": "https://webhook.site/12da7803-c4cf-4f32-812d-aaeaecf20d9d",
"authorization_header": "****"
},
"sender_details": {
"card": {
"card_type": "card",
"card_brand": "visa",
"card_last_4": "1111",
"card_country": "US"
}
},
"created_at": "2025-05-29T01:29:16.826+0000"
}
}{
"errors": {
"code": "REQUIRE_LOGIN",
"message": "Not Authorised"
}
}{
"errors": {
"message": "Reason must greater than 5 characters."
}
}