BRIVA

API ini membuat Anda dapat menggunakan layanan virtual account BRI (BRIVA).

Create

Endpoint ini digunakan untuk membuat virtual account BRI baru.

curl -X POST 'https://sandbox.partner.api.bri.co.id/v1/briva' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115",
    "nama": "Sabrina",
    "amount": "100000",
    "keterangan": "Testing BRIVA",
    "expiredDate": "2020-02-27 23:59:00"
}'

Contoh request

<?php
/* Generate Token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
    
    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];

    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=$payload";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";
    $nama = "Sabrina";
    $amount="100000";
    $keterangan="Testing BRIVA";
    $expiredDate="2020-02-27 23:59:00";

    $datas = array(
        'institutionCode' => $institutionCode ,
        'brivaNo' => $brivaNo,
        'custCode' => $custCode,
        'nama' => $nama,
        'amount' => $amount,
        'keterangan' => $keterangan,
        'expiredDate' => $expiredDate
    );

    $payload = json_encode($datas, true);
    $path = "/v1/briva";
    $verb = "POST";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Content-Type:"."application/json",
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva";
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "POST"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);

    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": {
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115",
    "nama": "Sabrina",
    "amount": "100000",
    "keterangan": "BRIVA Testing",
    "expiredDate": "2019-02-27 23:59:00"
  }
}

HTTP Request

POST https://sandbox.partner.api.bri.co.id/v1/briva

Query Parameters

Key Value Mandatory
Content-Type application/json Yes

Request Body

Field Data Type Max Char Mandatory Description
institutionCode String   Yes This institution code will be given by BRI
brivaNo Numeric 5 Yes BRIVA number unique to your institution
custCode String 13 Yes Customer code generated by you, we recommend to use only 10 digits to enable pay BRIVA from another bank since the other 3 digits are needed for bank code
nama String 40 Yes Customer name for that BRIVA account number
amount Numeric   Yes Amount for that BRIVA account
keterangan String   Yes  
expiredDate DateTime   Yes Expiration date for that BRIVA account, format: yyyy-MM-dd HH:mm:ss
Note : Expired Date is currently not actively used, so if the briva that has been created has exceeded the expired date and has not been deleted, then the briva number can still be paid

Get

Endpoint ini digunakan untuk mendapatkan informasi virtual account yang telah dibuat.

curl -X GET 'https://sandbox.partner.api.bri.co.id/v1/briva/J104408/77777/123456789001' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}'

Contoh request

<?php
/* Generate Token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";

    $payload = null;
    $path = "/v1/briva/".$institutionCode."/".$brivaNo."/".$custCode;
    $verb = "GET";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva/".$institutionCode."/".$brivaNo."/".$custCode;
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "GET"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);
    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": {
    "BrivaNo": "77777",
    "CustCode": "123456789115",
    "Nama": "Sabrina",
    "Keterangan": "BRIVA Testing",
    "Amount": "100000",
    "statusBayar": "N",
    "expiredDate": null,
    "lastUpdate": null
  }
}

HTTP Request

GET https://sandbox.partner.api.bri.co.id/v1/briva/{{INSTITUTION_CODE}}/{{BRIVA_NO}}/{{CUSTOMER_CODE}}

URL Parameters

Field Data Type Max Char Mandatory Description
INSTITUTION_CODE String   Yes This institution code will be given by BRI
BRIVA_NO Numeric 5 Yes Briva number unique to your institution
CUSTOMER_CODE String 13 Yes Customer code

Get Status

Semua akun BRIVA memiliki statusBayar atau status pembayaran. Endpoint ini digunakan untuk mendapatkan status pembayaran dari akun BRIVA yang ada.

curl -X GET 'https://sandbox.partner.api.bri.co.id/v1/briva/status/J104408/77777/123456789001' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}'

Contoh request

<?php
/* Generate token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";

    $payload = null;
    $path = "/v1/briva/status/".$institutionCode."/".$brivaNo."/".$custCode;
    $verb = "GET";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva/status/".$institutionCode."/".$brivaNo."/".$custCode;
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "GET"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);
    
    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh respon:

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": {
    "statusBayar": "N"
  }
}

HTTP Request

GET https://sandbox.partner.api.bri.co.id/v1/briva/status/{{INSTITUTION_CODE}}/{{BRIVA_NO}}/{{CUSTOMER_CODE}}

URL Parameters

Field Data Type Max Char Mandatory Description
INSTITUTION_CODE String   Yes This institution code will be given by BRI
BRIVA_NO Numeric 5 Yes BRIVA number unique to your institution
CUSTOMER_CODE String 13 Yes Customer code

Update Status

Endpoint ini digunakan untuk mengelola status pembayaran dari akun BRIVA yang ada

curl -X PUT 'https://sandbox.partner.api.bri.co.id/v1/briva/status' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115",
    "statusBayar": "Y"
}'

Contoh request

<?php
/* Generate token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=$payload";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{COnsumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    //generate token
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";
    $statusBayar = "Y";

    $datas = array(
        'institutionCode' => $institutionCode ,
        'brivaNo' => $brivaNo,
        'custCode' => $custCode,
        'statusBayar'=> $statusBayar
    );

    $payload = json_encode($datas, true);
    $path = "/v1/briva/status";
    $verb = "PUT";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Content-Type:"."application/json",
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva/status";
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "PUT"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);

    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);

}

BrivaUpdate();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": {
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115",
    "statusBayar": "Y"
  }
}

HTTP Request

PUT https://sandbox.partner.api.bri.co.id/v1/briva/status

Request Header

Key Value Mandatory
Content-Type application/json Yes

Request Body

Field Data Type Max Char Mandatory Description
institutionCode String   Yes This institution code will be given by BRI
brivaNo Numeric 5 Yes BRIVA number unique to your institution
custCode String 13 Yes Customer code
statusBayar string T Payment status, Y means it is already paid and N means it is not already paid  

Update

Endpoint ini digunakan untuk memperbarui detail akun BRIVA yang ada.

curl -X PUT 'https://sandbox.partner.api.bri.co.id/v1/briva' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115",
    "nama": "Brigita",
    "amount": "1000000",
    "keterangan": "BRIVA Testing",
    "expiredDate": "2020-03-10 23:59:00"
}'

Contoh request

<?php
/* Generate token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=$payload";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";
    $nama = "Brigita";
    $amount = "1000000";
    $keterangan = "BRIVA Testing";
    $expiredDate = "2020-03-10 23:59:00";

    $datas = array(
        'institutionCode' => $institutionCode ,
        'brivaNo' => $brivaNo,
        'custCode' => $custCode,
        'nama' => $nama,
        'amount' => $amount,
        'keterangan' => $keterangan,
        'expiredDate' => $expiredDate
    );

    $payload = json_encode($datas, true);
    $path = "/v1/briva";
    $verb = "PUT";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Content-Type:"."application/json",
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva";
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "PUT"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);

    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh response

  {
    "status": true,
    "responseDescription": "Success",
    "responseCode": "00",
    "data": {
        "institutionCode": "J104408",
        "brivaNo": "77777",
        "custCode": "123456789115",
        "nama": "Brigita",
        "amount": "1000000",
        "keterangan": "BRIVA Testing",
        "expiredDate": "2020-03-10 23:59:00"
    }
  }

HTTP Request

PUT https://sandbox.partner.api.bri.co.id/v1/briva

Request Header

Key Value Mandatory
Content-Type application/json Yes

Request Body

Field Data Type Max Char Mandatory Description
institutionCode String   Yes This institution code will be given by BRI
brivaNo Numeric 5 Yes BRIVA number unique to your institution
custCode String 13 Yes Customer code
nama String 40 Yes Customer name for that BRIVA account number
amount Numeric   Yes Amount for that BRIVA account
keterangan String   Yes  
expiredDate DateTime   Yes Expiration date for that BRIVA account, format: yyyy-MM-dd HH:mm:ss

Delete

Endpoint ini digunakan untuk menghapus akun BRIVA yang ada

curl -X DELETE 'https://sandbox.partner.api.bri.co.id/v1/briva' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}' \
  -d 'institutionCode=J104408&brivaNo=77777&custCode=123456789115'

Contoh request

<?php
/* Generate token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=$payload";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaPayment() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consymer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $custCode = "123456789115";

    $datas = array(
        'institutionCode' => $institutionCode ,
        'brivaNo' => $brivaNo,
        'custCode' => $custCode
    );

    $payload = "institutionCode=".$institutionCode."&brivaNo=".$brivaNo."&custCode=".$custCode;
    $path = "/v1/briva";
    $verb = "DELETE";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva";
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);
    
    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaPayment();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": {
    "institutionCode": "J104408",
    "brivaNo": "77777",
    "custCode": "123456789115"
  }
}

HTTP Request

DELETE https://sandbox.partner.api.bri.co.id/v1/briva

Request Body

Field Data Type Max Char Mandatory Description
institutionCode String   Yes This institution code will be given by BRI
brivaNo Numeric 5 Yes BRIVA number unique to your institution
custCode String 13 Yes Customer code

Get Report

Endpoint ini digunakan untuk mendapatkan riwayat transaksi semua akun BRIVA yang terdaftar pada nomor BRIVA Anda.

curl -X GET 'https://sandbox.partner.api.bri.co.id/v1/briva/report/J104408/77777/20190510/20190510' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}'

Contoh request

<?php
/* Generate Token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $startDate = "20190510";
    $endDate = "20190510";

    $payload = null;
    $path = "/v1/briva/report/".$institutionCode."/".$brivaNo."/".$startDate."/".$endDate;
    $verb = "GET";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva/report/".$institutionCode."/".$brivaNo."/".$startDate."/".$endDate;
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "GET"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);

    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;
    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": [
    {
        "brivaNo": "77777",
        "custCode": "006224217245",
        "nama": "AULIA RIFQA PRATIWI",
        "keterangan": "",
        "amount": "5000000.00",
        "paymentDate": "2019-05-10 10:05:52.000",
        "tellerid": "8879965",
        "no_rek": "39101000322990"
    },
    {
        "brivaNo": "77777",
        "custCode": "5042301900012",
        "nama": "SUMARI",
        "keterangan": "",
        "amount": "160000.00",
        "paymentDate": "2019-05-10 10:05:31.000",
        "tellerid": "1104447",
        "no_rek": "39101000322990"
    }
  ]
}

HTTP Request

GET https://sandbox.partner.api.bri.co.id/v1/briva/report/{{INSTITUTION_CODE}}/{{BRIVA_NO}}/{{START_DATE}}/{{END_DATE}}

URL Parameters

Field Data Type Max Char Mandatory Description
INSTITUTION_CODE String   Yes This institution code will be given by BRI
BRIVA_NO Numeric 5 Yes BRIVA number unique to your institution
START_DATE Date 8 Yes Start date, format: yyyyMMdd
END_DATE Date 8 Yes End date, format: yyyyMMdd

Get Report Time

Endpoint ini digunakan untuk mendapatkan riwayat transaksi akun BRIVA yang teregistrasi berdasarkan waktu pada nomor BRIVA Anda.

curl -X GET 'https://sandbox.partner.api.bri.co.id/v1/briva/report_time/J104408/77777/2019-05-10/10:30/2019-05-10/10:30' \
  -H 'Authorization: Bearer {{TOKEN}}' \
  -H 'BRI-Signature: {{SIGNATURE}}' \
  -H 'BRI-Timestamp: {{TIMESTAMP}}'

Contoh request

<?php
/* Generate Token */
function BRIVAgenerateToken($client_id, $secret_id) {
    $url ="https://sandbox.partner.api.bri.co.id/oauth/client_credential/accesstoken?grant_type=client_credentials";
    $data = "client_id=".$client_id."&client_secret=".$secret_id;
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  //for updating we have to use PUT method.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $json = json_decode($result, true);
    $accesstoken = $json['access_token'];
    return $accesstoken;
}

