Mutasibank API memungkinkan Anda untuk melakukan integrasi mutasibank.co.id dengan sistem Anda. API ini dibangun berdasarkan REST API dengan format response data dalam bentuk JSON.
Helper.php- β Complete API wrapper class (MutasibankAPI)example_usage.php- Contoh lengkap penggunaan APIapi.php- Legacy API example
webhook_with_signature.php- β PHP webhook handler (RECOMMENDED)webhook_nodejs.js- β Node.js/Express webhook handlerwebhook_python.py- β Python/Flask webhook handlercallback.php- Legacy webhook (tanpa signature - NOT RECOMMENDED)
<?php
require_once 'Helper.php';
// Initialize API with your token
$api = new MutasibankAPI('YOUR_API_TOKEN_HERE');
// Get your accounts
$accounts = $api->getAccounts();
print_r($accounts);
// Get transactions
$statements = $api->getStatements(
$accountId = 1,
$dateFrom = '2025-01-01',
$dateTo = '2025-01-31'
);
// Match transaction
$match = $api->matchTransaction($accountId = 1, $amount = 100000);
// More examples in example_usage.php
?>User & Auth:
getUser()- Get current user info
Bank Operations:
getListBank()- List supported banks
Account Operations:
getAccounts()- List all accountsgetAccount($id)- Get account detailscreateAccount($data)- Create new accountupdateAccount($id, $data)- Update accountdeleteAccount($id)- Delete accounttoggleAccountStatus($id, $status)- Enable/disable accountinputToken($id, $token1, $token2)- Input BCA tokenrerunCheck($id)- Manually trigger botgetLogBot($id)- Get bot activity logs
Transaction Operations:
getStatements($id, $from, $to)- Get transactionsmatchTransaction($id, $amount)- Find transaction by amountmatchTransactions($id, $amount)- Find all matching transactionsvalidateTransaction($txId)- Validate transaction by ID
Category Operations:
getCategories()- List categoriesgetCategory($id)- Get category detailscreateCategory($name, $type, $desc)- Create categoryupdateCategory($id, $data)- Update categorydeleteCategory($id)- Delete category
Webhook Operations:
getWebhooks()- List webhooksgetWebhook($id)- Get webhook detailscreateWebhook($url, $accountId, $desc)- Create webhookupdateWebhook($id, $data)- Update webhookdeleteWebhook($id)- Delete webhook
Billing:
topupKredit($amount, $paymentId)- Create topup transaction
Sejak 2025, semua webhook dari Mutasibank dilengkapi dengan HMAC-SHA256 signature untuk keamanan.
- β Tanpa verifikasi: Siapa saja bisa kirim fake webhook β fraud!
- β Dengan verifikasi: Hanya webhook asli dari Mutasibank yang diterima
1. Dapatkan Webhook Secret
- Login ke dashboard Mutasibank
- Buka Pengaturan β Webhook
- Copy Webhook Secret (64 karakter)
2. Pilih Contoh Sesuai Bahasa Anda
- PHP β
webhook_with_signature.php - Node.js β
webhook_nodejs.js - Python β
webhook_python.py
3. Set Environment Variables
# .env atau environment variables
WEBHOOK_SECRET=your_64_char_secret_from_dashboard
API_TOKEN=your_api_token_from_dashboard4. Deploy & Test
- Upload ke server Anda
- Daftarkan URL webhook di dashboard
- Test dengan trigger transaksi
Setiap webhook dari Mutasibank menyertakan headers berikut:
| Header | Deskripsi |
|---|---|
X-Mutasibank-Signature |
HMAC-SHA256 signature (64 chars hex) |
X-Mutasibank-Timestamp |
Unix timestamp (untuk prevent replay attack) |
X-Mutasibank-Webhook-Id |
Unique UUID untuk webhook ini |
Content-Type |
application/json |
User-Agent |
Mutasibank-Webhook/1.0 |
# 1. Copy file
cp webhook_with_signature.php /path/to/your/webserver/
# 2. Edit konfigurasi
nano webhook_with_signature.php
# Update: WEBHOOK_SECRET dan API_TOKEN
# 3. Set URL di dashboard Mutasibank
# https://yoursite.com/webhook_with_signature.php# 1. Install dependencies
npm init -y
npm install express
# 2. Set environment variables
export WEBHOOK_SECRET="your_secret"
export API_TOKEN="your_token"
# 3. Run server
node webhook_nodejs.js
# 4. Set URL di dashboard
# https://yoursite.com/webhook/mutasibank# 1. Install dependencies
pip install flask
# 2. Set environment variables
export WEBHOOK_SECRET="your_secret"
export API_TOKEN="your_token"
# 3. Run server
python webhook_python.py
# 4. Set URL di dashboard
# https://yoursite.com/webhook/mutasibank# PHP
php -S localhost:8000
# Akses: http://localhost:8000/webhook_with_signature.php
# Node.js
node webhook_nodejs.js
# Akses: http://localhost:3000/webhook/mutasibank
# Python
python webhook_python.py
# Akses: http://localhost:3000/webhook/mutasibank# Generate signature untuk testing
SECRET="your_webhook_secret"
TIMESTAMP=$(date +%s)
PAYLOAD='{"api_key":"test","account_id":1,"data_mutasi":[]}'
SIGNATURE=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET" | cut -d' ' -f2)
# Send test webhook
curl -X POST http://localhost:8000/webhook_with_signature.php \
-H "Content-Type: application/json" \
-H "X-Mutasibank-Signature: $SIGNATURE" \
-H "X-Mutasibank-Timestamp: $TIMESTAMP" \
-H "X-Mutasibank-Webhook-Id: test-123" \
-d "$PAYLOAD"{
"api_key": "your_api_token",
"account_id": 123,
"module": "bca",
"account_name": "PT Example",
"account_number": "1234567890",
"balance": 5000000,
"data_mutasi": [
{
"id": "uuid-transaction-id",
"transaction_date": "2025-01-10 14:30:00",
"description": "TRANSFER FROM JOHN DOE ORDER-12345",
"type": "CR",
"amount": 100000,
"balance": 5000000
}
]
}type:CR= Credit (uang masuk),DB= Debit (uang keluar)amount: Nominal transaksibalance: Saldo setelah transaksidescription: Keterangan dari bank (bisa extract order ID dari sini)
- β Selalu verifikasi signature - Jangan skip!
- β Check timestamp - Prevent replay attacks
- β Gunakan HTTPS - URL webhook HARUS https://
- β Simpan secret di environment - Jangan hardcode
- β Log webhook ID - Untuk debugging
- β
Gunakan constant-time comparison -
hash_equals(),crypto.timingSafeEqual()
- β Jangan pakai HTTP - Harus HTTPS
- β Jangan skip signature verification - Risiko fraud
- β Jangan log webhook secret - Keep it confidential
- β Jangan pakai
==untuk compare signature - Vulnerable to timing attacks - β Jangan commit secret ke git - Use environment variables
Kemungkinan penyebab:
- Webhook secret salah β Cek di dashboard
- Pakai
$_POSTbukan raw payload β Gunakanfile_get_contents('php://input') - Pakai
==bukanhash_equals()β Gunakan constant-time comparison
Solusi:
- Sync waktu server dengan NTP
- Tingkatkan
TIMESTAMP_TOLERANCEjadi 600 (10 menit)
Check:
- URL webhook di dashboard benar?
- URL publicly accessible (bukan localhost)?
- SSL certificate valid?
- Firewall tidak block IP Mutasibank?
Dokumentasi Lengkap: https://mutasibank.co.id/api/docs
Butuh Bantuan?
- Email: support@mutasibank.co.id
- WhatsApp: +62856 120 5976
- Website: https://mutasibank.co.id
2025-01-10:
- β Added webhook signature verification examples
- β Added Node.js and Python examples
- β Updated security best practices
2018:
- Initial release with basic API examples
β‘ Start dengan file webhook_with_signature.php untuk implementasi paling aman!