Python API for payment service
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python API for payment service

  • Add to
url(r'^payment/', include("robokassa.urls")),
  • Add to
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(, "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)
url = robokassa.get_payment_url(, order.price, u"Buying new HDD", test=False)
return redirect(url)