Untuk melakukan pengembangan/testing di local (XAMPP/LAMPP/Postman,dll), pengaturan IP Statis isi dengan IP publik jaringan yang saat ini Anda gunakan. Cek di https://www.whatismyip.com
$url = 'https://tripay.co.id/api/v2/pembelian/category/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses:
{
"success": true,
"data": [
{
"id: "1",
"product_name": "Pulsa All Operator",
"type": "PULSA",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
{
"id: "2",
"product_name": "Paket Data",
"type": "PULSA",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
{
"id: "3",
"product_name": "Voucher Game",
"type": "GAME",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
{
"id: "4",
"product_name": "Token Listrik",
"type": "PLN",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
{
"id: "5",
"product_name": "Saldo Ojek Online",
"type": "PULSA",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
]
}
$url = 'https://tripay.co.id/api/v2/pembelian/operator/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"id": 1,
"product_id": "AX",
"product_name": "AXIS",
"prefix": "0831,0832,0838",
"pembeliankategori_id": 1,
"status": 1,
},
{
"id": 2,
"product_id": "BO",
"product_name": "BOLT",
"prefix": "998,999",
"pembeliankategori_id": 1,
"status": 1,
},
{
"id": 3,
"product_id": "C",
"product_name": "CERIA",
"prefix": "0828",
"pembeliankategori_id": 1,
"status": 1,
},
{
"id": 4,
"product_id": "I",
"product_name": "INDOSAT",
"prefix": "0856,0857,0858,0815,0816,0855,0814",
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/pembelian/produk/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"id": 1,
"code": "AX5",
"pembelianoperator_id": 1,
"pembeliankategori_id": 1,
"product_name": "AXIS 5000",
"price": 5585,
"status": 1,
},
{
"id": 2,
"code": "AX10",
"pembelianoperator_id": 1,
"pembeliankategori_id": 1,
"product_name": "AXIS 10000",
"price": 10585,
"status": 1,
},
{
"id": 3,
"code": "AX25",
"pembelianoperator_id": 1,
"pembeliankategori_id": 1,
"product_name": "AXIS 25000",
"price": 24695,
"status": 1,
},
{
"id": 4,
"code": "AX30",
"pembelianoperator_id": 1,
"pembeliankategori_id": 1,
"product_name": "AXIS 30000",
"price": 29970,
"status": 1,
},
{
"id": 5,
"code": "AX50",
"pembelianoperator_id": 1,
"pembeliankategori_id": 1,
"product_name": "AXIS 50000",
"price": 49345,
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/pembelian/produk/cek';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'code' => 'AX5', // Kode Operator
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses
{
"success": true,
"data": [
{
"code": "AX5",
"product_name": "AXIS 5000",
"price": 5585,
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/pembayaran/category/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"id": "4",
"name": "Asuransi (BPJS)",
"status": "1" // 1 = Tersedia, 0 = Tidak Tersedia
},
{
"id": "5",
"name": "PPOB Tagihan",
"status": "1"
},
]
}
$url = 'https://tripay.co.id/api/v2/pembayaran/operator/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses
{
"status": true,
"data": [
{
"id": 1,
"product_name": "PPOB Multifinance",
"pembayarankategori_id": 4,
"status": 1,
},
{
"id": 2,
"product_name": "PPOB Tagihan",
"pembayarankategori_id": 5,
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/pembayaran/produk/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"id": 1,
"code": "ADIRA",
"product_name": "Adira Finance",
"biaya_admin": 3500,
"pembayaranoperator_id": "1",
"pembayarankategori_id": 4,
"status": 1,
},
{
"id": 1,
"code": "BAF",
"product_name": "Bussan Auto Finance",
"biaya_admin": 3000,
"pembayaranoperator_id": "1",
"pembayarankategori_id": 4,
"status": 1,
},
{
"id": 1,
"code": "WOM",
"product_name": "Wahana Ottomitra Multiartha",
"biaya_admin": 3000,
"pembayaranoperator_id": "1",
"pembayarankategori_id": 4,
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/pembayaran/produk/cek';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'code' => 'MAF', // Kode Operator
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"code": "MAF",
"product_name": "Mega Central Finance",
"biaya_admin": 3000,
"status": 1,
},
{
"code": "MAF",
"product_name": "Mega Auto Finance",
"biaya_admin": 3000,
"status": 1,
},
]
}
$url = 'https://tripay.co.id/api/v2/cekserver/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses
{
"success": true,
"message": "success cek server",
"data": "1", // 1 = LIVE | 0 = MAINTANCE
}
$url = 'https://tripay.co.id/api/v2/ceksaldo/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"message": "Saldo anda Rp. 2.150.492",
"data": "2150492",
}
$url = 'https://tripay.co.id/api/transaksi/transfer-saldo';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'no_tujuan' => '085800000xxx', // No penerima
'nominal' => '20000', // nomianl
'password' => '*******', // password pengirim
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"message": "Transfer Saldo Berhasil, Saldo penerima telah di tambahkan.",
"data": {
"penerima":"RUDI ARIYANTO",
"saldo_sebelum_transfer":1110434,
"saldo_setelah_transfer":1090434,
"tanggal_transfer":"05-07-2018 05:52:27",
},
}
$url = 'https://tripay.co.id/api/v2/transaksi/pembelian';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'inquiry' => 'I', // 'PLN' untuk pembelian PLN Prabayar, atau 'I' (i besar) untuk produk lainnya
'code' => 'IDH1', // kode produk
'phone' => '085800000000', // nohp pembeli
'no_meter_pln' => '1234567890', // khusus untuk pembelian token PLN prabayar
'api_trxid' => 'INV757', // ID transaksi dari server Anda. (tidak wajib, maks. 25 karakter)
'pin' => '3964', // pin member
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"trxid": 12312,
"api_trxid": "INV757",
"message":"Pembelian anda telah diantrikan."
}
$url = 'https://tripay.co.id/api/v2/pembayaran/cek-tagihan';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'product' => 'PLN', // Masukkan ID Produk (exp : PLN)
'phone' => '085800000864', // Masukkan No.hp Anda
'no_pelanggan' => '545646555565', // Masukkan ID Pelanggan (exp: no.meteran/ id pembayaran)
'api_trxid' => 'INV757', // ID transaksi dari server Anda. (tidak wajib, maks. 25 karakter)
'pin' => '2554', // Masukkan PIN user (anda)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": {
"id": 145,
"tagihan_id": 235142,
"product_name": "PLN",
"phone": "0858000*****",
"no_pelanggan": "5150904*****",
"nama": "SUTAR.",
"periode": "APR18",
"status": 0,
"expired": 1,
"jumlah_tagihan": 175490,
"biaya_admin": 3000,
"jumlah_bayar": 178490,
"api_trxid": "INV757"
}
}
$url = 'https://tripay.co.id/api/v2/transaksi/pembayaran';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'order_id' => '788965', // Masukkan ID yang didapat setelah melakukan pengecekan pembayaran
'api_trxid' => 'INV757', // Atau Anda bisa menggunakan ID transaksi dari server Anda (pilih salah satu)
'pin' => '2554', // Masukkan PIN user (anda)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"message":"Pembayaran Berhasil Diproses.",
"data": {
"id": 123,
"api_trxid": "INVXXX",
"order_id": 788965,
"code": "PLNPASCH",
"produk": "PLN Pasca Bayar",
"harga_default": "51430",
"harga_markup": "3000",
"total": "54430",
"target": "0857966*****",
"mtrpln": "5332102*****",
"note": "Pembayaran dalam proses",
"token": "",
"status": "0", // 0 = Proses, 1 = Sukses, 2 = Gagal, 3 = Refund
"saldo_before_trx": "461381",
"saldo_after_trx": "431781",
"created_at": "2018-03-18 21:18:09",
"updated_at": "2018-03-18 21:18:32"
}
}
$url = 'https://tripay.co.id/api/v2/histori/transaksi/all/';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"trxid": 20,
"api_trxid": "INVXXX",
"tagihan_id": "",
"code": "T10",
"produk": "THREE 10000",
"harga": 9990,
"target": "0895385987792",
"mtrpln": "-",
"note": "Transaksi success",
"token": "1029230852134******",
"status": 1,
"saldo_before_trx": 51186227,
"saldo_after_trx": 51176187,
"created_at": "2017-10-29 23:08:47",
"updated_at": "2018-01-08 14:40:28"
},
{
"trxid": 22,
"api_trxid": "INVXXX",
"tagihan_id": "",
"code": "T10",
"produk": "THREE 10000",
"harga": 9990,
"target": "0895385987792",
"mtrpln": "-",
"note": "Transaksi success",
"token": "1029230852134******",
"status": 1,
"saldo_before_trx": 51186227,
"saldo_after_trx": 51176187,
"created_at": "2017-10-29 23:08:47",
"updated_at": "2018-01-08 14:40:28"
},
]
}
$url = 'https://tripay.co.id/api/v2/histori/transaksi/bydate';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array( 'start_date' => '2018-03-05', // Start Date
'end_date' => '2018-03-15', // End Date
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": [
{
"trxid": 20,
"api_trxid": "INVXXX",
"tagihan_id": "",
"code": "T10",
"produk": "THREE 10000",
"harga": 9990,
"target": "0895385987792",
"mtrpln": "-",
"note": "Transaksi success",
"token": "1029230852134******",
"status": 1,
"saldo_before_trx": 51186227,
"saldo_after_trx": 51176187,
"created_at": "2017-10-29 23:08:47",
"updated_at": "2018-01-08 14:40:28"
},
{
"trxid": 22,
"api_trxid": "INVXXX",
"tagihan_id": "",
"code": "T10",
"produk": "THREE 10000",
"harga": 9990,
"target": "0895385987792",
"mtrpln": "-",
"note": "Transaksi success",
"token": "1029230852134******",
"status": 1,
"saldo_before_trx": 51186227,
"saldo_after_trx": 51176187,
"created_at": "2017-10-29 23:08:47",
"updated_at": "2018-01-08 14:40:28"
},
]
}
$url = 'https://tripay.co.id/api/v2/histori/transaksi/detail';
$header = array(
'Accept: application/json',
'Authorization: Bearer [apikey]', // Ganti [apikey] dengan API KEY Anda
);
$data = array(
'trxid' => '10305', // Masukkan Transaksi ID
'api_trxid' => 'INV757', // Atau Anda bisa menggunakan ID transaksi dari server Anda (pilih salah satu)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
Contoh Response Sukses :
{
"success": true,
"data": {
"trxid": 2554,
"api_trxid": "INVXXX",
"code": "IDPH2",
"produk": "Unlimited + 2GB - Promo (Ratu)",
"harga": "29450",
"target": "0857966*****",
"mtrpln": "-",
"note": "Trx Unlimited + 2GB - Promo (Ratu) 0857966***** Sukses. Transaksi Berhasil SN : 011728000047918*****",
"token": "011728000047918*****",
"status": "1", // 0 = Proses, 1 = Sukses, 2 = Gagal, 3 = Refund
"saldo_before_trx": "461381",
"saldo_after_trx": "431781",
"created_at": "2018-03-18 21:18:09",
"updated_at": "2018-03-18 21:18:32"
}
}
[
{
"trxid": "158561****",
"api_trxid": "INV77769",
"via": "API",
"code": "PLNPASCH",
"produk": "PLN Pasca Bayar",
"harga": "22592",
"target": "08522083****",
"mtrpln": "53527502****",
"note": "Pembayaran Tagihan BERHASIL",
"token": "0BMS210Z40B3D237B67396140C****",
"status": "1",
"saldo_before_trx": "68486",
"saldo_after_trx": "45894",
"created_at": "2019-11-06 12:07:48",
"updated_at": "2019-11-15 20:59:10",
"tagihan": {
"id": "158561****",
"nama": "SAMSURI",
"periode": "201911",
"jumlah_tagihan": "21892",
"admin": "700",
"jumlah_bayar": "22592"
}
},
{
"trxid": "158561****",
"api_trxid": "INV45769",
"via": "API",
"code": "S100",
"produk": "Telkomsel 100",
"harga": "97765",
"target": "08522083****",
"mtrpln": "-",
"note": "Trx S100 08522083**** SUKSES. SN: 845392759476503****",
"token": "845392759476503****",
"status": "1",
"saldo_before_trx": "100000",
"saldo_after_trx": "5894",
"created_at": "2019-11-06 12:07:48",
"updated_at": "2019-11-15 20:59:10",
"tagihan": null
}
]
// PHP NATIVE
$secret = 'inisecret';
$incomingSecret = isset($_SERVER['HTTP_X_CALLBACK_SECRET']) ? $_SERVER['HTTP_X_CALLBACK_SECRET'] : '';
if( !hash_equals($secret, $incomingSecret) ) {
exit("Invalid secret");
}
$json = file_get_contents("php://input");
file_put_contents(__DIR__.'/callback-tripay.txt', $json.PHP_EOL.PHP_EOL, FILE_APPEND | LOCK_EX);
// LARAVEL
public function handleCallback(\Illuminate\Http\Request $request)
{
$secret = 'inisecret';
$incomingSecret = $request->server('HTTP_X_CALLBACK_SECRET') ?: '';
if( !hash_equals($secret, $incomingSecret) ) {
\Log::error("Invalid Secret: " . $secret ." vs ".$incomingSecret);
return;
}
$json = $request->getContent();
\Log::info($json);
}