Giter Site home page Giter Site logo

raj457036 / paytm-api-for-django Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 534 KB

High performance Paytm Gateway api for Django. Just plug and play app.

License: MIT License

Python 93.30% HTML 6.70%
django paytm-payments paytm-merchant paytm-api paytm-dajngo paytm-gateway-django paytm-gateway-python paytm-app python3 django2

paytm-api-for-django's Introduction

Paytm-api-for-django

High performance Paytm Gateway api for Django. Just plug and play app. good luck.

Requirements

Python 3+ Django 2+

Installation

Step 1 : clone this repo and paste it in your project directory Step 2 : open settings.py file of your project and add paytm to INSTALLED_APPS paste the below settings

# settings.py

INSTALLED_APPS = [
    .
    .
    .
    'paytm',
]

# other settings...

PAYTM_STAGING_URL = 'https://securegw-stage.paytm.in'
PAYTM_PRODUCTION_URL = 'https://securegw.paytm.in'

HOSTNAME = '127.0.0.1:8000'

if DEBUG:
    PAYTM_URL = PAYTM_STAGING_URL
else:
    PAYTM_URL = PAYTM_PRODUCTION_URL

PAYTM_MERCHANT_KEY = 'XXXXXXXXXXXX' # replace with original merchangt key
PAYTM_GATEWAY_SETTINGS = {
    'MID':'XXXXXXXXXXXXXXXXXXXX', # replace with original merchangt id or MID
    'INDUSTRY_TYPE_ID':'Retail',
    'WEBSITE':'APPSTAGING', # WEBSTAGING for websites -->> change this with production variables
    'CHANNEL_ID':'WAP', #WEB for websites
    'CALLBACK_URL':f'http://{HOSTNAME}/paytm/payment_response/', } # https:// if you are on production server

PAYTM_SAVE_SUCCESS_TRANSECTIONS_ONLY = True  # if this is true paytm will save only successful transection else it willsave all transections

Step 3 : Run migrations and migrate after that Replace "XXXXX..." above with respective merchant key and MID

Step 4 : open urls.py and add

#urls.py

urlpatterns = [
  #other urls ...
  path('paytm/', include('paytm.urls'))
]

Step 5 : Setup complete and you are good to go

Test your api

  • Fill the details and test your api

URLS

### To request for payment
url: https://{HOST}/paytm/payment_response/ 
method: POST
minimum requirements = ['ORDER_ID', 'TXN_AMOUNT', 'CUST_ID'] send these fields
NOTE: This api is also optimized for PAYMENT_MODE_ONLY field for more info go through paytm gateway docs below


### To check status of transection
url: https://{HOST}/paytm/status/
method: POST
minimum requirements = ['ORDER_ID'] send these fields

for all the available fields go through
PAYTM Gateway Documentation
https://business.paytm.com/developers-api/integration/payment-gateway/documentation

NOTES

  • Every api need the user to be logged in So if you dont want it to check for logged in just remove LoginRequiredMixin from views.py in paytm folder

  • All the response are in json format

  • Apis are checked and highly optimized for performance

  • This package also include Refund API But Paytm suggest not to use apis for this use PAYTM DASHBOARD

  • you will need to install pycrypto for paytm to work.

    pip install pycrypto

    if above give error, i included pre-compiled wheel file

    pip install pycrypto-2.6.1-cp36-cp36m-win_amd64.whl

    this will solve the problem for windows users too.

Any problem? raise an issue

LICENCE

  • MIT

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.