Generate EMV QRCPS / PY-QR (SIP) payment QR payloads for Paraguay. Standalone local generation; optional HubAdapter for PSP integration.
Project description
pysip-qr
Python library to generate EMV® QRCPS merchant-presented QR payloads with a Paraguay SIP / PY-QR profile.
PyPI package: pysip-qr
Import: import sip_qr
Important: generation vs QR Hub
- Generating a PY-QR–compatible payload (and optional QR image) does not require access to the BCP QR Hub. Standalone mode works fully offline.
- Processing / settling interoperable QR payments through the SIP / QR Hub does require a registered PSP/participant and integration with that entity.
- This library defaults to
standalone.integratedmode is opt-in via aHubAdapteryou configure — the library does not ship BCP endpoints or claim direct BCP connectivity. - PSPs that offer QR payments must register with the BCP/SGGOF and follow the official PY-QR implementation guide. This package helps with payload construction; it does not replace regulatory onboarding.
Install
pip install pysip-qr
# optional QR image rendering
pip install pysip-qr[image]
From source (editable):
pip install -e ".[image]"
Quick start (standalone)
from sip_qr.profiles.sip import SipQrBuilder
from sip_qr import validate_payload, to_qr_image
payload = (
SipQrBuilder()
.merchant_account(
guid="com.example.psp", # from your PSP — not invented by this lib
psp_fields={"01": "MERCHANT001"}, # PSP-specific subtags
root_tag=26,
)
.merchant(name="Farmacia Demo", city="Asuncion", mcc="5912")
.dynamic()
.amount("150000.00")
.currency_pyg()
.reference("VENTA-123")
.build()
)
assert validate_payload(payload) == []
to_qr_image(payload, path="qr.png") # requires pysip-qr[image]
Static QR without amount:
payload = (
SipQrBuilder()
.merchant_account(guid="com.example.psp", psp_fields={"01": "M1"})
.merchant(name="Farmacia Demo", city="Asuncion", mcc="5912")
.static()
.build()
)
Integrated mode (optional)
from sip_qr import OperatingMode, SipQrClient
from sip_qr.exceptions import MissingHubCredentials
# Provide your own HubAdapter implementation (PSP SDK / private API).
# No BCP URLs are hardcoded in this library.
client = SipQrClient(mode=OperatingMode.INTEGRATED, adapter=None)
try:
client.submit_payment(payment_reference="ORD-1")
except MissingHubCredentials:
...
Implement sip_qr.adapters.HubAdapter (is_configured, supports_participant, submit_payment, check_status) using credentials and base URLs supplied by your approved PSP.
CLI (offline)
python -m sip_qr generate --input examples/dynamic_with_amount.json
python -m sip_qr generate --input examples/static.json --output qr.png
python -m sip_qr validate --payload "000201..."
Assumptions (until official PY-QR guide field map is wired)
- Country default:
PY - Currency default:
600(PYG) - Merchant Account Information GUID and PSP subtags are injector-provided
- Dynamic QR (POI
12) requires amount by default; static (POI11) does not - CRC: CRC-16/CCITT-FALSE over payload including
6304 - PY-QR logo overlay is optional and not claimed as official branding compliance without the visual spec/asset
Development
pip install -e ".[dev,image]"
python -m unittest discover -s tests -v
Release
GitHub Actions:
ci.yml— runs unittest on push/PRrelease.yml— manualworkflow_dispatchwith bumppatch|minor|major: bump version, tagvX.Y.Z, build, publish to PyPI (Trusted Publishing)
Configure a PyPI Trusted Publisher for repo Piuliss/pysip-qr, workflow release.yml, environment pypi.
License
MIT
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 pysip_qr-0.1.0.tar.gz.
File metadata
- Download URL: pysip_qr-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84350d9b36768a44381664f59253c025bb4fd993af5d167804dbe85b49573b29
|
|
| MD5 |
f0739ce005a151c3d5ee30a1e0b4e689
|
|
| BLAKE2b-256 |
b8aa7bae73e2bec55c88b5f384387b9f5b209686b2fa0194f1ae47636a4c32e9
|
Provenance
The following attestation bundles were made for pysip_qr-0.1.0.tar.gz:
Publisher:
release.yml on Piuliss/pysip-qr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysip_qr-0.1.0.tar.gz -
Subject digest:
84350d9b36768a44381664f59253c025bb4fd993af5d167804dbe85b49573b29 - Sigstore transparency entry: 2290630482
- Sigstore integration time:
-
Permalink:
Piuliss/pysip-qr@98d94f92966bc03361f381db3d48648ebbc5658e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Piuliss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98d94f92966bc03361f381db3d48648ebbc5658e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pysip_qr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pysip_qr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54747b43f2e89daef8b76aa8d25cb23841c896cdc664a7d30412f39554f6593d
|
|
| MD5 |
0f65328836d7992a67582e6491db3687
|
|
| BLAKE2b-256 |
29efacbea3aba09784c2310964abc2d00bc26355fd2742c60eb8742b49cacfd6
|
Provenance
The following attestation bundles were made for pysip_qr-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Piuliss/pysip-qr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysip_qr-0.1.0-py3-none-any.whl -
Subject digest:
54747b43f2e89daef8b76aa8d25cb23841c896cdc664a7d30412f39554f6593d - Sigstore transparency entry: 2290630545
- Sigstore integration time:
-
Permalink:
Piuliss/pysip-qr@98d94f92966bc03361f381db3d48648ebbc5658e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Piuliss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@98d94f92966bc03361f381db3d48648ebbc5658e -
Trigger Event:
workflow_dispatch
-
Statement type: