Skip to main content

A library for requesting to the nextpay.org purchase gate way.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nextpay-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nextpay-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file nextpay-1.0.0.tar.gz.

File metadata

  • Download URL: nextpay-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for nextpay-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2e03d77101a211c443a615c371422fac1551ba63d608a52abc1d069ee279ae7a
MD5 8f68b9a1cc11d59580cd092ce6ece4d5
BLAKE2b-256 d9619d0b9868bb813376015772bcfd782335cf79d4ea6133c3487e5188456260

See more details on using hashes here.

File details

Details for the file nextpay-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nextpay-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for nextpay-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d71f806dfbbb3701879ea61421820c63a57480c830130c29cd97534161c92b9
MD5 ec148c7b40674aa38270ac8835c79925
BLAKE2b-256 32aa29c8d57db9593018f6bca31acc45dc23fb13d849e7a7a835ea94f965d6b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page