Python API for www.robokassa.ru payment service
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
__init__.py
signals.py
tests.py
urls.py
views.py

README.md

django-robokassa

Python API for www.robokassa.ru payment service

  • Add to urls.py
url(r'^payment/', include("robokassa.urls")),
  • Add to settings.py
ROBOKASSA_LOGIN = "your_login"
ROBOKASSA_PWD1 = "password1"
ROBOKASSA_PWD2 = "password2"
ROBOKASSA_ORDER_MODEL = "yoursite.models.OrderModel"
ROBOKASSA_SUCCESS_TEMPLATE = "payment_success.html"
ROBOKASSA_FAIL_TEMPLATE = "payment_fail.html"
  • Your order model should contains these fields:
status = models.SmallIntegerField(default=0)
payed_date = models.DateTimeField(null=True,default=None)
price = models.PositiveIntegerField()
  • Connect to a signal, if you need it
from robokassa.signals import payment_done
from robokassa import send_sms, send_sms_async
def payment_done_callback(sender, **kwargs):
        #some useful code
        order = kwargs["order"]
        send_sms_async(order.phone, "Congratulations !!!")
payment_done.connect(payment_done_callback, dispatch_uid="payment_done")
  • In the ROBOKASSA_SUCCESS_TEMPLATE and ROBOKASSA_FAIL_TEMPLATE you can use the order and request variable to display success text.

  • To create a new order use robokassa.get_payment_url function.

order = models.Order(status=0, price = 100)
order.save()
url = robokassa.get_payment_url(order.id, order.price, u"Buying new HDD", test=False)
return redirect(url)