An async library for requesting to the nextpay.org purchase gate way.
Project description
AioNextPay
This is an async library for requesting to the https://nextpay.org purchase gateway.
How to install :
pip install aionextpay
How to use :
First import NextPay from aionextpay
from aionextpay import NextPay
Then you need to create an instance from NextPay class and pass it's parameters to it in an async function
from aionextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
async def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
Then you need to use purchase function
from aionextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
async def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
trans_id = await nextpay.purchase(order_id)
Have in mind that purchase function take kwargs parameter. so read the docs.
If every thing goes good you get a trans_id from that function.
p.s : you have to create a gateway payment with that trans_id and give it to the client like this:
from aionextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
async def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
trans_id = await nextpay.purchase(order_id)
link = f"https://nextpay.org/nx/gateway/payment/{trans_id}"
When your client complete the purchase nextpay will request to the address you gave to callback_uri variable
When it does verify the purchase in your request handler like this :
await nextpay.verify(trans_id)
If everything goes good it will return True otherwise an exception will raise
You can also refund the payment like this :
await nextpay.refund(trans_id)
If everything goes good it will return True otherwise an exception will raise
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 Distributions
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 aionextpay-1.0.8-py3-none-any.whl.
File metadata
- Download URL: aionextpay-1.0.8-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0db797f5470cc3b95a2a63df736e0ac1c17407386c5abdfcef49c91d4bb4103
|
|
| MD5 |
bf6330b917abbf05be53b85ff3e32028
|
|
| BLAKE2b-256 |
0dcac91432917b09e2a6d2dbe4ddeb9539b00a5aa5395adc82c58477dc65c501
|