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.5)

  • 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.5

🔑 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.5 (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.5.tar.gz (8.6 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.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qris_payment-1.1.5.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qris_payment-1.1.5.tar.gz
Algorithm Hash digest
SHA256 02e61b59e9b4ed1ecd13656dbd5f2c0522b539e4399c469d4f8d9d7651c5d0e1
MD5 9f033e01d9e75a0c7709af64a0924d5b
BLAKE2b-256 a2d4fb1673712c07b76755842ad6f4e41c1de4dbfc234c7478b5402dc050515c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qris_payment-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qris_payment-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 61b17decd4ffaa946f3446e486bba5f61c504c2a4f8167ac83fb47c8c744937e
MD5 2f9a288b313948d95f701e168352f99d
BLAKE2b-256 5562357e06fbf4d5dfede4ba9dbc2d6f151d894416d8e5892c301514991d88db

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