# Request

  • PHP
<?php

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

$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
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
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
scheduledId String Directpay schedule id
type String API request type SCHEDULE_STATUS

# Response

Transaction

{
    "status": 200,
    "type": "SCHEDULE_STATUS",
    "paymentCategory": "SCHEDULE_STATUS",
    "data": [
        {
            "amount": "100.88",
            "currency": "LKR",
            "interval": "MONTHLY",
            "nextPaymentDate": "2020-07-28 00:00:00",
            "endDate": "2020-10-25 00:00:00",
            "startDate": "2020-08-01 00:00:00",
            "state": "SCHEDULED",
            "lastPaymentStatus": "FAILED",
            "lastPaymentStatusDescription": "Transaction UnSuccess",
            "isRetry": "NO",
            "retryAttempts": 0,
            "doFirstPayment": "NO",
            "transaction": [
                {
                    "909": {
                        "status": "PENDING",
                        "bankerResponseDesc": null,
                        "transactionId": 909,
                        "amount": "100.88",
                        "currency": "LKR",
                        "dateTime": "2020-06-30 18:13:07",
                        "payer": {
                            "name": "sdfdsf",
                            "card": "511111xxxxxx1118"
                        }
                    }
                },
                {
                    "904": {
                        "status": "SUCCESS",
                        "bankerResponseDesc": null,
                        "transactionId": 904,
                        "amount": "100.88",
                        "currency": "LKR",
                        "dateTime": "2020-06-30 17:31:23",
                        "payer": {
                            "name": "sdfdsf",
                            "card": "511111xxxxxx1118"
                        }
                    }
                }
            ]
        }
    ]
}

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52

ErrorResponse

 {
     "status": 400,
     "type": "SCHEDULE_STATUS",
     "paymentCategory": "SCHEDULE_STATUS",
     "data": {
         "code": "VALIDATION_EXCEPTION",
         "message": "Schedule not found."
     }
 },
  {
     "status": 400,
     "type": "-",
     "paymentCategory": "-",
     "data": {
         "code": "VALIDATION_EXCEPTION",
         "message": "Invalid type."
     }
 }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18