URL-PATH
manageSchedule
1
# Request
- PHP
<?php
$curl = curl_init();
//key order must be same order generate signature dataString
$requestBody = [
"merchantId" => "xxxxxxx",
"type" => "MANAGE_SCHEDULE",
"scheduledId"=>"1269",
"state"=>"CONFIRMED",
"nextPaymentDate"=>"2020-07-23",
"interval"=>"MONTHLY",
"amount"=>"500.29",
"endDate"=>"2020-07-25"
];
curl_setopt_array($curl, array(
CURLOPT_URL => "https://dev.directpay.lk/v1/mpg/api/external/transaction/manageSchedule",
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: j+02o+Q5cH+pXV",
"x-api-key: dnfo8743ythbf9n7cr8yh473n",
"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
33
34
35
36
37
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
# Header
Field | Type | Description | Mandatory |
---|---|---|---|
Content-Type | String | application/json | Yes |
Signature | String | Signature generated for the data | Yes |
x-api-key | String | Merchant api key | Yes |
# Parameter
Field | Type | Description | Allowed values | Mandatory |
---|---|---|---|---|
merchantId | String | Merchant ID | Yes | |
scheduledId | String | Directpay schedule id. | Yes | |
type | String | API request type | MANAGE_SCHEDULE | Yes |
state | String | Schedule state | CONFIRMED, CANCELLED, ENDED | Optional |
nextPaymentDate | String | Next recurring date | Y-m-d | Optional |
interval | String | Payment interval | MONTHLY, YEARLY, BIANNUAL, QUARTERLY | Optional |
amount | Decimal | Transaction amount. | Optional | |
endDate | String | End recurring date. | Y-m-d | Optional |
Info
Once schedule state set to ENDED, cannot re CONFIRMED or CANCELLED.
# Response
SuccessResponse
{
"status": 200,
"type": "MANAGE_SCHEDULE",
"paymentCategory": "MANAGE_SCHEDULE",
"data": {
"scheduledId": 1269,
"amount": "500.29",
"currency": "LKR",
"interval": "MONTHLY",
"nextPaymentDate": "2020-07-23",
"endDate": "2020-07-25",
"startDate": "2020-08-11 00:00:00",
"state": "CONFIRMED",
"lastPaymentStatus": "SUCCESS",
"lastPaymentStatusDescription": "SUCCESS",
"isRetry": "YES",
"retryAttempts": 0,
"doFirstPayment": "YES"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ErrorResponse
{
"status": 400,
"data": {
"code": "VALIDATION_EXCEPTION",
"message": "Invalid end date."
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7