Void an authorized payment
Reverses an authorization before it has been captured.
POST
https://api.lite.sa/v1
/
payments
/
{payment_id}
/
void
Void an authorized payment
curl --request POST \
--url https://api.lite.sa/v1/payments/{payment_id}/void \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reason": "Customer requested cancellation",
"metadata": {
"cancel_reason": "customer_request"
}
}
'import requests
url = "https://api.lite.sa/v1/payments/{payment_id}/void"
payload = {
"reason": "Customer requested cancellation",
"metadata": { "cancel_reason": "customer_request" }
}
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({
reason: 'Customer requested cancellation',
metadata: {cancel_reason: 'customer_request'}
})
};
fetch('https://api.lite.sa/v1/payments/{payment_id}/void', 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({
reason: 'Customer requested cancellation',
metadata: {cancel_reason: 'customer_request'}
})
};
fetch('https://api.lite.sa/v1/payments/{payment_id}/void', 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}/void"
payload := strings.NewReader("{\n \"reason\": \"Customer requested cancellation\",\n \"metadata\": {\n \"cancel_reason\": \"customer_request\"\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}/void",
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([
'reason' => 'Customer requested cancellation',
'metadata' => [
'cancel_reason' => 'customer_request'
]
]),
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
ApiKeyAuthBearerAuth
API key for service-to-service or merchant authentication.
Headers
Unique identifier for request tracing. Generated by the client or server if not provided.
Example:
"550e8400-e29b-41d4-a716-446655440000"
Unique key for idempotent request processing. Duplicate requests with the same key are safely ignored.
Example:
"baf6a8e2-0c89-46ef-9ca5-faa65b99bcd5"
Path Parameters
Unique identifier of the payment
Example:
"9822ffb8-26de-423b-ad15-0d129cf1b4ac"
Body
application/json
Void an authorized payment
Previous
Refund a captured paymentRefunds all or part of a captured payment. If no amount is specified,
the full remaining captured amount is refunded.
Next
⌘I
Void an authorized payment
curl --request POST \
--url https://api.lite.sa/v1/payments/{payment_id}/void \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reason": "Customer requested cancellation",
"metadata": {
"cancel_reason": "customer_request"
}
}
'import requests
url = "https://api.lite.sa/v1/payments/{payment_id}/void"
payload = {
"reason": "Customer requested cancellation",
"metadata": { "cancel_reason": "customer_request" }
}
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({
reason: 'Customer requested cancellation',
metadata: {cancel_reason: 'customer_request'}
})
};
fetch('https://api.lite.sa/v1/payments/{payment_id}/void', 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({
reason: 'Customer requested cancellation',
metadata: {cancel_reason: 'customer_request'}
})
};
fetch('https://api.lite.sa/v1/payments/{payment_id}/void', 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}/void"
payload := strings.NewReader("{\n \"reason\": \"Customer requested cancellation\",\n \"metadata\": {\n \"cancel_reason\": \"customer_request\"\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}/void",
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([
'reason' => 'Customer requested cancellation',
'metadata' => [
'cancel_reason' => 'customer_request'
]
]),
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"
}
}