Delete Receipt
The Delete Receipt API allows you to delete an existing receipt from the system. This API is useful for managing receipts and ensuring data integrity by removing outdated or incorrect entries.
API URLs
Property | Value |
---|---|
Sandbox | https://malaysia-sandbox.complyance.io |
Production | https://malaysia-prod.complyance.io/ |
Endpoint | /deleteReceipt?receiptNumber= |
Method | POST |
Headers
Header | Type | Description | Example | Conditionality |
---|---|---|---|---|
x-api-key | string | Your API key | 12345678uygh1jkm | Mandatory |
Content-Type | string | Set as application/json | application/json | Mandatory |
Request Parameters
Parameter | Description | Required | Example |
---|---|---|---|
receiptNumber | Receipt identifier | Yes | Receipt/002/PQRS |
Response
Success Response
HTTP Status Code: 200 OK
Response Body:
{
"status": "success",
"message": "Receipt deleted successfully."
}
Error Responses
HTTP Status Code | Error Code | Description |
---|---|---|
400 | BAD_REQUEST | The provided input is invalid or missing fields. |
401 | UNAUTHORIZED | The API key is missing or invalid. |
404 | NOT_FOUND | The specified receipt does not exist. |
500 | SERVER_ERROR | An internal server error occurred. |
Example Error Response:
{
"status": "error",
"message": "Receipt not found or already deleted."
}
Usage Example
- Shell
- JavaScript
- Python
- PHP
- Java
- Go
curl --location 'https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber=' \
--header 'Content-Type: application/json' \
--header 'x-api-key: 12345678uygh1jkm' \
--data '{
"receiptNumber": "TestingReceips"
}'
const headers = {
'Content-Type': 'application/json',
'x-api-key': '12345678uygh1jkm'
};
const body = {
receiptNumber: 'TestingReceips'
};
fetch('https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber=', {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests
url = 'https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber='
headers = {
'Content-Type': 'application/json',
'x-api-key': '12345678uygh1jkm'
}
data = {
'receiptNumber': 'TestingReceips'
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
<?php
$url = 'https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber=';
$headers = [
'Content-Type: application/json',
'x-api-key: 12345678uygh1jkm'
];
$data = [
'receiptNumber' => 'TestingReceips'
];
$options = [
'http' => [
'header' => $headers,
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
URL url = new URL("https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber=");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("x-api-key", "12345678uygh1jkm");
con.setDoOutput(true);
String jsonInputString = "{\"receiptNumber\": \"TestingReceips\"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
try (BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
}
}
package main
import (
"bytes"
"net/http"
"io/ioutil"
"fmt"
)
func main() {
url := "https://malaysia-prod.complyance.io/deleteReceipt?receiptNumber="
jsonData := []byte(`{"receiptNumber": "TestingReceips"}`)
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "12345678uygh1jkm")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
Notes
- Ensure the
x-api-key
header contains a valid API key. - The
receiptNumber
parameter is required and must correspond to an existing receipt. - The API operates in a sandbox environment, so it is suitable for testing purposes.
Success Handling
The API may return the following success responses depending on the validation result or submission status:
Status Code | Description |
---|---|
200 | Success – The receipt was deleted successfully. |
Ensure that your request body and headers are correctly formatted to avoid errors.
Error Handling
The API may return the following error responses depending on the validation result or request issues:
Error Code | Description |
---|---|
400 | Bad Request – Invalid data in the request. |
401 | Unauthorized – Invalid or missing API key. |
404 | Not Found – The specified receipt does not exist. |
500 | Internal Server Error – Server encountered an error. |