Code Monkey home page Code Monkey logo

django-qiwi-kassa's Introduction

Django Qiwi Kassa

Description

Django app to work with Qiwi Kassa

Install

pip install django-qiwi-kassa

Add qiwi_kassa to INSTALLED_APPS

Step 1.

Append qiwi_kassa to INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'qiwi_kassa',
]

Step 2.

Add to settings.py QIWI_KASSA_SECRET_KEY constant:

QIWI_KASSA_SECRET_KEY = 'QIWI_KASSA_SECRET_KEY'

Step 3.

Apply migrations

python manage.py migrate

Payment notifications

If you want to set up POST notifications from Qiwi when payment is received, you have to add qiwi_kassa.urls in your project urls:

urlpatterns.append(
    path('qiwi/', include(('qiwi_kassa.urls', 'qiwi_payments'), namespace='qiwi')),
)

Then you notification URL will be: <your_hostname>/qiwi/notify/

When payments is received and signatures are OK the payment_received signal will be broadcasted. Here is an example how to handle the signal:

from django.dispatch import receiver
from qiwi_kassa.models import Invoice
from qiwi_kassa.signals import payment_received
from qiwi_payments.constants import PaymentStatus

@receiver(payment_received, sender=Invoice)
def payment_handler(sender, **kwargs):
    bill_id = kwargs.get('bill_id')
    invoice = Invoice.objects.get(bill_id=bill_id)
    invoice.status = PaymentStatus.PAID
    invoice.save()
    print('$$$$!')

django-qiwi-kassa's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

izzzzzi tftlegal

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.