An open API service indexing awesome lists of open source software.

https://github.com/coffebar/django-interkassa

interkassa for django 1.9 python3
https://github.com/coffebar/django-interkassa

Last synced: 15 days ago
JSON representation

interkassa for django 1.9 python3

Awesome Lists containing this project

README

        

# Interkassa merchant for Django 1.9+

## Install

Checkout this repository or download an archive and extract it into your Django project.

### Edit your settings.py:

Add to INSTALLED_APPS:

'interkassa_merchant',

Add your SecretKey and Checkout id

INTERKASSA_ID = 'XXXXXXXXXXXXXXXXXXXXXXXX'
INTERKASSA_SECRET = 'XXXXXXXXXXXXXXXX'


### Migrate

> manage.py migrate


### Include urls

urlpatterns = [
...
url(r'^merchant/', include('interkassa_merchant.urls')),
]

### Create view
@login_required
def balance(request):
default_amount = 300
if request.method == 'POST':
amount = request.POST.get('amount')
if amount:
try:
amount = int(amount)
except Exception:
amount = default_amount
else:
amount = default_amount
inv = Invoice.objects.create(amount=amount, user=request.user,
payment_info='Пополнение баланса')
initial = dict(ik_co_id=settings.INTERKASSA_ID, ik_pm_no=inv.payment_no,
ik_am=inv.amount, ik_desc=inv.payment_info)
form = PaymentRequestForm(initial=initial)
else:
form = PaymentRequestForm()
return render(request, 'balance.html', locals())

### Create template
for example

{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}Пополнить баланс{% endblock %}
{% block content %}

Сумма пополнения



{{ form }}


Пополнить
{% csrf_token %}

{% endblock %}
{% block jquery_scripts %}
if($("#id_ik_co_id").val().length>0){
$("#merchant-form").attr('action', 'https://sci.interkassa.com/').submit();
}
{% endblock %}

### Config merchant on interkassa.com
Use this config (except domain name)

![sample1](https://raw.githubusercontent.com/Hukuta/django-interkassa/master/conf1.png)

![sample2](https://raw.githubusercontent.com/Hukuta/django-interkassa/master/conf2.png)