Group API Guide

Selamat datang di halaman Dokumentasi Group API. Group API adalah akses API khusus yang diberikan kepada mitra tertentu untuk dapat mengintegrasikan member di platform milik mitra ke TriPay Payment secara otomatis.
Melalui Group API, mitra dapat mendaftarkan akun baru untuk member, membuat merchant untuk member, dan mengelola merchant serta transaksi member yang terdaftar dalam grup.

API ini hanya tersedia untuk Mitra tertentu yang telah bekerjasama. Apabila Anda membutuhkan akses ke fitur ini, silahkan ajukan kerjasama dengan cara menghubungi layanan pelanggan.

API ini digunakan untuk mendapatkan daftar user yang tergabung dalam grup

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/list
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
page Integer 1 TIDAK Nomor halaman
per_page Integer 50 TIDAK Jumlah data per halaman. Maks: 50
sort String asc TIDAK Sorting data.
asc : Terlama ke Terbaru
desc : Terbaru ke Terlama
id Integer 142 TIDAK Untuk melakukan pencarian berdasarkan id user
email String [email protected] TIDAK Untuk melakukan pencarian berdasarkan email user
username String TP0001 TIDAK Untuk melakukan pencarian berdasarkan username user
name String Nama User TIDAK Untuk melakukan pencarian berdasarkan nama user
<?php

$apiKey = 'api_key_grup_anda';

$payload = [
  'page'    => 1,
  'per_page'    => 25
];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/list?".http_build_query($payload),
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  payload = {
    "page": 1,
    "per_page": 25
  }

  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/list", params=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/list?page=1&per_page=25', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Success",
  "data": [
    {
      "id": 5,
      "username": "TP0005",
      "name": "Abdul",
      "email": "[email protected]",
      "phone": "082222222222"
    },
    {
      "id": 413,
      "username": "TP0413",
      "name": "Bayu",
      "email": "[email protected]",
      "phone": "081111111111"
    }
  ],
  "pagination": {
    "sort": "asc",
    "offset": {
      "from": 1,
      "to": 2
    },
      "current_page": 0,
      "previous_page": null,
      "next_page": 1,
      "last_page": 1,
      "total_records": 2
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendaftarkan user baru ke grup

Request

Method POST
URL https://payment.tripay.co.id/api-group/user/create
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
X-Hub-Signature 7d6f016c23d03b6... Tanda tangan digital yang dibuat dengan HMAC-SHA256 dari JSON payload
Parameter Tipe Contoh Nilai Wajib Keterangan
name String Nama User YA Nama akun
email String [email protected] YA Email akun
phone String 081111111111 YA Nomor HP akun
<?php

$apiKey = 'api_key_grup_anda';
$privateKey = 'private_key_grup_anda';

$payload = [
  'name' => 'Nama Pengguna',
  'email' => '[email protected]',
  'phone' => '081111111111'
];

$signature = hash_hmac('sha256', json_encode($payload), $privateKey);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/create",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey,
    "X-Hub-Signature: ".$signature
  ),
  CURLOPT_FAILONERROR       => false,
  CURLOPT_POST              => true,
  CURLOPT_POSTFIELDS        => http_build_query($payload)
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests
import hmac
import hashlib
import json

