itemshop provides a Flask (>=0.8) blueprint that you can mount in your app to get a simple purchase flow for a single item.

Payments are handled using stripe. The credit card information is processed in the browser using stripe.js, so you don’t need to handle sensitive info server-side. The server-side code takes the stripe_token obtained from stripe.js, then uses the stripe python API to actually make the charge.

Demo site

There is a demo site running here:

The demo is running in stripe’s test mode, which means only this test credit card info will work:

  • Credit card: 4242-4242-4242-4242
  • CVC: any 4 digit number
  • Expiration date: any date in the future


If you clone the repository you will see a demos directory with example uses of ItemBP. Each demo is meant to be a standalone application, they do not depend on each other or any other libraries, except for some shared static files (JS and CSS). Here are the current demos:

  • 01-simplest: Very simple usage of ItemBP. Creates a new ItemBP then mounts it at the root of a flask app.
  • 02-two-items: Shows how multiple ItemBP objects can be instantiated and mounted at different URLs on the app. Also shows how templates can be overridden for a specific item.
  • 03-secure-download: Shows how to inherit from ItemBP to add new behaviors and new routes: 1. Adds a receipt code. 2. Uses that receipt code to make a download link for a PDF. The PDF can only be accessed with a valid receipt code.

API documentation


Table Of Contents

Related Topics

This Page