Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (48 sloc) 2.137 kB
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
1 Django Shop Stripe plugin
2 ============================
3
4 A plugin to use stripe with django-shop.
5
6 http://www.stripe.com
7
8 Installation
9 --------------
10
11 Add `shop_stripe` to your INSTALLED_APPS variable in your settings.py file.
12
13 Next, add a few configuration variables in the same file:
14
15 SHOP_STRIPE_PUBLISHABLE_KEY='my-publishable-key'
16 SHOP_STRIPE_PRIVATE_KEY='my-super-secret-private-key'
17
18 SHOP_PAYMENT_BACKENDS = (
19 ...
20 'shop_stripe.offsite_stripe.StripeBackend',
21 ...
22 )
23
24 That's it!
25
26 Usage
27 -------
28
29 Thanks to Stripe.com's wonderful jscript features, it's painfully simple to integrate.
30
31 The shop_stripe plugin uses all the default django-shop templates, and the most important for our purposes is:
32
9be2826 @darkpixel Corrected minor errors in README files
darkpixel authored
33 shop_stripe/payment.html
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
34
628d44b @rfleschenberg Update README.md
rfleschenberg authored
35 Here's an example to handle Stripe test input with a Stripe.js overlay. See the Stripe documentation for details, as well as other methods of integration.
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
36
37 {% extends "base.html" %}
628d44b @rfleschenberg Update README.md
rfleschenberg authored
38
39 {% block extra_head %}
a6dd292 @darkpixel Correct path of _stripe_head.html template
darkpixel authored
40 {% include "_stripe_head.html" %}
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
41 {% endblock %}
628d44b @rfleschenberg Update README.md
rfleschenberg authored
42
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
43 {% block content %}
628d44b @rfleschenberg Update README.md
rfleschenberg authored
44 <form action="" method="POST">
45 {% csrf_token %}
46 <script
47 src="https://checkout.stripe.com/checkout.js" class="stripe-button"
48 data-key="YOUR_TEST_PUBLIC_KEY"
49 data-amount="2000"
50 data-name="Demo Site"
51 data-description="2 widgets ($20.00)"
52 data-image="/128x128.png">
53 </script>
54 </form>
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
55 {% endblock %}
56
a6dd292 @darkpixel Correct path of _stripe_head.html template
darkpixel authored
57 Note that we include _stripe_head.html, that's the heavy lifting template that just pulls in the Stripe jscript.
28c5b5b @powellc Updated readme to provide rudimentary how-to.
authored
58
59 Conclusion
60 -----------
61
62 That's really it for now. The bulk of our logic is the offsite_stripe.py file.
63
64 TODOs
65 ------
66
67 1. Allow user-configurable fields to validate. django-shop-stripe currently doesn't even check the billing address of a user (which is becoming increasingly passe with credit cards anyhow...)
68 2. Provide better, functional forms for the library. Do you know how to render id-less form field inputs with Django forms? Stripe requires that you have no IDs on inputs, which means the form data NEVER hits your server and you stay clean with the law.
628d44b @rfleschenberg Update README.md
rfleschenberg authored
69 3. Tests.
Something went wrong with that request. Please try again.