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 = {
'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 |
|---|---|---|---|
| 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 = {
'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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qris_payment-1.1.3.tar.gz.
File metadata
- Download URL: qris_payment-1.1.3.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8992be073d83254a6df5583a2b950e6394854d1b10e89e7f969b06d14901d4b3
|
|
| MD5 |
107d6c837629a7a8815c4cc90481176f
|
|
| BLAKE2b-256 |
17209c925af029e55cd85e219ccde91d63a91b1340cf100aec4b0b2a95bfb14b
|
File details
Details for the file qris_payment-1.1.3-py3-none-any.whl.
File metadata
- Download URL: qris_payment-1.1.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f118cf00baeb7633bb406df46571311cf7baba76ab56b65143a907f55753bcc3
|
|
| MD5 |
27fc1369e975fcd29401a985de170730
|
|
| BLAKE2b-256 |
7d9a0dcc90eef61b624aef5ae367a16253fe6a03c585e47f9e542bc75f5ca090
|