# Card delete

# Request

  • PHP
<?php

 $curl = curl_init();

 //key order must be same order generate signature dataString
 $requestBody = [
     "merchantId" => "xxxxxxx",
     "reference" => "1566895327605",
     "type" => "DELETE_CARD",
     "cardId" => "791"
 ];

 curl_setopt_array($curl, array(
     CURLOPT_URL => "https://dev.directpay.lk/v1/mpg/api/external/cardManagement",
     CURLOPT_RETURNTRANSFER => true,
     CURLOPT_ENCODING => "",
     CURLOPT_MAXREDIRS => 10,
     CURLOPT_TIMEOUT => 30,
     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
     CURLOPT_CUSTOMREQUEST => "POST",
     CURLOPT_POSTFIELDS => json_encode($requestBody),
     CURLOPT_HTTPHEADER => array(
     "Content-Type: application/json",
     "Signature: xxxxxx",
     "x-api-key: xxxxx"
 ),
 ));

 $response = curl_exec($curl);
 $err = curl_error($curl);

 curl_close($curl);

 if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Field Type Description
Content-Type String application/json
Signature String Signature generated for the data
x-api-key String Merchant api key

# Parameter

Field Type Description Allowed values
merchantId String Merchant ID
reference String Unique value for identify the card holder.
type String API request type DELETE_CARD
cardId Integer Listed cards selected card id

# Response

SuccessResponse

{
    "status": 200,
    "data": {
        "success": true
    }
}
1
2
3
4
5
6

ErrorResponse

{
    "status": 200,
    "data": {
        "success": false
    }
}
1
2
3
4
5
6