Package Python untuk generate QRIS dan cek status pembayaran dengan URL mutasi yang dapat dikonfigurasi
Project description
QRIS Payment Python Package
Package Python untuk generate QRIS dan cek status pembayaran dengan fitur monitoring realtime.
🚀 Fitur Terbaru (v1.2.0)
- ✅ Generate QRIS dengan nominal tertentu
- ✅ Tambah logo di tengah QR
- ✅ Cek status pembayaran realtime
- ✅ Filter waktu 10 menit (lebih fleksibel)
- ✅ Debug mode untuk monitoring detail
- ✅ Validasi format QRIS yang robust
- ✅ Perhitungan checksum CRC16
- ✅ Error handling yang informatif
- ✅ Type hints untuk development yang lebih baik
- 🆕 URL mutasi manual - Tidak lagi hardcoded, bisa disesuaikan
📦 Instalasi
pip install qris-payment==1.2.0
🔑 Cara Mendapatkan Auth Token
Untuk mendapatkan auth_username dan auth_token, hubungi bot Telegram:
@AutoFtBot - Bot resmi untuk mendapatkan kredensial QRIS Payment
Langkah-langkah:
- Buka Telegram dan cari @AutoFtBot
- Kirim pesan
/start - Ikuti instruksi untuk mendapatkan kredensial
- Bot akan memberikan
auth_usernamedanauth_token
🔄 Migrasi dari v1.1.x ke v1.2.0
BREAKING CHANGE: Versi 1.2.0 memerlukan konfigurasi mutasi_url manual.
Sebelum (v1.1.x):
config = {
'auth_username': 'YOUR_AUTH_USERNAME',
'auth_token': 'YOUR_AUTH_TOKEN',
'base_qr_string': 'YOUR_BASE_QR_STRING'
}
Sekarang (v1.2.0):
config = {
'auth_username': 'YOUR_AUTH_USERNAME',
'auth_token': 'YOUR_AUTH_TOKEN',
'mutasi_url': 'YOUR_MUTASI_API_URL', # WAJIB ditambahkan
'base_qr_string': 'YOUR_BASE_QR_STRING'
}
Catatan: Hubungi @AutoFtBot untuk mendapatkan URL mutasi yang sesuai dengan akun Anda.
🛠️ Penggunaan
Inisialisasi
from qris_payment import QRISPayment
config = {
'auth_username': 'YOUR_AUTH_USERNAME', # Dapat dari @AutoFtBot
'auth_token': 'YOUR_AUTH_TOKEN', # Dapat dari @AutoFtBot
'mutasi_url': 'YOUR_MUTASI_API_URL', # URL API mutasi (manual setting)
'base_qr_string': 'YOUR_BASE_QR_STRING',
'logo_path': 'path/to/logo.png' # Opsional
}
qris = QRISPayment(config)
Generate QRIS
def generate_qr():
try:
result = qris.generate_qr(10000)
# Simpan QR ke file
result['qr_image'].save('qr.png')
print('QR String:', result['qr_string'])
except Exception as e:
print(f"Error: {str(e)}")
Cek Status Pembayaran
def check_payment():
try:
# Reference tidak dipakai untuk pengecekan, hanya amount
result = qris.check_payment('REF123', 10000)
print('Status pembayaran:', result)
except Exception as e:
print(f"Error: {str(e)}")
Debug Mode
# Untuk monitoring detail proses pengecekan
from qris_payment.payment_checker import PaymentChecker
checker = PaymentChecker({
'auth_username': 'YOUR_AUTH_USERNAME',
'auth_token': 'YOUR_AUTH_TOKEN',
'mutasi_url': 'YOUR_MUTASI_API_URL'
}, debug=True)
result = checker.check_payment_status(None, 10000)
📋 Konfigurasi
| Parameter | Tipe | Deskripsi | Wajib |
|---|---|---|---|
| auth_username | string | Username dari @AutoFtBot | Ya |
| auth_token | string | Token dari @AutoFtBot | Ya |
| mutasi_url | string | URL API mutasi (manual setting) | Ya |
| base_qr_string | string | String dasar QRIS | Ya |
| logo_path | string | Path ke file logo (opsional) | Tidak |
📊 Response
Generate QR
{
'qr_string': "000201010212...", # String QRIS dengan checksum
'qr_image': <PIL.Image.Image> # Objek gambar QR
}
Cek Pembayaran
{
'success': True,
'data': {
'status': 'PAID' | 'UNPAID',
'amount': int,
'date': str, # Hanya jika status PAID
'brand_name': str, # Hanya jika status PAID
'buyer_reff': str # Hanya jika status PAID
}
}
⚡ Contoh Realtime Payment
import time
import random
from qris_payment import QRISPayment
config = {
'auth_username': 'YOUR_AUTH_USERNAME',
'auth_token': 'YOUR_AUTH_TOKEN',
'mutasi_url': 'YOUR_MUTASI_API_URL',
'base_qr_string': 'YOUR_BASE_QR_STRING',
'logo_path': './logo.png'
}
def realtime_payment_test():
qris = QRISPayment(config)
# Generate QR dengan nominal random
amount = 100 + random.randint(1, 99)
result = qris.generate_qr(amount)
result['qr_image'].save('qr.png')
print(f'Amount: {amount}')
print('QR saved as: qr.png')
print('Silakan scan dan transfer tepat Rp', amount)
# Monitor pembayaran (10 menit terakhir)
start_time = time.time()
while time.time() - start_time < 300: # 5 menit timeout
payment_result = qris.check_payment('REF', amount)
if payment_result['success'] and payment_result['data']['status'] == 'PAID':
print('🎉 Pembayaran berhasil!')
print('Detail:', payment_result['data'])
return
time.sleep(3)
print('Menunggu pembayaran...')
print('Timeout: Pembayaran tidak diterima')
if __name__ == '__main__':
realtime_payment_test()
🔍 Error Handling
Package ini akan melempar exception dengan pesan yang jelas:
- Format QRIS tidak valid - Pastikan base_qr_string mengandung "5802ID"
- Nominal harus > 0 - Amount harus positif
- Auth credentials tidak valid - Cek username dan token dari @AutoFtBot
- URL mutasi tidak valid - Pastikan mutasi_url sudah diisi dengan benar
- API tidak dapat diakses - Cek koneksi internet dan URL mutasi
- Response tidak valid - Ada masalah dengan server API
📝 Changelog
v1.2.0 (Latest)
- 🆕 URL mutasi manual - Tidak lagi hardcoded, sekarang bisa disesuaikan
- ✅ Konfigurasi
mutasi_urlwajib diisi manual - ✅ Lebih fleksibel untuk berbagai provider API
- ✅ Breaking change: Perlu tambah
mutasi_urldi config
v1.1.5
- ✅ Filter waktu diperpanjang dari 5 menit ke 10 menit
- ✅ Debug mode untuk monitoring detail
- ✅ Error handling yang lebih robust
- ✅ Type hints untuk development
- ✅ Dokumentasi yang lebih lengkap
v1.1.2
- Perbaikan bug minor
- Optimasi performa
v1.1.1
- Fitur QRIS generation
- Payment checking
🖥️ Persyaratan Sistem
- Python >= 3.6
- Dependencies:
- qrcode >= 7.4.2
- Pillow >= 9.0.0
- requests >= 2.28.0
📞 Support
- Bot Telegram: @AutoFtBot (untuk kredensial)
- Repository: GitHub
- Email: autoftbot@gmail.com
📄 Lisensi
MIT License
🤝 Kontribusi
Silakan buat pull request untuk kontribusi. Untuk perubahan besar, buka issue terlebih dahulu untuk mendiskusikan perubahan yang diinginkan.
Dibuat dengan ❤️ oleh AutoFtBot Team
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 qris_payment-1.2.0.tar.gz.
File metadata
- Download URL: qris_payment-1.2.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdb447b1db494a0a3ae8291fbb4198f40b5638980292c66b627c2756422e58f4
|
|
| MD5 |
8ec57a353351bb466b27f7c3e950343b
|
|
| BLAKE2b-256 |
9db63f99fcb8d78f0332fe0c434d85c133534f1cad435c9603762c7cccc35604
|
File details
Details for the file qris_payment-1.2.0-py3-none-any.whl.
File metadata
- Download URL: qris_payment-1.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a5cdc1f26536760d0ab280060df32afd56bab8c6fa36fd5d9fad2b0b4aaaff1
|
|
| MD5 |
679efbfacee203d11cad07b4184673ee
|
|
| BLAKE2b-256 |
206d63cda5975f3878177e1a2bfac3f769ecb40ad7dff2dcb7992c6dc52072ba
|