All Projects → mjhea0 → django-stripe

mjhea0 / django-stripe

Licence: other
Django + Stripe + User Registration

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

django-stripe

Use this project/app to integrate Django and Stripe with a simple user registration. Registration requires that a payment (either one-time or recurring) is made.

  • Django==1.5.1
  • South==0.8.1
  • py-bcrypt==0.3
  • requests==1.2.3
  • stripe==1.9.2

Setup

  1. clone the repo
  2. setup/activate a virtualenv
  3. install the requirements
  4. update the rdms (sqlite, mysql, postgres)
  5. sync the db / setup a superuser
  6. update your stripe api keys
  7. choose your billing method (see below)

Billing Method (edit payments/views.py)

  • subscription

      customer = stripe.Customer.create(
          email = form.cleaned_data['email'],
          description = form.cleaned_data['email'],
          card = form.cleaned_data['stripe_token'],
          plan="gold",
      )
    

    make sure to setup a plan on stripe

  • one time

      customer = stripe.Charge.create(
          description = form.cleaned_data['email'],
          card = form.cleaned_data['stripe_token'],
          amount="5000",
          currency="usd"
      )       
    

    make sure to update amount and remove the ability to edit the customer's credit card info from user.html

Todo

  1. create better documentation
  2. add unit tests

Screenshot

djang-stripe

Project structure

├── manage.py
├── payments
│   ├── __init__.py
│   ├── admin.py
│   ├── forms.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── project_name
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── static
│   ├── application.js
│   ├── jquery.js
│   ├── jquery.min.js
│   └── jquery_ujs.js
├── templates
│   ├── base.html
│   ├── cardform.html
│   ├── edit.html
│   ├── errors.html
│   ├── field.html
│   ├── home.html
│   ├── register.html
│   ├── sign_in.html
│   └── user.html
└── test.sqlite
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].