Payment
Any RC outside the range of 0-399 (timeout, bad gateway, etc) should be considered as "processing" and It requires the partner to hit API status after 150 seconds.
Endpoint
https://XXXXXX.XXXXXX.XXXXX.id/api/v2/bill/payment
Request
Here are examples of how to send a payment request to the OpenAPI system.
Sample Payment request
curl --location --request POST 'https://XXXXXX.XXXXXX.XXXXX.id/api/v2/bill/payment' \
--header 'KEY: UP0t6fB4qZ7j' \
--header 'TOKEN: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJ0bmVySWQiOiJVUDB0NmZCNHFaN2oiLCJwcm9kdWN0Q29kZSI6IlBQTFNUSzEwIiwiYWNjb3VudE51bWJlciI6IjA4MTI2NTUyNjUyIiwiaW5xdWlyeUlkIjoxNDMxNDYxNzMsImFtb3VudCI6MTA1NTAsImNhbGxiYWNrVXJscyI6WyJodHRwczovL3dlYmhvb2suc2l0ZS8yYjgzNmI3ZS0xNWYzLTQ4NGItYTQxMC0wODkyYTI4N2NhZmYiXSwicmVmTnVtYmVyIjoicHJkdGVzdHRkMTEzNDUifQ.9msTNlH6YXf5tDB-Tvmeg3-0ybRg2Arxgec9kpySbhg' \
--header 'VERSION: 2.0' \
--header 'Content-Type: application/json'
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dev.openapi.ayopop.id/api/v1/bill/payment"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("KEY", "API Key")
req.Header.Add("TOKEN", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpbnF1aXJ5SWQiOjMxMTgyLCJhY2NvdW50TnVtYmVyIjoiMDgxMzM5MzcyMzg5IiwicHJvZHVjdENvZGUiOiJQTFRLMTEiLCJhbW91bnQiOjExMDAwLCJyZWZOdW1iZXIiOiIxMTIzMzIyMjMzZmcxMiIsInBhcnRuZXJJZCI6InBhcnRuZXJfYXBpX2tleSIsImJ1eWVyRGV0YWlscyI6eyJidXllckVtYWlsIjoidGVzdEBnbWFpbC5jb20iLCJwdWJsaWNCdXllcklkIjoiMTEyMjQ1N0hHMjMifSwiQ2FsbGJhY2tVcmxzIjpbImh0dHBzOi8vd2ViaG9vay5zaXRlL2U2N2ZiN2E5LWY0YWUtNDBhMy1hN2RmLTJmYjQyZTQ4MDAyZSJdfQ.nPLObDgqhSlnIMXfEXW_y7m56YZwp8TVR3CgpNnIRUQ")
req.Header.Add("VERSION", "1.0")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Cache-Control", "no-cache")
req.Header.Add("Host", "dev.openapi.ayopop.id")
req.Header.Add("Accept-Encoding", "gzip, deflate")
req.Header.Add("Content-Length", "")
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 => "https://dev.openapi.ayopop.id/api/v1/bill/payment",
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: ",
"Content-Type: application/json",
"Host: dev.openapi.ayopop.id",
"KEY: API Key",
"TOKEN: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpbnF1aXJ5SWQiOjMxMTgyLCJhY2NvdW50TnVtYmVyIjoiMDgxMzM5MzcyMzg5IiwicHJvZHVjdENvZGUiOiJQTFRLMTEiLCJhbW91bnQiOjExMDAwLCJyZWZOdW1iZXIiOiIxMTIzMzIyMjMzZmcxMiIsInBhcnRuZXJJZCI6InBhcnRuZXJfYXBpX2tleSIsImJ1eWVyRGV0YWlscyI6eyJidXllckVtYWlsIjoidGVzdEBnbWFpbC5jb20iLCJwdWJsaWNCdXllcklkIjoiMTEyMjQ1N0hHMjMifSwiQ2FsbGJhY2tVcmxzIjpbImh0dHBzOi8vd2ViaG9vay5zaXRlL2U2N2ZiN2E5LWY0YWUtNDBhMy1hN2RmLTJmYjQyZTQ4MDAyZSJdfQ.nPLObDgqhSlnIMXfEXW_y7m56YZwp8TVR3CgpNnIRUQ",
"VERSION: 1.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: "https://dev.openapi.ayopop.id/api/v1/bill/payment",
method: "POST",
headers: {
accept: "application/json",
KEY: "API Key",
TOKEN:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpbnF1aXJ5SWQiOjMxMTgyLCJhY2NvdW50TnVtYmVyIjoiMDgxMzM5MzcyMzg5IiwicHJvZHVjdENvZGUiOiJQTFRLMTEiLCJhbW91bnQiOjExMDAwLCJyZWZOdW1iZXIiOiIxMTIzMzIyMjMzZmcxMiIsInBhcnRuZXJJZCI6InBhcnRuZXJfYXBpX2tleSIsImJ1eWVyRGV0YWlscyI6eyJidXllckVtYWlsIjoidGVzdEBnbWFpbC5jb20iLCJwdWJsaWNCdXllcklkIjoiMTEyMjQ1N0hHMjMifSwiQ2FsbGJhY2tVcmxzIjpbImh0dHBzOi8vd2ViaG9vay5zaXRlL2U2N2ZiN2E5LWY0YWUtNDBhMy1hN2RmLTJmYjQyZTQ4MDAyZSJdfQ.nPLObDgqhSlnIMXfEXW_y7m56YZwp8TVR3CgpNnIRUQ",
VERSION: "1.0",
"Content-Type": "application/json",
"Cache-Control": "no-cache",
Host: "dev.openapi.ayopop.id",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "",
Connection: "keep-alive",
"cache-control": "no-cache"
},
processData: false,
data: ""
};
$.ajax(settings).done(function(response) {
console.log(response);
});
Sample Payment body payload
{
"inquiryId": 31182,
"accountNumber": "081339372389",
"productCode": "PLTK11",
"amount": 11000,
"refNumber": "1123322233fg12",
"partnerId": "partner_api_key",
"buyerDetails": {
"buyerEmail": "[email protected]",
"publicBuyerId": "1122457HG23",
"phoneNumber": "081339372389"
},
"CallbackUrls": [
"https://XXXXXX.XXXXXXX/XXXXXX-XXXX-XX-XXXX-XXXXXXXXX"
]
}
The body for the token is defined below
Parameter | Type | Mandatory | Description |
---|---|---|---|
partnerId | STRING | Yes | Partner API key provided |
accountNumber | STRING | Yes | The account number for which payment is being done. |
productCode | STRING | Yes | The product code provided |
inquiryId | INT | Yes | The ID of the inquiry for which the payment is being done. This has to be a previously done successful inquiry. |
amount | INT | Yes | The amount of the bill to be paid. This amount has to match the product price or a valid bill amount. |
refNumber | STRING | Yes | A unique reference number provided by the partner towards each payment. One ref number can only be used towards one payment request. |
Month | INT | No | It is required for BPJS category. Specify the number of months for which payment is to be done. |
billIds | ARRAY | No | It is required for Edukasi category.Send the billIds for which payment is to be done. |
buyerDetails | JSON OBJECT | No | This is an additional functionality provided where users will receive email of transaction details for success transactions. |
callbackUrls | ARRAY | No | Specify list of Callback Urls for receiving payment response |
Sample Payment Response(Prepaid) - Processing
{
"responseCode": 299,
"success": true,
"message": {
"ID": "Transaksi sedang dalam proses",
"EN": "Your transaction is being processed"
},
"data": {
"refNumber": "pldny_005",
"transactionId": 49656,
"accountNumber": "0822300005",
"amount": 1000,
"totalAdmin": 0,
"processingFee": 0,
"denom": "",
"productCode": "PLSTK01",
"productName": "Telkomsel Pulsa",
"category": "Pulsa",
"token": "",
"customerDetails": [],
"billDetails": [],
"productDetails": [],
"extraFields": []
}
}
Sample Payment Response(Prepaid) - Success
{
"responseCode": 4,
"success": true,
"message": {
"ID": "Transaksi Anda Telah Berhasil",
"EN": "Your transaction was successful"
},
"data": {
"refNumber": "art_55",
"transactionId": 52722,
"accountNumber": "0814111111200",
"amount": 25100,
"totalAdmin": 0,
"processingFee": 0,
"denom": "",
"productCode": "PLSPRIDA25K",
"productName": "Indosat Pulsa 25.000",
"category": "Pulsa",
"token": "1908202085666581",
"customerDetails": [
{
"key": "Nama Pelanggan",
"value": "N/A"
},
{
"key": "Waktu & Tanggal Pembayaran",
"value": "05 May 2021 | 19:58"
},
{
"key": "Nomor Kontrak",
"value": "0814111111200"
}
],
"billDetails": [],
"productDetails": [
{
"key": "SN Number",
"value": "1908202085666581"
}
],
"extraFields": []
}
}
Sample Payment Response(Prepaid) - Failed
{
"responseCode": 199,
"success": false,
"message": {
"ID": "Transaction has failed.Please try again.",
"EN": "Transaction has failed.Please try again."
},
"data": {
"refNumber": "la004",
"transactionId": 42080,
"accountNumber": "82330289494",
"amount": 10000,
"totalAdmin": 0,
"processingFee": 0,
"denom": "",
"productCode": "LAEM10",
"productName": "LinkAja Rp 10.000",
"category": "eMoney",
"token": "N/A",
"customerDetails": [],
"billDetails": [],
"productDetails": [],
"extraFields": []
}
}
Sample Payment Response(Postpaid) - Processing
{
"responseCode": 299,
"success": true,
"message": {
"ID": "Transaksi sedang dalam proses",
"EN": "Your transaction is processing"
},
"data": {
"refNumber": "3475853745WE24",
"transactionId": 8840,
"accountNumber": "044123123000564",
"amount": 3999700,
"totalAdmin": 7500,
"processingFee": 200,
"productCode": "PASF",
"productName": "Smart Finance",
"category": "Pembayaran Angsuran",
"token": "",
"customerDetails": [],
"billDetails": [],
"productDetails": [],
"extraFields": []
}
}
Below are details for each field and the value type.
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 payment |
message | JSON | Messages in Bahasa and English describing the RC above. |
data | JSON | The main payload with the payment details. |
DATA OBJECT
Parameter | Type | Description |
---|---|---|
refNumber | STRING | This is the reference number sent by partner. Unique per payment. |
transactionId | INT | The transaction ID of OpenAPI. |
accountNumber | STRING | The account number / IDPEL / Email address towards the payment. |
productCode | STRING | The product code sent by partner towards the transaction |
customerName | STRING | The name of the customer whose bill / payment is done. |
productName | STRING | Name of the Brand and Product whose payment 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 |
validity | STRING | Validity of the product if available. |
token | STRING | It is the reference number recieved on successful recharge. |
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. |
BILL DETAILS OBJECT
Each billDetails
object has a structure like defined below. Each object will have billID
parameter, which if applicable will be the bill Item ID, corresponding to an individual bill.
Parameter | Type | Description |
---|---|---|
billID | STRING | ID of the individual bill item. If 0 , Bill item cannot be skipped in payment. |
billInfo | JSON Object | Key / Value pair of the item details with name and amount. |
**Note: All the above responses are for a specific category, and Responses may vary based on the categories.
For the category-specific response please refer to Categorised Response
Updated 9 months ago