Payit
Online payment gateways wrapper library. 💳
Supported Gateways
(Iran)
Aqayepardakht
AsanPardakht
Bahamta
IranKish
Mellat
Parsian (PECCO)
Pay.ir
Zarinpal
Install
pip install payit
Usage
from payit import (
GatewayManager,
gateways,
Transaction,
TransactionAlreadyPaidError
)
# Configure:
config = {
'mellat': {
'terminal_id': '1234',
'username': 'demo',
'password': 'demo',
'callback_url': 'http://localhost/callback/mellat'
},
'zarinpal1': {
'merchant': '534534534532225234234',
'description': '',
'callback_url': 'http://localhost/callback/zarinpal1'
},
'zarinpal2': {
'merchant': '33333333532225234234',
'description': '',
'callback_url': 'http://localhost/callback/zarinpal2'
}
}
manager = GatewayManager()
manager.register('mellat', gateways.MellatGateway)
manager.register('zarinpal1', gateways.ZarinpalGateway)
manager.register('zarinpal2', gateways.ZarinpalGateway)
manager.configure(config)
# Make Transaction:
my_database = {}
selected_gateway = 'zarinpal1'
try:
transaction = Transaction(amount=1500, order_id=11002)
transaction = manager.request(selected_gateway, transaction)
# Store `transaction.id` on your database
my_database['transaction_id'] = transaction.id
# Get redirection details
redirection = manager.get_redirection(selected_gateway, transaction)
# Now redirect your client to gateway by redirection details
except PayitException:
print('Something wrong on payment')
raise
# Callback
# Now user backs from gateway to complete payment procedure
selected_gateway = 'zarinpal1'
try:
callback_data = {
'Authority': 101
}
transaction = manager.validate(selected_gateway, callback_data)
if not transaction.validate_status:
raise RuntimeError('Transaction is not valid')
# Check `transaction.id` exist on your database
if transaction.id not in my_database:
raise RuntimeError('Transaction is not exists')
# Now verify transaction
manager.verify(selected_gateway, callback_data)
except TransactionAlreadyPaidError:
print('Transaction Already Paid')
raise
except PayitException:
print('Something wrong on payment')
raise
# Payment succeed! 🎉
Metadata
Release files for payit 1.2.0
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 |
|---|---|---|---|---|
| payit-1.2.0.tar.gz | 18.7 kB | Without provenance | Details for payit-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| payit-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for payit-1.2.0-py3-none-any.whl |
Total release size: 51.7 kB
Release files / payit-1.2.0.tar.gz
| Download URL | payit-1.2.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd0c20c0a48a0fcaef22d38ca4e68395f176596620524deac3d730ef7023cf6e
|
|
BLAKE2b-256 checksum How to use checksums |
6f75d3b332e24da8f6dcfb3c117a12d26fc443aa6f45367a20eb69232a63aba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Release files / payit-1.2.0-py3-none-any.whl
| Download URL | payit-1.2.0-py3-none-any.whl |
|---|---|
| Size | 33.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
212385637e45c3aae6b0320a8ef6d81d334d7e523913405db59ba416bd0bcc86
|
|
BLAKE2b-256 checksum How to use checksums |
ff16b60c68a7527603be608f0933de72f24a6bf1338a68bb19a755902891d852
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for payit 1.2.0
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.