Code Monkey home page Code Monkey logo

django-clickbank's Introduction

django-clickbank

Build Status Coverage Status

django-clickbank is a pluggable django application for recieving ClickBank [Instant Payment Notifications] 1

  • Recieves and stores all notifications to the database.
  • Stores raw post data, whether notifications fails or not (configurable)
  • Formats raw CB field names into easier ones easier to work with.
  • Sends signals for each transaction type

django-clickbank is currently written for django 1.5.x and python 2.7, but it should run fine on 1.6.

The only major requirement is that you have South installed.

Installation

Installing with pip from pypi
pip install django-clickbank
Installing with pip from github
pip install -e git+https://github.com/Sureiya/django-clickbank.git
Manual Installaion
git clone https://github.com/Sureiya/django-clickbank.git django-clickbank
cd django-clickbank
python setup.py

Setup

  1. Install (see above)

  2. Add django-clickbank and South to your INSTALLED_APPS

# settings.py
INSTALLED_APPS = (
      ...
      'south',
      'django_clickbank',
      ...
)
  1. Import the django-clickbank default settings in settings.py
    # settings.py
    from django_clickbank.settings import *
  1. Add django-clickbank urls to your urls.py
urlpatterns = patterns('',
    ...
      url(r'^', include('django_clickbank.urls')),
    ...
)
  1. Run migrations
python manage.py migrate django_clickbank
  1. Setup Clickbank

    1. Login to Clickbank
    2. Navigate to Settings -> My Site
    3. To the right of Advanced Tools, click Edit
    4. Add http://yoursite/clickbank/ipn/ as a URL, you can choose 2.1 or 4.0.
    5. Create a Secret Key
    6. Hit 'Save'
  2. Update Settings with Secret Key

# settings.py
CLICKBANK_SECRET_KEY = <key generated in step 6>
  1. Setup Logging (Optional)
# settings.py
LOGGING['loggers']['django_clickbank.notications' = {
    'handlers': ['console'], # Change handlers if you want. Logging levels are DEBUG and INFO
    'propogate': True,
}
  1. Test it out.

Usage

from django_clickbank.signals import sale

def sale_callback(sender, **kwargs):
    ## Logic for processing sale

For more information on signals, see [Django Signals] 2

To view a full list of signals refer to [signals.py] 3

To view all notification fields, see [models.py] 4

Important Note

Under some circumstances ClickBank sends multiple notifications per sale (upsells). Due to the way Django signals work, its possible for notification callbacks to be processed at the same time (multithreaded server). If your callbacks could fail due to this, look into using a task queue like celergy, along with a single worker to force your callbacks to be executed 'first in first out'.

Available Settings

## Setting debug to True turns off things like secret key verification
CLICKBANK_DEBUG = False

## If set to true raw post data will be stored regardless of CLICKBANK_DEBUG
CLICKBANK_STORE_POSTS = True

## If set to true, app will still log notifications when verification fails
CLICKBANK_KEEP_INVALID = True

## When set to true, app will still send signal when invalid notification recieved.
CLICKBANK_SIGNAL_INVALID = False

## Send 200 status when a transaction is received that already exists. Mostly for debugging
CLICKBANK_IGNORE_DUPLICATES = False

Contributing

If you'd like to contribute, feel free to make a fork and send me a pull request.

License

MIT

Bitdeli Badge

django-clickbank's People

Contributors

bitdeli-chef avatar sureiya avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

mmoyles87

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.