Preparing for use

  1. Add payments to your INSTALLED_APPS

  2. Hook the callback processor to your URLconf

    from django.conf.urls.defaults import *
    urlpatterns = patterns('',
        ('^payments/', include('payments.urls')),
  3. Configure the payment variants in your

        'default': (
            '', {
                # these will be passed to __init__
                'key1': 'val1',
                'key2': 'val2',
        'somevariant': ('payments.dummy.DummyProvider', {}),

    Variants are named pairs of payment providers and their configuration.


    Variant names will be used to construct some of the automatic URLs so it’s best to keep them in ASCII.

Making a payment

  1. Call factory() to obtain a provider instance

    from payments import factory
    provider = factory('somevariant')
  2. Call create_payment() on the provider to obtain a form

    payment = provider.create_payment(currency='USD')
  3. Fill the payment object with useful data

    payment.add_item(name='Some item', unit_price='5.00', tax_rate='2.00')
  4. Pass the form to the template of your choice

    form = payment.get_form()
  5. Display the form using its action and method

    <form action="{{ form.action }}" method="{{ form.method }}">
        {{ form.as_p }}
        <p><input type="submit" value="Proceed" /></p>