项目作者: raj457036

项目描述 :
High performance Paytm Gateway api for Django. Just plug and play app.
高级语言: Python
项目地址: git://github.com/raj457036/Paytm-api-for-django.git
创建时间: 2018-10-02T13:18:44Z
项目社区:https://github.com/raj457036/Paytm-api-for-django

开源协议:MIT License

下载


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

  1. # settings.py
  2. INSTALLED_APPS = [
  3. .
  4. .
  5. .
  6. 'paytm',
  7. ]
  8. # other settings...
  9. PAYTM_STAGING_URL = 'https://securegw-stage.paytm.in'
  10. PAYTM_PRODUCTION_URL = 'https://securegw.paytm.in'
  11. HOSTNAME = '127.0.0.1:8000'
  12. if DEBUG:
  13. PAYTM_URL = PAYTM_STAGING_URL
  14. else:
  15. PAYTM_URL = PAYTM_PRODUCTION_URL
  16. PAYTM_MERCHANT_KEY = 'XXXXXXXXXXXX' # replace with original merchangt key
  17. PAYTM_GATEWAY_SETTINGS = {
  18. 'MID':'XXXXXXXXXXXXXXXXXXXX', # replace with original merchangt id or MID
  19. 'INDUSTRY_TYPE_ID':'Retail',
  20. 'WEBSITE':'APPSTAGING', # WEBSTAGING for websites -->> change this with production variables
  21. 'CHANNEL_ID':'WAP', #WEB for websites
  22. 'CALLBACK_URL':f'http://{HOSTNAME}/paytm/payment_response/', } # https:// if you are on production server
  23. 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

  1. #urls.py
  2. urlpatterns = [
  3. #other urls ...
  4. path('paytm/', include('paytm.urls'))
  5. ]

Step 5 : Setup complete and you are good to go

Test your api

URLS

  1. ### To request for payment
  2. url: https://{HOST}/paytm/payment_response/
  3. method: POST
  4. minimum requirements = ['ORDER_ID', 'TXN_AMOUNT', 'CUST_ID'] send these fields
  5. NOTE: This api is also optimized for PAYMENT_MODE_ONLY field for more info go through paytm gateway docs below
  6. ### To check status of transection
  7. url: https://{HOST}/paytm/status/
  8. method: POST
  9. minimum requirements = ['ORDER_ID'] send these fields
  10. for all the available fields go through
  11. PAYTM Gateway Documentation
  12. 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.

    1. pip install pycrypto

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

    1. 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