django-zarinpal
Integrate django payments with zarinpal
Features
- sending signal on verifying transaction to let other apps know about it
Quickstart
Install django-zarinpal::
pip install django-zarinpal
Add it to your INSTALLED_APPS:
.. code-block:: python
INSTALLED_APPS = (
...
'zarinpal',
...
)
Add django-zarinpal's URL patterns:
.. code-block:: python
import zarrinpal
urlpatterns = [
...
path('zarinpal/', include(zarinpal_urls)),
...
]
How to Use
set these variables in your settings file:
ZARINPAL_CALLBACK_URL: bool # the url user redirects to after transaction
ZARINPAL_SIMULATION: bool # is transactions for test?
ZARINPAL_MERCHANT_ID: str # merchant id from zarinpal (you may leave it blank if you set the simulation to True)
you can use function start_transaction with a dictionary containing your transaction data like this:
from django.shortcuts import redirect
from django_zarinpal.services import start_transaction
def start_payment(request):
result = start_transaction(
{
"user": request.user,
"amount": 10000,
"description": "transaction description",
"mobile": "09123456789",
"email": "string",
}
)
return redirect(result) # result is the url for starting transaction
If you specify a callback_url in transaction data after completing transaction zarinpal will redirect user to the page you specified with two get arguments:
1.order_number: str
2.success: boolean
Custom verification
If you want to handle verifying transaction your self you can define your view and
address it in settings with ZARINPAL_VERIFY_TRANSACTION_VIEW. you can use function
verify_transaction to verify a transaction.
If you don't specify this view, package will use default view for verifying transactions.
Tests
Running tests: ::
python manage.py runtests.py
Metadata
Release files for django-zarinpal 1.0.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 |
|---|---|---|---|---|
| django-zarinpal-1.0.1.tar.gz | 6.6 kB | Without provenance | Details for django-zarinpal-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_zarinpal-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_zarinpal-1.0.1-py3-none-any.whl |
Total release size: 15.0 kB
Release files / django-zarinpal-1.0.1.tar.gz
| Download URL | django-zarinpal-1.0.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6e269c46ab9ed11df4c98d36bf379b37e72ceac432ce8e6df23bd5d5411d4c7
|
|
BLAKE2b-256 checksum How to use checksums |
b1dea09a3a11491b4d1b0e8027633e9f7078745504f534045e2d9b57733f06ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.3 Linux/5.4.0-7629-generic
|
Release files / django_zarinpal-1.0.1-py3-none-any.whl
| Download URL | django_zarinpal-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d48551e7a69841a7ea0084a7912845ff6f0458a18ca33d787f62d8679dfc8eac
|
|
BLAKE2b-256 checksum How to use checksums |
2f2e467069326baefe977a3b0a8c1bdbad1c67e18090913eca912d19661532fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.3 Linux/5.4.0-7629-generic
|
Security for django-zarinpal 1.0.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.