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 = {
    'merchant_id': 'YOUR_MERCHANT_ID',
    'api_key': 'YOUR_API_KEY',
    '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
merchant_id string ID Merchant QRIS
api_key string API Key untuk cek pembayaran
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
  • API key tidak valid
  • dll

Contoh Lengkap

from qris_payment import QRISPayment

config = {
    'merchant_id': 'YOUR_MERCHANT_ID',
    'api_key': 'YOUR_API_KEY',
    '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.0.tar.gz (4.2 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.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for qris_payment-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0010a8c6e6620cec2b16a5b9abec775af3a03c1bdbe9b274c27fef1bb5db085b
MD5 11eb5670a30a8ddea5801f7b82962580
BLAKE2b-256 eb88d4ba90be941e6b92703e9001ef5899c61a5df7f2bc6dedc4918620b74b86

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for qris_payment-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7845a8182e9f563ff58d7ea29fa9f3a8233f346cd70c54ad0039d1eda1e94e6
MD5 f83d6662ecaa39e082a5543f02d96dd2
BLAKE2b-256 a62f22fb39c79eda370d1778cca90f0de89ecd830ebfd36fcb4f29bc5b3904ce

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