Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
157 lines (113 sloc) 5.58 KB


Hello, developers! This will get you set up with a local WebPay server. You can also :ref:`use a hosted <use-hosted>` WebPay server.

Install With Docker

The easiest way to set up Webpay and all of its dependencies is to install everything with Docker according to the marketplace-env instructions.

Install Manually

You need Python 2.7, and MySQL, and a few NodeJS commands like stylus for minifying JS/CSS. Install system requirements with `homebrew`_ (Mac OS X):

brew tap homebrew/versions
brew install python mysql swig

To develop locally you also need:

  • An instance of the Solitude payment API running. If you run it with mock services (such as BANGO_MOCK=True) then some things will still work. You can configure webpay with SOLITUDE_URL pointing at your localhost.
  • Access to the Zamboni db. For extra points this can be a read only slave. You can configure zamboni with MARKETPLACE_URL pointing at your localhost.

Let's install webpay! Clone the source:

git clone git://

Install all Python dependencies. You probably want to do this within a virtualenv. If you use virtualenvwrapper (recommended) set yourself up with:

mkvirtualenv --python=python2.7 webpay

Install with:

pip install --no-deps -r requirements/dev.txt --find-links

Out of the box, webpay makes some assumptions in the settings file and should not need a custom settings files. Some environment variables are configurable from the environment, they are: ZAMBONI_URL, SOLITUDE_URL. See the marketplace docs for information on the environment variables and how they affect the services.

You can now fire up a development server:

python runserver

Try it out at http://localhost:8001/mozpay/ . If you see a form error about a missing JWT then you are successfully up and running.

If you can't log in with Persona check the value of SITE_URL in your local settings. It must match the URL bar of how you run your dev server exactly.

See :ref:`this section <use-hosted>` for how to set up a B2G device to talk to your brand new local development server.

Setting Up the Tests

You will need to install the python testing dependencies for python or UI testing:

pip install -r requirements/test.txt

Running Tests

Webpay has integration tests that make HTTP requests to Django views or test public functions and classes directly. You can run the test suite like this:

python test

Building the Docs

To build these very docs that you are reading while developing locally, do this from your webpay root:

pip install -r requirements/docs.txt
make -C docs/ html

Then open docs/_build/html/index.html in a browser.

Overriding JS settings from Django settings

JS settings are overridden from the webpay.settings.base.JS_SETTINGS dict.

Here's an example to override a setting foo with the value True:

base.JS_SETTINGS['foo'] = True

Using JWTs for development

Each payment begins with a JWT (Json Web Token) so you'll need to start with a JWT if you want to see the complete payment flow. The best way to get a valid JWT is to make a real purchase using your local Marketplace or any app that has a valid in-app payment key. When you start a purchase from B2G check your B2G console. In stdout you should see a link that you can copy and paste into a browser to use better dev tools. Here is an example of what that looks like:


Displaying statsd results

You can configure your webpay/settings/ settings to visualize the summary table generated by django-statsd counting the number of keys logged and the time spent in views:

STATSD_CLIENT = 'django_statsd.clients.nose'
Jump to Line
Something went wrong with that request. Please try again.