Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Gate2Shop gateway for accept payments on your website.

Project Description

How to install

  1. Using pip:
$ pip install django-gate2shop
  1. Edit “”
    • add “g2s” to your “INSTALLED_APPS”
    • add following settings:
G2S_MERCHANT_ID = "123456"
G2S_SECRET_KEY = "YourSecretWord"
G2S_MERCHANT_SITE_ID = "1234567"
  1. Add to “” paths
urlpatterns = patterns('',
    url(r'^g2s/g2s_form/$', 'g2s_form', name='g2s-form'),
    url(r'^g2s/', include('g2s.urls')),
  1. Create table in your database
$ python syncdb
$ python migrate
  1. Create/render form

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

from g2s.forms import G2SForm

def g2s_form(request):
    # this is what user wants to buy
    items_list = [
            'item_name': 'Test',
            'item_amount': 1.11,
            'item_quantity': 1,

    # this data you can get from user profile or from custom user model
    payment_details = {
        'country': 'Russia',
        'city': 'Moscow',
        'address1': 'Moscow, Arbat',
        'zip': '121099',
        'first_name': 'Ivan',
        'last_name': 'Ivanov',
        'email': '',
        'phone1': '+79031234567',
        'total_amount': 1.11,
        'user_token_id': 1,
        'productId': 1,

    form = G2SForm(items_list, initial=payment_details)
    return render(request, "g2s/order.html", {"form": form})

In “order.html”:

{{ form.render }}

After payment G2S sends a signal to your server (DMN URL). The transaction will be saved in the database, then will be send a signal. You can use it to process your own actions (add amount to users account, etc..)

from django.forms.models import model_to_dict
from g2s.signals import g2s_payment_was_successful
from pprint import pprint

def transaction_result(sender, **kwargs):
    if sender.Status == 'APPROVED':

    transaction_result, dispatch_uid="demo.models.transaction_result")

Demo installation:

$ pip install virtualenvwrapper
$ source /usr/local/bin/
$ mkvirtualenv django-gate2shop
$ git clone
$ cd django-gate2shop
$ python develop
$ cd demo
$ pip install -r requirements.txt
$ python syncdb --noinput && python migrate --noinput
$ python runserver >& /tmp/runserver.log &
$ xdg-open

Full Gateway Specification available at:

Release History

This version
History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(13.3 kB) Copy SHA256 Hash SHA256
Wheel 2.7 Sep 5, 2014
(14.7 kB) Copy SHA256 Hash SHA256
Source None Sep 5, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting