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
- Host: GitHub
- URL: https://github.com/coffebar/django-interkassa
- Owner: coffebar
- Created: 2016-06-02T13:57:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-02T14:35:57.000Z (almost 9 years ago)
- Last Synced: 2025-03-23T18:11:21.946Z (about 1 month ago)
- Language: Python
- Size: 126 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 idINTERKASSA_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)
