# Card list

# Request

  • PHP
<?php
 $curl = curl_init();

 //key order must be same order generate signature dataString
 $requestBody = [
     "merchantId" => "xxxxxxx",
     "reference" => "1234",
     "type" => "LIST_CARD"
 ];

 curl_setopt_array($curl, array(
     CURLOPT_URL => "https://dev.directpay.lk/v1/mpg/api/external/cardManagement",
     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: xxxxxxx",
     "x-api-key: xxxxxx"
 ),
 ));

 $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
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 LIST_CARD

# Response

SuccessResponse

 {
    "status": 200,
    "data": {
        "cardList": [
            {
                "brand": "MASTERCARD",
                "cardId": 792,
                "issuer": "Bank",
                "mask": "222300xxxxxx0007",
                "nickName": "My Card",
                "reference": "1234"
            }
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

ErrorResponse

{
    "status": 400,
    "data": {
        "error": "ValidationException",
        "message": "Invalid Merchant."
    }
}
1
2
3
4
5
6
7