PHP code example of indrapwa / bpjsv2

1. Go to this page and download the library: Download indrapwa/bpjsv2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

indrapwa / bpjsv2 example snippets


use Indrapwa\Bpjsv2\Antrean\Service;

// 1. bpjs config utama
$config = [
    'cons_id' => '12345',
    'secret_key' => '12345',
    'base_url' => 'https://apijkn-dev.bpjs-kesehatan.go.id/antreanrs_dev',
];
$antreanService = new Service($config);


// 2. set header
$headers = [
    'x-cons-id' => $config['cons_id'],
    'x-timestamp' => $antreanService->getTimestamp(),
    'x-signature' => $antreanService->getSignature(),
    'user_key' => '12345'
];
$antreanService->setHeaders($headers);


// 3. eksekusi service
echo 'Referensi Poli</br>';
echo json_encode($antreanService->poli(), true);

echo 'Referensi Dokter</br>';
echo json_encode($antreanService->dokter(), true);

echo 'Tambah Antrean<br/>';
$data = [
    "kodebooking" => "16032021A001",
    "jenispasien" => "JKN",
    "nomorkartu" => "00012345678",
    "nik" => "3212345678987654",
    "nohp" => "085635228888",
    "kodepoli" => "ANA",
    "namapoli" => "Anak",
    "pasienbaru" => 0,
    "norm" => "123345",
    "tanggalperiksa" => "2021-01-28",
    "kodedokter" => 12345,
    "namadokter" => "Dr. Hendra",
    "jampraktek" => "08:00-16:00",
    "jeniskunjungan" => 1,
    "nomorreferensi" => "0001R0040116A000001",
    "nomorantrean" => "A-12",
    "angkaantrean" => 12,
    "estimasidilayani" => 1615869169000,
    "sisakuotajkn" => 5,
    "kuotajkn" => 30,
    "sisakuotanonjkn" => 5,
    "kuotanonjkn" => 30,
    "keterangan" => "Peserta harap 30 menit lebih awal guna pencatatan administrasi."
];
echo json_encode($antreanService->antreanTambah($data), true);