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.
Request
Here are examples of how to send a payment request to the OpenAPI system.
Sample Payment request
curl --location --request POST '{base-url}/api/v2/bill/payment' \
--header 'KEY: api-key' \
--header 'TOKEN: token' \
--header 'VERSION: 2.0' \
--header 'Content-Type: application/json'
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "{base-url}/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", "token")
req.Header.Add("VERSION", "1.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", "")
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 => "{base-url}/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",
"KEY: API Key",
"TOKEN: token",
"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: "{base-url}/api/v1/bill/payment",
method: "POST",
headers: {
accept: "application/json",
KEY: "API Key",
TOKEN:"token",
VERSION: "1.0",
Content-Type: "application/json",
Cache-Control: "no-cache",
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": [
"your-callback-url"
]
}
Response
In the payment response, there are three possible statuses of transaction. It could be Pending(Processing), Success or Failed.
For Pending transactions, the partner could check Status API/Callback for final status.
If in payment response the partner already gets the final status (Success or Failed) Ayoconnect will not send the callback to the partner
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 made. |
productCode | STRING | Yes | The product code provided |
inquiryId | INT | Yes | The ID of the inquiry for which the payment is being made. 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 | The partner provides a unique reference number for each payment. One ref number can only be used towards one payment request. |
Month | INT | No | It is required for the BPJS category. Specify the number of months for which payment is to be made. |
billIds | ARRAY | No | It is required for the 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 an email with transaction details for successful transactions. |
callbackUrls | ARRAY | No | Specify a 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": "product-code",
"productName": "product-name",
"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": "product-code",
"productName": "product-name",
"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": "product-code",
"productName": "product-name",
"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": "product-code",
"productName": "product-name",
"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 the 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 the partner toward 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 | The final amount to be paid for the product/bill. This amount already includes the 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 received 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 a billID
parameter, which if applicable will be the bill Item ID, which corresponds 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