try:
  apiKey = "api_key_grup_anda"
  privateKey = "private_key_grup_anda"

  payload = {
    'name': 'Nama Pengguna',
    'email': '[email protected]',
    'phone': '081111111111'
  }

  signStr = "{}".format(json.dumps(payload, separators=(',', ':')))
  signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest()

  headers = {
    "Authorization": "Bearer " + apiKey,
    "X-Hub-Signature": signature
  }

  result = requests.post(url="https://payment.tripay.co.id/api-group/user/create", data=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";
var privateKey = "private_key_grup_anda";

var payload = {
  'name': 'Nama Pengguna',
  'email': '[email protected]',
  'phone': '081111111111'
};

var signature = crypto.createHmac('sha256', privateKey).update(JSON.stringify(payload)).digest('hex');

axios.post('https://payment.tripay.co.id/api-group/user/create', payload, {
  headers: {
    'Authorization': 'Bearer ' + apiKey,
    'X-Hub-Signature': signature
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "User created successfully",
  "data": {
    "id": 5,
    "username": "TP0005",
    "name": "Nama Pengguna",
    "email": "[email protected]",
    "phone": "081111111111"
  }
}
{
  "success": false,
  "message": "Email already registered"
}

API ini digunakan untuk mendapatkan detail user

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/detail
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
-
<?php

$apiKey = 'api_key_grup_anda';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/detail",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/detail", headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/detail', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "User found",
  "data": {
    "id": 5,
    "username": "TP0005",
    "name": "Abdul",
    "email": "[email protected]",
    "phone": "082222222222"
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk memperbarui detail user

Request

Method POST
URL https://payment.tripay.co.id/api-group/user/{user_id}/update
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
X-Hub-Signature 7d6f016c23d03b6... Tanda tangan digital yang dibuat dengan HMAC-SHA256 dari JSON payload
Parameter Tipe Contoh Nilai Wajib Keterangan
name String Nama Baru Pengguna TIDAK Ubah nama baru user
<?php

$apiKey = 'api_key_grup_anda';
$privateKey = 'private_key_grup_anda';

$payload = [
  'name' => 'Nama Baru Pengguna'
];

$signature = hash_hmac('sha256', json_encode($payload), $privateKey);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/update",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey,
    "X-Hub-Signature: ".$signature
  ),
  CURLOPT_FAILONERROR       => false,
  CURLOPT_POST              => true,
  CURLOPT_POSTFIELDS        => http_build_query($payload)
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests
import hmac
import hashlib
import json

try:
  apiKey = "api_key_grup_anda"
  privateKey = "private_key_grup_anda"

  payload = {
    "name": "Nama Baru Pengguna"
  }

  signStr = "{}".format(json.dumps(payload, separators=(',', ':')))
  signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest()

  headers = {
    "Authorization": "Bearer " + apiKey,
    "X-Hub-Signature": signature
  }

  result = requests.post(url="https://payment.tripay.co.id/api-group/user/5/update", data=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";
var privateKey = "private_key_grup_anda";

var payload = {
  "name": "Nama Baru Pengguna"
};

var signature = crypto.createHmac('sha256', privateKey).update(JSON.stringify(payload)).digest('hex');

axios.post('https://payment.tripay.co.id/api-group/user/5/update', payload, {
  headers: {
    'Authorization': 'Bearer ' + apiKey,
    'X-Hub-Signature': signature
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "User 5 has been updated"
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mengirim dokumen verifikasi akun user

Request

Method POST
URL https://payment.tripay.co.id/api-group/user/{user_id}/verification/submit
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Content-Type multipart/form-data
Parameter Tipe Contoh Nilai Wajib Keterangan
id_card File - YA File gambar KTP. Maks: 10MB (10240 KB)
selfie File - YA File gambar foto selfie dengan memegang KTP. Maks: 10MB (10240 KB)
photo File - YA File gambar foto selfie dengan memegang kertas bertuliskan "Verifikasi Akun TriPay (nomor_hp)". Maks: 10MB (10240 KB)"
<?php

$apiKey = 'api_key_grup_anda';

/**
* Reference: https://www.php.net/manual/en/curlfile.construct.php
**/

/**
* Sending local file
**/
$payload = [
  'id_card' => new \CURLFile("path/to/the/ktp.jpg", "image/jpeg"),
  'selfie' => new \CURLFile("path/to/the/selfie.jpg", "image/jpeg"),
  'photo' => new \CURLFile("path/to/the/photo.jpg", "image/jpeg")
];

/**
* Or sending from uploaded file ($_FILES)
**/
$payload = [
  'id_card' => new \CURLFile($_FILES['ktp']['tmp_name'], "image/jpeg"),
  'selfie' => new \CURLFile($_FILES['selfie']['tmp_name'], "image/jpeg"),
  'photo' => new \CURLFile($_FILES['photo']['tmp_name'], "image/jpeg"),
];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/verification/submit",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false,
  CURLOPT_POST              => true,
  CURLOPT_POSTFIELDS        => $payload
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

try:
  apiKey = "api_key_grup_anda"

  # Reference: https://requests.readthedocs.io/en/latest/user/quickstart/#post-a-multipart-encoded-file
  payload = {
    'id_card': ('ktp.jpg', open('path/to/the/ktp.jpg', 'rb'), 'image/jpeg', {'Expires': '0'}),
    'selfie': ('selfie.jpg', open('path/to/the/selfie.jpg', 'rb'), 'image/jpeg', {'Expires': '0'}),
    'photo': ('photo.jpg', open('path/to/the/photo.jpg', 'rb'), 'image/jpeg', {'Expires': '0'})
  }

  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.post(url="https://payment.tripay.co.id/api-group/user/5/verification/submit", files=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library
const fs = require("fs")

var apiKey = "api_key_grup_anda";

// Reference: https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData
var payload = new FormData();

// get file from the html form
var id_card = document.querySelector('#ktp').files[0];
var selfie = document.querySelector('#selfie').files[0];
var photo = document.querySelector('#photo').files[0];

// Or sending local file
var id_card = fs.createReadStream('/path/to/the/ktp.jpg');
var selfie = fs.createReadStream('/path/to/the/selfie.jpg');
var photo = fs.createReadStream('/path/to/the/photo.jpg');

payload.append('id_card', id_card);
payload.append('selfie', selfie);
payload.append('photo', photo);

axios.post('https://payment.tripay.co.id/api-group/user/5/verification/submit', payload, {
  headers: {
    'Authorization': 'Bearer ' + apiKey,
    'Content-Type': 'multipart/form-data'
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Verification document received. Please wait in 1x24 hours"
}
{
  "success": false,
  "message": "Gagal memproses id_card. Silahkan dicoba kembali"
}

API ini digunakan untuk mendapatkan status verifikasi akun user. Pada bagian respon, ada nilai status yang mungkin muncul. Diantaranya:

null : Dokumen verifikasi belum pernah dikirim
pending : Verifikasi sedang dalam proses
approved : Verifikasi akun disetujui
rejected : Verifikasi akun ditolak
canceled : Verifikasi akun dibatalkan

Untuk informasi tambahan seperti misalnya alasan penolakan atau alasan pembatalan verifikasi, akan tersedia pada parameter note

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/verification/status
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
-
<?php

$apiKey = 'api_key_grup_anda';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/verification/status",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/verification/status", headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/verification/status', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Verification approved.",
  "data": {
    "status": "approved", // possible values: null, pending, approved, rejected, canceled
    "note": "Aktivasi disetujui"
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan informasi tentang saldo akun user. Saldo terbagi menjadi 2 yakni:
available : Total saldo tersedia pada akun yang sudah dapat dicairkan
clearing : Total saldo yang masih dalam proses kliring

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/balance
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
-
<?php

$apiKey = 'api_key_grup_anda';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/balance",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/balance", headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/balance', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Success",
  "data": {
    "available": "150000000.00",
    "clearing": "5000000.00"
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan daftar transaksi user

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/transactions
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
page Integer 1 TIDAK Nomor halaman
per_page Integer 50 TIDAK Jumlah data per halaman. Maks: 50
sort String asc TIDAK Sorting data.
asc : Terlama ke Terbaru
desc : Terbaru ke Terlama
reference String T0001000000455HFGRY TIDAK Untuk melakukan pencarian berdasarkan nomor referensi transaksi
merchant_ref String INV57564 TIDAK Untuk melakukan pencarian berdasarkan nomor referensi/invoice merchant
method String BRIVA TIDAK Untuk melakukan pencarian berdasarkan kode channel pembayaran
status String PAID TIDAK Untuk melakukan pencarian berdasarkan status pembayaran
<?php

$apiKey = 'api_key_grup_anda';

$payload = [
  'page'    => 1,
  'per_page'    => 25
];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/transactions?".http_build_query($payload),
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  payload = {
    "page": 1,
    "per_page": 25
  }

  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/transactions", params=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/transactions?page=1&per_page=25', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Success",
  "data": [
      {
        "reference": "T015100000358440000",
        "merchant_id": 151,
        "merchant_code": "T0151",
        "merchant_name": "Nama Merchant",
        "merchant_ref": "INV123",
        "payment_selection_type": "static",
        "payment_method": "MYBVA",
        "payment_name": "Maybank Virtual Account",
        "customer_name": "Nama Customer",
        "customer_email": "[email protected]",
        "customer_phone": null,
        "callback_url": null,
        "return_url": null,
        "amount": 153750,
        "fee": 3750,
        "is_customer_fee": 1,
        "amount_received": 150000,
        "pay_code": 45649878666155,
        "pay_url": null,
        "checkout_url": "https://payment.tripay.co.id/checkout/T015100000358440000",
        "order_items": [
          {
            "sku": null,
            "name": "T-Shirt",
            "price": 150000,
            "quantity": 1,
            "subtotal": 150000
          }
        ],
        "status": "UNPAID",
        "note": null,
        "created_at": 1592381058,
        "expired_at": 1592388303,
        "paid_at": null
      }
    ],
  "pagination": {
    "sort": "asc",
    "offset": {
      "from": 1,
      "to": 1
    },
      "current_page": 1,
      "previous_page": null,
      "next_page": null,
      "last_page": 1,
      "total_records": 1
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan daftar merchant yang dimiliki user

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/list
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
page Integer 1 TIDAK Nomor halaman
per_page Integer 50 TIDAK Jumlah data per halaman. Maks: 50
sort String asc TIDAK Sorting data.
asc : Terlama ke Terbaru
desc : Terbaru ke Terlama
id Integer 142 TIDAK Untuk melakukan pencarian berdasarkan id merchant
code String T0001 TIDAK Untuk melakukan pencarian berdasarkan kode merchant
name String Nama Merchant TIDAK Untuk melakukan pencarian berdasarkan nama merchant
<?php

$apiKey = 'api_key_grup_anda';

$payload = [
  'page'    => 1,
  'per_page'    => 25
];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/list?".http_build_query($payload),
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  payload = {
    "page": 1,
    "per_page": 25
  }

  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/merchant/list", params=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/merchant/list?page=1&per_page=25', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Success",
  "data": [
    {
        "id": 123,
        "code": "T0123",
        "name": "Merchant 1",
        "website": "http://localhost",
        "callback_url": null,
        "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
        "sandbox": 1
    },
    {
        "id": 219,
        "code": "T0219",
        "name": "Merchant 2",
        "website": "http://localhost",
        "callback_url": null,
        "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
        "sandbox": 0
    }
  ],
  "pagination": {
    "sort": "asc",
    "offset": {
      "from": 1,
      "to": 2
    },
      "current_page": 1,
      "previous_page": null,
      "next_page": null,
      "last_page": 1,
      "total_records": 2
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk membuat merchant baru. Hanya user yang telah diverifikasi yang dapat membuat merchant, namun untuk user yang belum terverifikasi bisa menggunakan merchant sandbox.

Request

Method POST
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/create
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
X-Hub-Signature 7d6f016c23d03b6... Tanda tangan digital yang dibuat dengan HMAC-SHA256 dari JSON payload
Parameter Tipe Contoh Nilai Wajib Keterangan
name String Nama Merchant YA Nama merchant baru
website String:Url https://websitemerchant.com YA Alamat url website merchant
callback_url String:Url https://websitemerchant.com/callback-tripay TIDAK Alamat callback url default merchant
<?php

$apiKey = 'api_key_grup_anda';
$privateKey = 'private_key_grup_anda';

$payload = [
  'name' => 'Nama Merchant',
  'website' => 'https://websitemerchant.com',
  'callback_url' => 'https://websitemerchant.com/callback-tripay'
];

$signature = hash_hmac('sha256', json_encode($payload), $privateKey);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/create",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey,
    "X-Hub-Signature: ".$signature
  ),
  CURLOPT_FAILONERROR       => false,
  CURLOPT_POST              => true,
  CURLOPT_POSTFIELDS        => http_build_query($payload)
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests
import hmac
import hashlib
import json

try:
  apiKey = "api_key_grup_anda"
  privateKey = "private_key_grup_anda"

  payload = {
    'name': 'Nama Merchant',
    'website': 'https://websitemerchant.com',
    'callback_url': 'https://websitemerchant.com/callback-tripay'
  }

  signStr = "{}".format(json.dumps(payload, separators=(',', ':')))
  signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest()

  headers = {
    "Authorization": "Bearer " + apiKey,
    "X-Hub-Signature": signature
  }

  result = requests.post(url="https://payment.tripay.co.id/api-group/user/5/merchant/create", data=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";
var privateKey = "private_key_grup_anda";

var payload = {
  'name': 'Nama Merchant',
  'website': 'https://websitemerchant.com',
  'callback_url': 'https://websitemerchant.com/callback-tripay'
};

var signature = crypto.createHmac('sha256', privateKey).update(JSON.stringify(payload)).digest('hex');

axios.post('https://payment.tripay.co.id/api-group/user/5/merchant/create', payload, {
  headers: {
    'Authorization': 'Bearer ' + apiKey,
    'X-Hub-Signature': signature
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Merchant created successfully",
  "data": {
    "id": 123,
    "code": "T0123",
    "name": "Nama Merchant",
    "website": "https://websitemerchant.com",
    "callback_url": "https://websitemerchant.com/callback-tripay",
    "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
    "sandbox": 0
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan detail merchant

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/{merchant_id}/detail
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
-
<?php

$apiKey = 'api_key_grup_anda';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/123/detail",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/merchant/123/detail", headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/merchant/123/detail', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Merchant found",
  "data": {
    "id": 123,
    "code": "T0123",
    "name": "Nama Merchant",
    "website": "https://websitemerchant.com",
    "callback_url": "https://websitemerchant.com/callback-tripay",
    "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
    "sandbox": 0
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan detail merchant sandbox

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/sandbox
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
-
<?php

$apiKey = 'api_key_grup_anda';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/sandbox",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/merchant/sandbox", headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/merchant/sandbox', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Merchant found",
  "data": {
    "id": 126,
    "code": "T0126",
    "name": "Merchant Sandbox",
    "website": null,
    "callback_url": null,
    "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
    "sandbox": 1
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk memperbarui data merchant

Request

Method POST
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/{merchant_id}/update
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
X-Hub-Signature 7d6f016c23d03b6... Tanda tangan digital yang dibuat dengan HMAC-SHA256 dari JSON payload
Parameter Tipe Contoh Nilai Wajib Keterangan
name String Nama Merchant TIDAK Nama merchant baru
website String:Url https://websitemerchant.com TIDAK Alamat url website merchant baru
callback_url String:Url https://websitemerchant.com/callback-tripay TIDAK Alamat callback url default merchant baru
update_key Integer 1 TIDAK Generate ulang API Key & Private Key
<?php

$apiKey = 'api_key_grup_anda';
$privateKey = 'private_key_grup_anda';

$payload = [
  'update_key' => 1
];

$signature = hash_hmac('sha256', json_encode($payload), $privateKey);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/123/update",
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey,
    "X-Hub-Signature: ".$signature
  ),
  CURLOPT_FAILONERROR       => false,
  CURLOPT_POST              => true,
  CURLOPT_POSTFIELDS        => http_build_query($payload)
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests
import hmac
import hashlib
import json

try:
  apiKey = "api_key_grup_anda"
  privateKey = "private_key_grup_anda"

  payload = {
    'update_key': 1
  }

  signStr = "{}".format(json.dumps(payload, separators=(',', ':')))
  signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest()

  headers = {
    "Authorization": "Bearer " + apiKey,
    "X-Hub-Signature": signature
  }

  result = requests.post(url="https://payment.tripay.co.id/api-group/user/5/merchant/123/update", data=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";
var privateKey = "private_key_grup_anda";

var payload = {
  'update_key': 1
};

var signature = crypto.createHmac('sha256', privateKey).update(JSON.stringify(payload)).digest('hex');

axios.post('https://payment.tripay.co.id/api-group/user/5/merchant/123/update', payload, {
  headers: {
    'Authorization': 'Bearer ' + apiKey,
    'X-Hub-Signature': signature
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Merchant 123 has been updated",
  "data": {
    "id": 123,
    "code": "T0123",
    "name": "Nama Merchant Baru",
    "website": "https://websitemerchant.com",
    "callback_url": "https://websitemerchant.com/callback-tripay",
    "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "private_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
    "sandbox": 0
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}

API ini digunakan untuk mendapatkan daftar transaksi merchant

Request

Method GET
URL https://payment.tripay.co.id/api-group/user/{user_id}/merchant/{merchant_id}/transactions
Key Value Keterangan
Authorization Bearer {api_key} Ganti {api_key} dengan API Key grup Anda
Parameter Tipe Contoh Nilai Wajib Keterangan
page Integer 1 TIDAK Nomor halaman
per_page Integer 50 TIDAK Jumlah data per halaman. Maks: 50
sort String asc TIDAK Sorting data.
asc : Terlama ke Terbaru
desc : Terbaru ke Terlama
reference String T0001000000455HFGRY TIDAK Untuk melakukan pencarian berdasarkan nomor referensi transaksi
merchant_ref String INV57564 TIDAK Untuk melakukan pencarian berdasarkan nomor referensi/invoice merchant
method String BRIVA TIDAK Untuk melakukan pencarian berdasarkan kode channel pembayaran
status String PAID TIDAK Untuk melakukan pencarian berdasarkan status pembayaran
<?php

$apiKey = 'api_key_grup_anda';

$payload = [
  'page'    => 1,
  'per_page'    => 25
];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_FRESH_CONNECT     => true,
  CURLOPT_URL               => "https://payment.tripay.co.id/api-group/user/5/merchant/123/transactions?".http_build_query($payload),
  CURLOPT_RETURNTRANSFER    => true,
  CURLOPT_HEADER            => false,
  CURLOPT_HTTPHEADER        => array(
    "Authorization: Bearer ".$apiKey
  ),
  CURLOPT_FAILONERROR       => false
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

echo !empty($err) ? $err : $response;

?>
import requests

apiKey = "api_key_grup_anda"

try:
  payload = {
    "page": 1,
    "per_page": 25
  }

  headers = {
    "Authorization": "Bearer " + apiKey
  }

  result = requests.get(url="https://payment.tripay.co.id/api-group/user/5/merchant/123/transactions", params=payload, headers=headers)
  response = result.text
  print(response)
except Exception as e:
  print("Request Error: " + str(e))
const axios = require('axios') // using Axios library

var apiKey = "api_key_grup_anda";

axios.get('https://payment.tripay.co.id/api-group/user/5/merchant/123/transactions?page=1&per_page=25', {
  headers: {
    'Authorization': 'Bearer ' + apiKey
  }
})
.then((res) => {
  console.log(res)
})
.catch((error) => {
  console.error(error)
});

Response

{
  "success": true,
  "message": "Success",
  "data": [
      {
        "reference": "T015100000358440000",
        "merchant_ref": "INV123",
        "payment_selection_type": "static",
        "payment_method": "MYBVA",
        "payment_name": "Maybank Virtual Account",
        "customer_name": "Nama Customer",
        "customer_email": "[email protected]",
        "customer_phone": null,
        "callback_url": null,
        "return_url": null,
        "amount": 153750,
        "fee": 3750,
        "is_customer_fee": 1,
        "amount_received": 150000,
        "pay_code": 45649878666155,
        "pay_url": null,
        "checkout_url": "https://payment.tripay.co.id/checkout/T015100000358440000",
        "order_items": [
          {
            "sku": null,
            "name": "T-Shirt",
            "price": 150000,
            "quantity": 1,
            "subtotal": 150000
          }
        ],
        "status": "UNPAID",
        "note": null,
        "created_at": 1592381058,
        "expired_at": 1592388303,
        "paid_at": null
      }
    ],
  "pagination": {
    "sort": "asc",
    "offset": {
      "from": 1,
      "to": 1
    },
      "current_page": 1,
      "previous_page": null,
      "next_page": null,
      "last_page": 1,
      "total_records": 1
  }
}
{
  "success": false,
  "message": "Invalid API Key"
}