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
/api/v1/open-invoice/{id}
AuthorizationBearer <token>

Pass access token obtained from login endpoint

In: header

Path Parameters

idnumber

Pass the invoice object "id" field number

Header Parameters

accessCodestring

Pass the merchant access code issued by Hesabe

Acceptstring

application/json

Content-Typestring

application/json

datastring

Convert 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 NameDescriptionRequired
merchantCodePass the merchant code provided by HesabeYes

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
}

Response Body

application/json

application/json

application/json

application/json

const 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})
{
  "status": true,
  "message": "Open Invoice canceled successfully",
  "response": null
}
{
  "status": false,
  "message": "Request not found, Please verify the request data",
  "response": null
}
{
  "message": "Internal server error occurred"
}
{
  "status": false,
  "code": 506,
  "message": "Invalid Request Data",
  "response": null
}