GithubHelp home page GithubHelp logo

cutekisal / nextpay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hadih2o/nextpay

0.0 0.0 0.0 13 KB

a library for requesting to the nextpay.org gate way

License: MIT License

Python 100.00%

nextpay's Introduction

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

nextpay's People

Contributors

hadih2o avatar xcarcedo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.