- Cancel API can not be applied to all product categories
- Products that have Cancel API can be checked in Categories Response
Request
Here are examples of how to send a cancel request to the OpenAPI system.
The body for the token is defined below
Parameter | Type | Mandatory | Description |
---|---|---|---|
partnerId | STRING | Yes | Partner API key provided |
account_Number | STRING | Yes | enrollmentId which was received in the callback enrollment |
ref_number | STRING | Yes | Partner ref_number sent in enrollment request |
Sample Inquiry request
curl -X POST
{api-url}/api/v2/bill/cancel
-H 'cache-control: no-cache'
-H 'content-type: application/json'
-H 'key: test-key'
-H 'token: token'
-H 'version: 2.0'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{api-url}/api/v2/bill/cancel"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("accept", "application/json")
req.Header.Add("KEY", "API Key")
req.Header.Add("TOKEN", "token")
req.Header.Add("VERSION", "2.0")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Cache-Control", "no-cache")
req.Header.Add("Accept-Encoding", "gzip, deflate")
req.Header.Add("Content-Length", "2")
req.Header.Add("Connection", "keep-alive")
req.Header.Add("cache-control", "no-cache")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "{api-url}/api/v2/bill/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{}",
CURLOPT_HTTPHEADER => array(
"Accept-Encoding: gzip, deflate",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Content-Length: 2",
"Content-Type: application/json",
"KEY: API Key",
"TOKEN: token",
"VERSION: 2.0",
"accept: application/json",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
var settings = {
async: true,
crossDomain: true,
url: "{api-url}/api/v2/bill/cancel",
method: "POST",
headers: {
accept: "application/json",
KEY: "API Key",
TOKEN:"token",
VERSION: "2.0",
Content-Type: "application/json",
Cache-Control: "no-cache",
Accept-Encoding: "gzip, deflate",
Content-Length: "2",
Connection: "keep-alive",
cache-control: "no-cache"
},
processData: false,
data: "{}"
};
$.ajax(settings).done(function(response) {
console.log(response);
});
Sample Inquiry body payload
{
"partnerId": "ayopop",
"account_number": "43554",
"ref_number": "5324354"
}
Sample Inquiry Response (Prepaid) - Success
{
"responseCode": 600,
"success": true,
"message": {
"ID": "Pembatalan Sukses",
"EN": "Cancellation Successful"
},
"data": {
"refNumber": "2074134",
"transactionId": 0,
"accountNumber": "0812300001",
"amount": 1000,
"totalAdmin": 0,
"processingFee": 0,
"denom": "",
"productCode": "PPLSTEK1",
"productName": "Rp. 1.000",
"category": "",
"token": "",
"customerDetails": [],
"billDetails": [],
"productDetails": [],
"extraFields": []
}
}
TOP LEVEL
Parameter | Type | Description |
---|---|---|
responseCode | INT | Status of the payment request. Refer to the Response code section/document for more details |
success | BOOLEAN | Status of Inquiry |
message | JSON | Messages in Bahasa and English describing the RC above. |
data | JSON | The main payload with the Bill details. |
DATA OBJECT
Parameter | Type | Description |
---|---|---|
accountNumber | STRING | The enrollmentId which was received in the callback enrollment |
productCode | STRING | The product code sent by the partner towards the transaction |
productName | STRING | Name of the Brand and Product whose inquiry is being done. |
category | STRING | Category of the product |
amount | INT | Final amount to be paid for the product / bill. This amount already includes Total Admin Fee. |
totalAdmin | INT | Total Administrative charges. |
processingFee | INT | Additional processing fee that is added on behalf of the partner towards its customers |
customerDetails | JSON nested object | Key / Value structure nest JSON object. This object provides customer specific details regarding the bill. |
billDetails | JSON nested object | Key / Value structure nest JSON object. This object provides bill-specific details regarding the bill. More details about this section below |
productDetails | JSON nested object | Key / Value structure nest JSON object. This object provides product specific details regarding the bill. |
extraFields | JSON nested object | Key / Value structure nest JSON object. This object provides additional details regarding the bill. |