Skip to main content


Project description

Moneyboookers gateway for Django with two payment forms: common and secure.

Moneyboookers gateway allows you to accept payments on your website. It contains two payment paths:

  • Form genaration with POST to Moneybookers

  • Secure redirect with prepared SESSION_ID

In both cases additional security checks are implemented.

Full API documentation: “Moneybookers Payment Gateway”

How to install

  1. Download the source and place in your apps folder

  2. Edit “”
    • add “moneybookers” to your “INSTALLED_APPS”

    • add following settings (example):


not required, but recommended:


For more optional settings please see “”

  1. Add to “” paths

urlpatterns = patterns('',
    (r'^moneybookers/status_url/', include('moneybookers.urls')),
    (r'^moneybookers/cancel/', 'MoneybookersCancel'),
    (r'^moneybookers/ok/', 'MoneybookersOk'),
    (r'^order/$', 'View_With_Order'),
  1. Create table in your database syncdb
  1. Create/render form

  • Common way:

Create an instance of the form in your “” and make render in your template

from moneybookers.forms import MoneybookersStandardForm

def View_With_Order(request):
    mb_dict = {
      "detail1_description":"Product ID:",
      "merchant_field": "new_client",
      "merchant_field_value": "1",
      "user_ipaddress": request.META.get("REMOTE_ADDR", "")
    f = MoneybookersStandardForm(initial=mb_dict)
    context = {"form": f}
    return render_to_response("order.html", context)

In “order.html”:

<h1>Pay with Moneybookers now!</h1>
{{ form.render }}

After payment Moneybookers sends a signal to your server (status_url). The transaction will be saved in the database, then will be send a signal MoneybookersSignal. You can use it to process your own actions (add amount to users account, etc..). An example to use in “”: from moneybookers.signals import moneybookers_signal from django.db import transaction from django.core.mail import mail_admins

def MoneybookersSignal(sender, **kwargs):
        if sender.error:
                mail_admins("Moneybookers: bad transaction %s" % sender.transaction_id, sender.error_text)
        sid = transaction.savepoint()
                user = User.objects.get(id=sender.user_id)
                profile = user.get_profile()
       = + sender.amount
                mail_admins( "Moneybookers: good transaction %s" % sender.transaction_id, "%s added to user %s" % (sender.amount, sender.user_id) )
            except Exception, e:
                mail_admins("Moneybookers: database rollback: transaction %s" % sender.transaction_id, e)

moneybookers_signal.connect(MoneybookersSignal, dispatch_uid="yourapp.models.MoneybookersSignal")

Secure way:

Add to “” another path

urlpatterns = patterns('',
    (r'^moneybookers_redirect/$', 'payment_moneybookers_redirect'),

Create an form in your template yourself with POST-Url to “moneybookers_redirect”

<form action="" method="post">
    <input name="invoice" value="777" type="hidden">
    <input type="submit" value="Pay with Moneybookers"/>

In your “” you must check the invoice number

from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.http import HttpResponseRedirect, HttpResponseServerError

def payment_moneybookers_redirect(request):
    invoice = request.POST.get("invoice", None)
    mb_dict = {
        "language": "EN",
        "country": ...,
        "amount": ...,
        "prepare_only": True,
        "detail1_description": "Invoice #",
        "detail1_text": invoice,
        "invoice": invoice,
        "user_ipaddress": request.META.get("REMOTE_ADDR", "")

    # If you want accept only credit cards without user to register on moneybookers:
    mb_dict["hide_login"] = "1"
    mb_dict["payment_methods"] = "ACC"

    f = MoneybookersSecureForm(initial=mb_dict)
    url = f.redirect_url()
    if url:
        return HttpResponseRedirect(url)
    return HttpResponseServerError()
Patch your "" with signal MoneybookersSignal like in "common way"

Based on “Moneybookers Payment Gateway Merchant Integration Manual” v6.10 / 8 Nov. 2010

Alex Aster,, 2010 FreeBSD License

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-moneybookers-0.2.tar.gz (15.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page