NextPay
This is a library for requesting to the https://nextpay.org purchase gateway.
How to install :
pip install nextpay
How to use :
First import NextPay from nextpay
from nextpay import NextPay
Then you need to create an instance from NextPay class and pass it's parameters to it in a function
from nextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
Then you need to use purchase function
from nextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
trans_id = 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 nextpay import NextPay
token = 'your_nextpay_token'
callback_uri = 'yourdomain.ir/verify'
def func():
amount = '10000' # price of your product
nextpay = NextPay(token, amount, callback_uri)
trans_id = 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 :
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 :
nextpay.refund(trans_id)
If everything goes good it will return True otherwise an exception will raise
Release files for nextpay 1.0.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 | |
|---|---|---|---|
| nextpay-1.0.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nextpay-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / nextpay-1.0.0.tar.gz
| Download URL | nextpay-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e03d77101a211c443a615c371422fac1551ba63d608a52abc1d069ee279ae7a
|
|
BLAKE2b-256 checksum How to use checksums |
d9619d0b9868bb813376015772bcfd782335cf79d4ea6133c3487e5188456260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / nextpay-1.0.0-py3-none-any.whl
| Download URL | nextpay-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d71f806dfbbb3701879ea61421820c63a57480c830130c29cd97534161c92b9
|
|
BLAKE2b-256 checksum How to use checksums |
32aa29c8d57db9593018f6bca31acc45dc23fb13d849e7a7a835ea94f965d6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|