Skip to main content

Package Python untuk generate QRIS dan cek status pembayaran

Project description

QRIS Payment Python Package

Package Python untuk generate QRIS dan cek status pembayaran dengan fitur monitoring realtime.

🚀 Fitur Terbaru (v1.1.3)

  • 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

📦 Instalasi

pip install qris-payment==1.1.3

🔑 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

🛠️ Penggunaan

Inisialisasi

from qris_payment import QRISPayment

config = {
    'auth_username': 'YOUR_AUTH_USERNAME',  # Dapat dari @AutoFtBot
    'auth_token': 'YOUR_AUTH_TOKEN',        # Dapat dari @AutoFtBot
    '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'
}, 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
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',
    '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
  • API tidak dapat diakses - Cek koneksi internet
  • Response tidak valid - Ada masalah dengan server API

📝 Changelog

v1.1.3 (Latest)

  • ✅ 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qris_payment-1.1.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qris_payment-1.1.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file qris_payment-1.1.4.tar.gz.

File metadata

  • Download URL: qris_payment-1.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for qris_payment-1.1.4.tar.gz
Algorithm Hash digest
SHA256 007d554d1c7e9ec3ba44183a739eed52b1be2d35566a3d3be4cef9220b58bb78
MD5 08dba9835bc1645d660b13be8c4c70c1
BLAKE2b-256 2627fcd09ef0721cac441300643576bd14c67631879882e8f13e19affb1b249c

See more details on using hashes here.

File details

Details for the file qris_payment-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: qris_payment-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for qris_payment-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 34f58f92682794fedb265346f66ac11cb1798ae97bb51946ad91d6e06bd3a292
MD5 fedfc0143fb310477e1277fd45f305af
BLAKE2b-256 9223ca51fd4f9b76b8fbd78165c89472f0165f7e6bd3e4dbaa766be15167c8b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page