Metadata-Version: 2.1
Name: nextpay
Version: 1.0.0
Summary: A library for requesting to the nextpay.org purchase gate way.
Author-email: Hadi Alipoor <hadi.alipoor.h2o@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Hadi Alipoor
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/HadiH2o/NextPay
Project-URL: Bug Tracker, https://github.com/HadiH2o/NextPay/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# NextPay

This is a library for requesting to the https://nextpay.org purchase gateway.<br>
<h3>How to install : </h3>
<code>pip install nextpay</code>
<h3>How to use : </h3>

First import <code>NextPay</code> from <code>nextpay</code><br><br>
<code>from nextpay import NextPay</code><br><br>
Then you need to create an instance from NextPay class and pass it's parameters to it  in a function<br><br>

<pre>
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)
</pre>

Then you need to use purchase function
<pre>
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)
</pre>
 
Have in mind that <code>purchase</code> function take kwargs parameter. so read the docs.<br>
If every thing goes good you get a trans_id from that function.<br>
p.s : you have to create a gateway payment with that trans_id and give it to the client like this:<br>

<pre>
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}"
</pre>

When your client complete the purchase nextpay will request to the address you gave to <code>callback_uri</code> variable<br>
When it does verify the purchase in your request handler like this :<br><br>
<code>nextpay.verify(trans_id)</code><br><br>
If everything goes good it will return True otherwise an exception will raise

You can also refund the payment like this :<br><br>
<code>nextpay.refund(trans_id)</code><br><br>
If everything goes good it will return True otherwise an exception will raise

