Coder Social home page Coder Social logo

dj-stripe's Introduction

dj-stripe

image

image

image

Django + Stripe Made Easy

Documentation

The full documentation is at http://dj-stripe.rtfd.org.

Features

  • Subscription management
  • Designed for easy implementation of post-registration subscription forms
  • Single-unit purchases (forthcoming)
  • Works with Django 1.6, 1.5, 1.4
  • Works with Python 3.3, 2.7, 2.6
  • Works with Bootstrap 3
  • Built-in South migrations
  • Dead-Easy installation
  • Leverages in the best of the 3rd party Django package ecosystem
  • djstripe namespace so you can have more than one payments related app
  • Documented (Making good progress)
  • Tested (Making good progress)

Constraints

  1. For stripe.com only
  2. Only use or support well-maintained third-party libraries
  3. For modern Python and Django

Quickstart

Install dj-stripe:

pip install dj-stripe

Add djstripe to your INSTALLED_APPS:

INSTALLED_APPS +=(
    "djstripe",
)

Add the context processor to your TEMPLATE_CONTEXT_PROCESSORS:

TEMPLATE_CONTEXT_PROCESSORS +=(
    'djstripe.context_processors.djstripe_settings',
)

Add your stripe keys:

STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "<your publishable test key>")
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "<your secret test key>")

Add some payment plans:

DJSTRIPE_PLANS = {
    "monthly": {
        "stripe_plan_id": "pro-monthly",
        "name": "Web App Pro ($24.99/month)",
        "description": "The monthly subscription plan to WebApp",
        "price": 2499,  # $24.99
        "currency": "usd",
        "interval": "month"
    },
    "yearly": {
        "stripe_plan_id": "pro-yearly",
        "name": "Web App Pro ($199/year)",
        "description": "The annual subscription plan to WebApp",
        "price": 19900,  # $199.00
        "currency": "usd",
        "interval": "year"
    }
}

Add to the urls.py:

url(r'^payments/', include('djstripe.urls', namespace="djstripe")),

Run the commands:

python manage.py syncdb

python manage.py migrate  # if you are using South

python manage.py djstripe_init_customers

python manage.py djstripe_init_plans

If you haven't already, add JQuery and the Bootstrap 3.0.0 JS and CSS to your base template:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">

<!-- Latest JQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

Also, if you don't have it already, add a javascript block to your base.html file:

{% block javascript %}{% endblock %} 

Start up the webserver:

Running the Tests

Assuming the tests are run against PostgreSQL:

createdb djstripe
pip install -r requirements_test.txt
coverage run --source djstripe runtests.py
coverage report -m

Follows Best Practices

Two Scoops of Django

This project follows best practices as espoused in Two Scoops of Django: Best Practices for Django 1.6.

Similar Projects

dj-stripe's People

Contributors

almost avatar audreyfeldroy avatar buddylindsey avatar ctrengove avatar dollydagr avatar ipmb avatar kulbir avatar luismmontielg avatar myusuf3 avatar nigma avatar pydanny avatar shvechikov avatar sromero84 avatar sunliwen avatar

Watchers

 avatar  avatar

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.