Official Python SDK for MustikaPay Payment Gateway
Project description
MustikaPay Python SDK
Library Python resmi untuk MustikaPay Payment Gateway. Memudahkan Anda mengintegrasikan pembayaran QRIS, Virtual Account (VA), dan sistem Pencairan Saldo (Payout/Disbursement) ke dalam aplikasi Python Anda.
🚀 Fitur Utama
- ✅ Payment API: Buat & Cek Status QRIS dan Virtual Account.
- ✅ Payout API: Transfer Bank & Topup E-Wallet otomatis.
- ✅ Utility: Cek Saldo & Validasi Nama Rekening Tujuan.
- ✅ Type Hinting (Mypy Ready): Mendukung autocomplete penuh di IDE modern (VSCode / PyCharm).
- ✅ Custom Exceptions: Penanganan error yang spesifik dan rapi.
- ✅ Enums Built-in: Tidak perlu menebak kode bank atau e-wallet.
📦 Instalasi
Install melalui pip:
pip install mustikapay-sdk
🛠️ Penggunaan Cepat (Quick Start)
Inisialisasi Client
from mustikapay import MustikaPay
# Masukkan API Key yang didapat dari Dashboard MustikaPay
mp = MustikaPay(api_key="MP-xxxx-xxxx")
1. Membuat Pembayaran QRIS
try:
# Membuat QRIS sebesar Rp 10.000
qris = mp.create_qris(amount=10000)
print(f"Ref No: {qris['ref_no']}")
print(f"Link Bayar: {qris['payment_link']}")
except Exception as e:
print(f"Error: {e}")
2. Membuat Virtual Account (VA)
Dilengkapi dengan Enum agar Anda tidak salah memasukkan kode bank.
from mustikapay import MustikaPay, BankCode
mp = MustikaPay(api_key="MP-xxxx")
va = mp.create_va(
amount=50000,
bank_code=BankCode.BCA, # Menggunakan Enum BankCode (BCA: 014)
name="Budi Santoso",
phone="08123456789"
)
print(va)
3. Penarikan Saldo (Payout / Disbursement)
Penarikan saldo di MustikaPay memerlukan 2 langkah demi keamanan:
- Request OTP (akan dikirim ke Telegram/Email akun MustikaPay).
- Eksekusi Penarikan dengan kode OTP tersebut.
from mustikapay import MustikaPay, PayoutType, BankCode, EwalletCode
mp = MustikaPay(api_key="MP-xxxx")
# LANGKAH 1: Request OTP
# OTP akan dikirim ke kontak yang terdaftar
req_otp = mp.request_withdraw_otp(
tipe=PayoutType.EWALLET,
kode=EwalletCode.DANA,
rek="081234567890",
amount=50000
)
print(req_otp['message']) # "OTP telah dikirim ke Telegram Anda."
# LANGKAH 2: Eksekusi Penarikan (Setelah user menginput OTP)
kode_otp = input("Masukkan OTP: ")
wd_result = mp.withdraw(
tipe=PayoutType.EWALLET,
kode=EwalletCode.DANA,
rek="081234567890",
amount=50000,
otp=kode_otp
)
print("Berhasil ditarik:", wd_result)
4. Validasi Rekening / E-Wallet
Memastikan nomor rekening valid dan menampilkan nama pemilik sebelum melakukan transfer.
# Cek Nama Pemilik Rekening BCA
cek_rekening = mp.validate_account(
tipe=PayoutType.BANK,
kode=BankCode.BCA,
rek="1234567890"
)
print("Nama Pemilik:", cek_rekening['account_name'])
⚠️ Penanganan Error (Error Handling)
Library ini dilengkapi dengan Custom Exceptions agar Anda bisa menangani error dengan presisi:
from mustikapay import (
MustikaPay,
MustikaPayAuthError,
MustikaPayValidationError,
MustikaPayError
)
mp = MustikaPay(api_key="MP-SALAH-KEY")
try:
# Sengaja nominal kurang dari Rp 1000
qris = mp.create_qris(amount=500)
except MustikaPayValidationError as e:
print("Validasi Gagal:", e)
except MustikaPayAuthError as e:
print("API Key Salah/Ditolak:", e)
except MustikaPayError as e:
print("Error Umum MustikaPay:", e)
# Anda juga bisa melihat response mentah (raw JSON) dari server
print("Raw Response:", e.raw_response)
Referensi API
Untuk referensi API yang lebih lengkap, silakan kunjungi: 👉 Dokumentasi Resmi MustikaPay
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mustikapay_sdk-0.1.0.tar.gz.
File metadata
- Download URL: mustikapay_sdk-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd47e6c460d4479dbc80aa2b4efb234d8e67457c0d8520c6bbc8967cf729db0
|
|
| MD5 |
6e93c25dec5cf66c339a280936cce7b9
|
|
| BLAKE2b-256 |
e929d37347158481a129c8ac778b7f9a6513e99f1e850ce99b6f1883a7c96801
|
File details
Details for the file mustikapay_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mustikapay_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12e636a73bd4fd522bd4c6f5ed6a627c3ef5f2a10df8233a6e1d37ae191a7d27
|
|
| MD5 |
f5c6ddcd7db30b94937f3b5feec41290
|
|
| BLAKE2b-256 |
d1bf3b80c23707511c9239e65b87ab6e4f4f7a3217650a851892f170830c2d9f
|