Product List

Request

Here are examples of how to send a Product fetch request to the OpenAPI system.

Sample fetch Product list request

curl -X POST \
  {base-url}/api/v2/partner/products
  -H 'Content-Type: application/json' 
  -H 'KEY: API Key' 
  -H 'TOKEN: token' 
  -H 'VERSION: 2.0' 
  -H 'accept: application/json' 
  -H 'cache-control: no-cache'
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "{base-url}/api/v2/partner/products"
  method := "POST"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("KEY", "API Key")
  req.Header.Add("TOKEN", "token")
  req.Header.Add("VERSION", "2.0")
  req.Header.Add("accept", "application/json")
  req.Header.Add("cache-control", "no-cache")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => '{base-url}/api/v2/partner/products',
  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_HTTPHEADER => array(
    'Content-Type: application/json',
    'KEY: API Key',
    'TOKEN: token',
    'VERSION: 2.0',
    'accept: application/json',
    'cache-control: no-cache'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var settings = {
  "url": "{base-url}/api/v2/partner/products",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "KEY": "API Key",
    "TOKEN": "token",
    "VERSION": "2.0",
    "accept": "application/json",
    "cache-control": "no-cache"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Sample payload for the token

{
  "partnerId": "partner_api_key"
}

The body for the token is defined below

ParameterTypeMandatoryDescription
partnerIdSTRINGYesPartner API key provided
productCodeSTRINGNoThis parameter returns details of the specific product code in the API response
categorySTRINGNoThis parameter returns all products that belong to the specified category
billerSTRINGNoThis parameter returns all products that belong to the specified biller
statusSTRINGNoThis parameter returns details of the specific product status whether it is active or Inactive

Response

This API is called to check all Product lists.

Sample response for Product list Request

{
    "responseCode": 200,
    "success": true,
    "message": {
        "ID": "Daftar Produk.",
        "EN": "Product list."
    },
    "data": [
        {
            "name": "Testing004",
            "description": "",
            "code": "T004",
            "logo": "",
            "amount": 0,
            "adminFee": 2500,
            "biller": "PLN Postpaid",
            "category": "PDAM",
            "active": false,
            "type": "postpaid"
        },
        {
            "name": "PLN Prepaid 500.000",
            "description": "",
            "code": "PLSTPL500",
            "logo": "",
            "amount": 24700,
            "adminFee": 0,
            "biller": "PLN Prepaid",
            "category": "Listrik",
            "active": true,
            "type": "prepaid"
        }
    ]
}

Below are details for each field and the value type.

TOP LEVEL

ParameterTypeDescription
responseCodeINTStatus of the product list request. Refer to the Response code section/document for more details
messageJSONMessages in Bahasa and English describing the RC above.
successBOOLEANStatus of api
dataARRAYList of products

DATA OBJECT

ParameterTypeDescription
nameSTRINGProduct name.
descriptionSTRINGProduct description.
codeSTRINGProduct code
logoSTRINGLogo of each product
amountFLOATProduct amount
adminFeeFLOATProduct admin fee
activeBOOLEANProduct Status
typeSTRINGType of product (postpaid, prepaid)
billerSTRINGBiller Name
categorySTRINGCategory Name