/* Generate signature */
function BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret) {
    echo $payloads = "path=$path&verb=$verb&token=Bearer $token&timestamp=$timestamp&body=";
    $signPayload = hash_hmac('sha256', $payloads, $secret, true);
    return base64_encode($signPayload);
}

function BrivaUpdate() {
    $client_id = '{{Consumer id}}';
    $secret_id = '{{Consumer secret}}';
    $timestamp = gmdate("Y-m-d\TH:i:s.000\Z");
    $secret = $secret_id;
    $token = BRIVAgenerateToken($client_id, $secret_id);

    $institutionCode = "J104408";
    $brivaNo = "77777";
    $startDate = "2019-05-10";
    $endDate = "2019-05-10";
    $startTime = "10:30";
    $endTime = "12:30";

    $payload = null;
    $path = "/v1/briva/report_time/".$institutionCode."/".$brivaNo."/".$startDate."/".$startTime."/".$endDate."/".$endTime;
    $verb = "GET";
    $base64sign = BRIVAgenerateSignature($path, $verb, $token, $timestamp, $payload, $secret);

    $request_headers = array(
        "Authorization:Bearer " . $token,
        "BRI-Timestamp:" . $timestamp,
        "BRI-Signature:" . $base64sign,
    );

    $urlPost ="https://sandbox.partner.api.bri.co.id/v1/briva/report_time/".$institutionCode."/".$brivaNo."/".$startDate."/".$startTime."/".$endDate."/".$endTime;
    $chPost = curl_init();
    curl_setopt($chPost, CURLOPT_URL, $urlPost);
    curl_setopt($chPost, CURLOPT_HTTPHEADER, $request_headers);
    curl_setopt($chPost, CURLOPT_CUSTOMREQUEST, "GET"); 
    curl_setopt($chPost, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($chPost, CURLINFO_HEADER_OUT, true);
    curl_setopt($chPost, CURLOPT_RETURNTRANSFER, true);

    $resultPost = curl_exec($chPost);
    $httpCodePost = curl_getinfo($chPost, CURLINFO_HTTP_CODE);
    curl_close($chPost);

    echo "<br/> <br/>";
    echo "Response Post : ".$resultPost;

    return json_decode($resultPost, true);
}

BrivaUpdate();

Contoh response

{
  "status": true,
  "responseDescription": "Success",
  "responseCode": "00",
  "data": [
    {
        "brivaNo": "77777",
        "custCode": "006224217245",
        "nama": "AULIA RIFQA PRATIWI",
        "keterangan": "",
        "amount": "5000000.00",
        "paymentDate": "2019-05-10 10:05:52.000",
        "tellerid": "8879965",
        "no_rek": "39101000322990"
    },
    {
        "brivaNo": "77777",
        "custCode": "5042301900012",
        "nama": "SUMARI",
        "keterangan": "",
        "amount": "160000.00",
        "paymentDate": "2019-05-10 10:05:31.000",
        "tellerid": "1104447",
        "no_rek": "39101000322990"
    }
  ]
}

HTTP Request

GET https://sandbox.partner.api.bri.co.id/v1/briva/report_time/{{INSTITUTION_CODE}}/{{BRIVA_NO}}/{{START_DATE}}/{{START_TIME}}/{{END_DATE}}/{{END_TIME}}

URL Parameters

Field Data Type Max Char Mandatory Description
INSTITUTION_CODE String   Yes This institution code will be given by BRI
BRIVA_NO Numeric 5 Yes BRIVA number unique to your institution
START_DATE Date 8 Yes Start date, format: yyyy-MM-dd
START_TIME Date 4 Yes Start date, format: HH:MM
END_DATE Date 8 Yes End date, format: yyyy-MM-dd
END_TIME Date 4 Yes End date, format: HH:MM

Payment Simulation

Simulasi ini digunakan untuk mensimulasikan pembayaran untuk BRIVA. Pertama, Anda harus memeriksa nomor BRIVA tersebut sudah dibayar atau belum. Kemudian masukkan kode korporasi dan kode pelanggan. Kemudian klik tombol “Check”. Ini akan menampilkan data Nama Nasabah, Status Pembayaran, Jumlah Pembayaran. Masukkan nilai yang harus dibayar dan pilih kanal pembayaran. Pembayaran akan sukses jika nilai yang dibayarkan setara dengan nilai BRIVA dan status pembayaran belum dibayarkan.

Error Codes

Code Code Description
01 Nomor Briva tidak boleh kosong
02 Customer Code tidak boleh kosong
03 Institution Code tidak boleh kosong
05 Institution Code tidak diijinkan mengakses nomor Briva
10 Nama tidak boleh kosong
11 Amount tidak boleh kosong
13 Data customer sudah ada
14 Data customer tidak ditemukan
15 Gagal menyimpan data Customer
16 Gagal update data Briva
17 Gagal delete data Briva
20 Gagal update status bayar
21 Gagal mendapatkan data status bayar
30 Gagal mendapatkan data Briva
40 Gagal memproses request report Briva
99 General Error