Remove a saved card

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

Base URL

Sandbox Base URL

Strictly for sandbox testing. Never use the sandbox URL in your production environment.
https://sandbox.hesabe.com

Remove a saved card by its cardId. The token is deleted at MPGS first; only if MPGS confirms deletion is the card deactivated on Hesabe's side. Once removed, any charge-card call with that card_id will fail.

Header Parameters

accessCode*string

Pass the merchant access code issued by Hesabe

Content-Type*string

application/json

Path Parameters

cardId*integer

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

Request Body

application/json
  1. body
data*string

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

Card removed successfully

application/json
  1. response
status?boolean
code?integer
message?string
response?unknown
Example Request
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})
Example Response
{  "status": true,  "code": 200,  "message": "Card removed successfully",  "response": null}