1.0.1 • Published 3 years ago

@iak-id/iak-api-client-js v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Client Side JS - IAK

This is JavaScript client side library to help you integrate your system to Indobest Artha Kreasi / IAK and consist of two section, prepaid and postpaid

For further details please check the documentation in this link https://developer.mobilepulsa.net/documentation

Note: Please registered your DNS first in this link https://developer.mobilepulsa.net before using this library

Installation

Using npm

npm install @iak-id/client_side_js_iak

Prepaid Library

Prepaid library is used for top up transaction e.g: pulsa / phone credit, emoney credit, voucher, voucher game, etc.

Check Balance

API for checking your deposit nominal

Call check balance function with this format checkBalance(environment, username, key)

(async () => {
  const checkBalanceResponse = await checkBalance(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx"
  );
})();

Pricelist

Call pricelist function with this format pricelist(environment, username, key, status, type, operator)

Code Example without type and operator

(async () => {
  const pricelistResponse = await pricelist(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "all"
  );
})();

Code Example with type only

(async () => {
  const pricelistResponse = await pricelist(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "all",
    "pulsa"
  );
})();

Code Example with type and operator

(async () => {
  const pricelistResponse = await pricelist(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "all",
    "pulsa",
    "xxxxxxxx"
  );
})();

Top Up

Call top up function with this format topUp(environment, username, key, refId, customerId, productCode)

Note: If you use the same refId, we will treat it as check status API

(async () => {
  const topUpResponse = await topUp(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "client-js-test-1",
    "0818xxxxxx",
    "pulsa5000"
  );
})();

Check Status

Call check status function with this format checkStatus(environment, username, key, refId)

(async () => {
  const checkStatusResponse = await checkStatus(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "client-js-test-1"
  );
})();

Inquiry PLN / Electricity

Call inquiry PLN function with this format inquiryPln(environment, username, key, customerId)

(async () => {
  const inquiryPlnResponse = await inquiryPln(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "12345678901"
  );
})();

Inquiry Game

Call inquiry game function with this format inquiryGame(environment, username, key, customerId, gameCode)

(async () => {
  const inquiryGameServerResponse = await inquiryGameServer(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "127"
  );
})();

Inquiry Game Server List

Call inquiry game server function with this format inquiryGameServer(environment, username, key, gameCode)

(async () => {
  const inquiryGameServerResponse = await inquiryGameServer(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "127"
  );
})();

Postpaid Library

Postpaid library is used for transaction with inquiry and payment system e.g: water bill, electricity bill, finance bill, insurance bill, etc.

Pricelist

Call pricelist postpaid function with this format pricelistPasca(environment, username, key, status, type, province)

Code Example without type and province

(async () => {
  const checkStatusResponse = await pricelistPasca(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx"
  );
})();

Code Example with type only

(async () => {
  const checkStatusResponse = await pricelistPasca(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "non-active",
    "internet"
  );
})();

Code Example with type and province

(async () => {
  const checkStatusResponse = await pricelistPasca(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "all",
    "pdam",
    "jawa barat"
  );
})();

Inquiry

Call inquiry function with this format inquiry(environment, username, key, productCode, customerId, refId, month, nomor_identitas)

  • environment --> required "sandbox" or "prod"
  • username --> required your registered phone number in https://developer.mobilepulsa.net
  • key --> required your development or production secret key for Library Client JS
  • productCode --> required see the full list in Pricelist Pasca API
  • customerId --> required
  • refId --> required your order number / reference ID (Must Unique)
  • month --> optional you have to fill it only for BPJS product code
  • nomor_identitas --> optional you have to fill it only for ESAMSAT product type

Code Example

(async () => {
  const inquiryResponse = await inquiry(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "PLNPOSTPAIDB",
    "530000000001",
    "client-js-postpaid-1"
  );
})();

Code Example for BPJS Product

(async () => {
  const inquiryResponse = await inquiry(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "BPJS",
    "8801234560001",
    "client-js-postpaid-2",
    "2"
  );
})();

Code Example for Esamsat Product Type

(async () => {
  const inquiryResponse = await inquiry(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "ESAMSAT.JAWABARAT",
    "9658548523568701",
    "client-js-postpaid-3"
    null,
    "0212502110170100"
  );
})();

Payment

Call payment function with this format payment(environment, username, key, productCode, trId)

(async () => {
  const paymentResponse = await payment(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "9898845"
  );
})();

Check Status

Call payment function with this format payment(environment, username, key, refId)

(async () => {
  const checkStatusPascaResponse = await checkStatusPasca(
    "sandbox",
    "0818xxxxxx",
    "123xxxxxxxxxxxxxxxxx",
    "client-js-postpaid-4"
  );
})();