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.

Fitur

  • Generate QRIS dengan nominal tertentu
  • Tambah logo di tengah QR
  • Cek status pembayaran
  • Validasi format QRIS
  • Perhitungan checksum CRC16

Instalasi

pip install qris-payment

Penggunaan

Inisialisasi

from qris_payment import QRISPayment

config = {
    'merchantId': 'YOUR_MERCHANT_ID',
    '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:
        result = qris.check_payment('REF123', 10000)
        print('Status pembayaran:', result)
    except Exception as e:
        print(f"Error: {str(e)}")

Konfigurasi

Parameter Tipe Deskripsi
merchantId string ID Merchant QRIS
base_qr_string string String dasar QRIS
logo_path string Path ke file logo (opsional)

Response

Generate QR

{
    'qr_string': "000201010212...",  # String QRIS
    'qr_image': <PIL.Image.Image>  # Objek gambar QR
}

Cek Pembayaran

{
    'success': True,
    'data': {
        'status': 'PAID' | 'UNPAID',
        'amount': int,
        'reference': str,
        'date': str,  # Hanya jika status PAID
        'brand_name': str,  # Hanya jika status PAID
        'buyer_reff': str  # Hanya jika status PAID
    }
}

Error Handling

Package ini akan melempar exception dengan pesan yang jelas jika terjadi masalah:

  • Format QRIS tidak valid
  • Gagal generate QR
  • Gagal cek status pembayaran
  • Merchant ID tidak valid
  • dll

Contoh Lengkap

from qris_payment import QRISPayment

config = {
    'merchantId': 'YOUR_MERCHANT_ID',
    'base_qr_string': 'YOUR_BASE_QR_STRING',
    'logo_path': 'path/to/logo.png'
}

qris = QRISPayment(config)

def main():
    try:
        # Generate QR
        result = qris.generate_qr(10000)
        result['qr_image'].save('qr.png')
        print('QR String:', result['qr_string'])

        # Cek pembayaran
        payment_result = qris.check_payment('REF123', 10000)
        print('Status pembayaran:', payment_result)
    except Exception as e:
        print(f"Error: {str(e)}")

if __name__ == "__main__":
    main()

Persyaratan Sistem

  • Python >= 3.6
  • Dependencies:
    • qrcode >= 7.4.2
    • Pillow >= 9.0.0
    • requests >= 2.28.0

Lisensi

MIT

Kontribusi

Silakan buat pull request untuk kontribusi. Untuk perubahan besar, buka issue terlebih dahulu untuk mendiskusikan perubahan yang diinginkan.

Support

Jika menemukan masalah atau memiliki pertanyaan, silakan buka issue di repository ini.

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.0.1.tar.gz (4.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.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qris_payment-1.0.1.tar.gz
  • Upload date:
  • Size: 4.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.0.1.tar.gz
Algorithm Hash digest
SHA256 9462cebb7e332c8aed85f21976b7b5d31dd8eeb0e095d25364fcd356ab6f961a
MD5 5c89868389a64ac0e95fe6f198598e47
BLAKE2b-256 062e927c0577f03256574edf3c98feedf03eaa128216865ce5b592a60030c714

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qris_payment-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2100d876e10152aee1c7d913cdf05da104c3c8e79921712a91f2d68031e47533
MD5 71fde64931b432eaf7717b5bd2283364
BLAKE2b-256 3a41d4a169574d1b3b2f341e53a22e28dcc0dc50edae844b08df15bc7af450d1

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