Remove Saved Card

Delete a saved card and its MPGS token permanently

DELETE
/api/direct-payment/cards/{cardId}

Path Parameters

cardIdinteger

The card_id received from VERIFY or GET /api/direct-payment/cards

Header Parameters

accessCodestring

Pass the merchant access code issued by Hesabe

Content-Typestring

application/json

datastring

Convert payload JSON object to encrypted string and send it to the server

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"
}

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

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": "60a8f6241932227b840a9f5e36987f4db903974d1c3d52c9477e081b7b7021a24e12d8167593b972419d1d00e26889ae4ab1235ca98f00197e09d3fcf7eca2aa0f0f8996bc23bb232e3c487734b61a82386eaa3a19bb821e39e58231c2270acd"
}

Step 4: Decrypt the api response and view the JSON output

{
  "status": true,
  "code": 200,
  "message": "Card removed successfully",
  "response": null
}

Response Body

application/json

application/json

application/json

application/json

application/json

const body = JSON.stringify({  "data": "0e7898bd7464d0c402fe8a949d9cbf9b826ccb9b83b56fa003373275f1947a65"})fetch("https://sandbox.hesabe.com/api/direct-payment/cards/2270", {  method: "DELETE",  headers: {    "Content-Type": "application/json",    "accessCode": "c333729b-d060-4b74-a49d-7686a8353481"  },  body})
{
  "status": true,
  "code": 200,
  "message": "Card removed successfully",
  "response": null
}
{
  "status": false,
  "message": "Invalid request data — please check your payload and try again",
  "response": null
}
{
  "status": false,
  "message": "Unauthorized — the provided accessCode is missing or invalid",
  "response": null
}
{
  "status": false,
  "message": "Forbidden — you do not have permission to access this resource",
  "response": null
}
{
  "status": false,
  "message": "Internal Server Error — an unexpected error occurred, please try again later",
  "response": null
}