Cancel open invoice
Cancels an existing open invoice for a merchant. Once canceled, the invoice cannot be paid or processed further. The request should include the invoice ID
DELETE
Base URL
Sandbox Base URL
Strictly for sandbox testing. Never use the sandbox URL in your production environment.
https://merchantapisandbox.hesabe.com
bearerAuthheader
AuthorizationBearer <JWT>Pass access token obtained from login endpoint
accessCode*stringPass the merchant access code issued by Hesabe
Accept*stringapplication/json
Content-Type*stringapplication/json
id*numberPass the invoice object "id" field number
application/json- body
data*stringConvert payload JSON object to encrypted string and send it to the server
Payload details:
Contains the list of parameters and their corresponding values required to make the API request.
| Field Name | Description | Required |
|---|---|---|
merchantCode | Pass the merchant code provided by Hesabe | Yes |
Sample Encryption and Decryption Process:
The following steps demonstrate how to integrate with this API using sandbox credentials.
Step 1: Create JSON Object
{ "merchantCode": "842217"}Step 2: Convert the JSON object into an encrypted string format and post to Hesabe
{ "data": "0e7898bd7464d0c402fe8a949d9cbf9b826ccb9b83b56fa003373275f1947a65"}Step 3: Receive encrypted response from Hesabe:
{ "response": "60a8f6241932227b840a9f5e36987f4df645edae356a969d3dd7123d8946484a491a63babf0d76f8c0a3c26228f91e6efec00efd54ddb9d0ef71dc819aef2f0710a2f4d849b7a625fec687ab4bdf1e7aa54dcf7e9664e666669b04b90667658f"}Step 4: Decrypt the API response and view the JSON output
{ "status": true, "message": "Open Invoice canceled successfully", "response": null}Details fetched successfully. Decrypt the server response to view the final result
application/json- response
status?booleanmessage?stringresponse?|nullconst body = JSON.stringify({ "data": "0e7898bd7464d0c402fe8a949d9cbf9b826ccb9b83b56fa003373275f1947a65"})fetch("https://merchantapisandbox.hesabe.com/api/v1/open-invoice/926", { method: "DELETE", headers: { "Content-Type": "application/json", "accessCode": "c333729b-d060-4b74-a49d-7686a8353481", "Accept": "application/json" }, body})Example Response
{ "status": true, "message": "Open Invoice canceled successfully", "response": null}