Skip to content

A django application which helps in checkout and custom checkout for India's largest payment platform Paytm.

License

Notifications You must be signed in to change notification settings

Faisal-Manzer/django-paytm-checkout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Paytm Checkout

A simple modular approach for Paytm's checkout and custom checkout

Documentation is yet to be done

This is currently in beta phase

Installation

Use pip to install from PyPI:

pip install django-paytm-checkout

Configuration

Configure your django project by adding the following in your settings:

PAYTM_MERCHANT_ID = 'YOUR_PAYTM_MERCHANT_ID'
PAYTM_MERCHANT_KEY = 'YOUR_PAYTM_MERCHANT_KEY'
PAYTM_INDUSTRY = 'YOUR_INDUSTRY_TYPE'
PAYTM_WEBSITE = 'YOUR_PAYTM_WEBSITE'

Setting the environment:

PAYTM_DEBUG = True 
# default: True (for staging)
# False (for production)

These are optional settings, change if it not the same as default:

PAYTM_CHANNEL_WEBSITE = ''  # default: WEB
PAYTM_CHANNEL_MOBILE_APP = ''  # default: WAP

PAYTM_STAGING_DOMAIN = ''  # default: securegw-stage.paytm.in
PAYTM_PRODUCTION_DOMAIN = ''  # default: securegw.paytm.in

Using Default application

Add the following into your urls.py

from django.urls import path, include

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

Customising views

You can override all the Generic custom views

ex: Customising and using the initiate view

from django.conf import settings as django_settings
from django.shortcuts import render, Http404

from paytm.checkout.views import GenericInitiatePaymentView
from paytm.models import Item


class InitiatePaymentView(GenericInitiatePaymentView):
    """Wrapper for testing"""
    include_payment_charge = False
    channel = 'WEB'

    def get_amount(self):
        item_id = self.request.POST['item']
        item = Item.objects.get(pk=item_id)
        return item.price

    def get(self, request):
        if not django_settings.DEBUG:
            raise Http404

        self.request = request
        return render(request, 'paytm/checkout/index.html', {
            'items': Item.objects.all()
        })

About

A django application which helps in checkout and custom checkout for India's largest payment platform Paytm.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published