Skip to main content

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:

  1. Buka Telegram dan cari @AutoFtBot
  2. Kirim pesan /start
  3. Ikuti instruksi untuk mendapatkan kredensial
  4. Bot akan memberikan auth_username dan auth_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_url wajib diisi manual
  • ✅ Lebih fleksibel untuk berbagai provider API
  • ✅ Breaking change: Perlu tambah mutasi_url di 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

📄 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

Metadata

Release files for qris-payment 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qris-payment 1.2.0
File Size Uploaded
qris_payment-1.2.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qris-payment 1.2.0
File Interpreter ABI Platform
qris_payment-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / qris_payment-1.2.0.tar.gz

Download URL qris_payment-1.2.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fdb447b1db494a0a3ae8291fbb4198f40b5638980292c66b627c2756422e58f4
BLAKE2b-256 checksum
How to use checksums
9db63f99fcb8d78f0332fe0c434d85c133534f1cad435c9603762c7cccc35604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / qris_payment-1.2.0-py3-none-any.whl

Download URL qris_payment-1.2.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a5cdc1f26536760d0ab280060df32afd56bab8c6fa36fd5d9fad2b0b4aaaff1
BLAKE2b-256 checksum
How to use checksums
206d63cda5975f3878177e1a2bfac3f769ecb40ad7dff2dcb7992c6dc52072ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page