PayRex Python
PayRex Python library provides Python applications an easy access to the PayRex API. Explore various Python classes that represents PayRex API resources on object instantiation.
Requirements
Python 3.9.+
Installation
If you want to use the package, run the following command:
pip install payrex-python
If you want to build the library from source:
Create a virtual environment
python -m venv venv
Activate the virtual environment
source venv/bin/activate
Install the package to the virtual environment
pip install -e /Your/Local/Path/payrex-python
python
Getting Started
Simple usage looks like:
from payrex import Client as PayrexClient
payrex_client = PayrexClient('sk_test_...')
payment_intent = payrex_client.payment_intents.retrieve('pi_...')
payment_intent = payrex_client.payment_intents.create(
{
'amount': 10000,
'currency': 'PHP',
'description': 'Dino Treat',
'payment_methods': ['gcash']
}
)
Handle errors
try:
payrex_client = PayrexClient('sk_test_...')
payment_intent = payrex_client.payment_intents.create(
{
'amount': 10000,
'description': 'Dino Treat',
'payment_methods': ['gcash']
}
)
except BaseException as e:
# Handle error
print(type(e))
print(e.errors[0].code)
print(e.errors[0].detail)
print(e.errors[0].parameter)
Verify webhook signature
try:
payload = '{"id":"evt_...","resource":"event","type":"payment_intent.succeeded","data":{...'
signature_header = 't=1715236958,te=,li=...'
webhook_secret_key = 'whsk_...'
payrex_client.webhooks.parse_event(
payload,
signature_header,
webhook_secret_key
)
except SignatureVerificationException as e:
# Handle invalid signature
Metadata
Release files for payrex-python 1.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| payrex_python-1.8.1.tar.gz | 10.5 kB | Without provenance | Details for payrex_python-1.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| payrex_python-1.8.1-py3-none-any.whl | Python 3 | none | any | Details for payrex_python-1.8.1-py3-none-any.whl |
Total release size: 31.5 kB
Release files / payrex_python-1.8.1.tar.gz
| Download URL | payrex_python-1.8.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a29bad27a1a85f61e1504848b12ece15b427a2a2febe1724926d8c9a99ddb06c
|
|
BLAKE2b-256 checksum How to use checksums |
5eaa0c2f629b5c67072d02a99804afa1b0b4318eb6222978b5699cfba7ed18d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / payrex_python-1.8.1-py3-none-any.whl
| Download URL | payrex_python-1.8.1-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fca1da55ba71433de5708efccd3c83b83724c489e3a70bcafe249c96a1403b00
|
|
BLAKE2b-256 checksum How to use checksums |
50fc1898fd506911377428740ac3e5b84d6539f99c96e678f6857a4cc0c5ef1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for payrex-python 1.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.