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',
    'auth_username': 'YOUR_AUTH_USERNAME',
    'auth_token': 'YOUR_AUTH_TOKEN',
    '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 Wajib
merchantId string ID Merchant QRIS Ya
auth_username string Username untuk autentikasi API Ya
auth_token string Token untuk autentikasi API 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
    '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
  • Auth username atau token tidak valid
  • dll

Contoh Lengkap

from qris_payment import QRISPayment

config = {
    'merchantId': 'YOUR_MERCHANT_ID',
    'auth_username': 'YOUR_AUTH_USERNAME',
    'auth_token': 'YOUR_AUTH_TOKEN',
    '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.1.0.tar.gz (4.9 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.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qris_payment-1.1.0.tar.gz
  • Upload date:
  • Size: 4.9 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.0.tar.gz
Algorithm Hash digest
SHA256 74f20dba832e0a8d54ccb187dcaa1cc98f1cdea1cc5ecef3ef024e24a82279a5
MD5 d5fbb5cf0865cb0fb3c309c67dbdfd05
BLAKE2b-256 a99872c6cbbd68f4c57af47ec892f408c946c136d38e48d22ddfe6dd12535a54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qris_payment-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cfd33bdbb5b8db14b937e760ffa8c3fca9abf3dd47e925d961b56eee5e4c515
MD5 f3479f788794123b0988385bcab072e4
BLAKE2b-256 079b4195961b8cdec2abf8c5b94cb25eaffc153899d586b41788dc7c06347db2

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