Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated the stripe docs.

  • Loading branch information...
commit 023ef61f8500ec1af19156400c6f1af52f64519f 1 parent 3df6217
@theju theju authored
Showing with 21 additions and 5 deletions.
  1. +21 −5 docs/offsite/stripe_integration.rst
View
26 docs/offsite/stripe_integration.rst
@@ -33,8 +33,9 @@ Here are the methods and attributes implemented on the ``StripeIntegration`` cla
(r'^stripe/', include(stripe_obj.urls)),
)
-* ``get_token(self, request)``: The view method that recieves the
-token
+* ``transaction(self, request)``: The method that receives the Stripe Token after
+ successfully validating with the Stripe servers. Needs to be subclassed to include
+ the token transaction logic.
* ``generate_form(self)``: The method that generates and returns the form (present in
``billing.forms.stripe_form``)
@@ -43,16 +44,32 @@ token
Example:
--------
+ In <some_app>/integrations/stripe_example_integration.py::
+
+ from billing.integrations.stripe_integration import StripeIntegration
+
+ class StripeExampleIntegration(StripeIntegration):
+ class transaction(self, request):
+ # The token is received in the POST request
+ resp = self.stripe_gateway.purchase(100, request.POST["stripeToken"])
+ if resp["status"] == "SUCCESS":
+ # Redirect if the transaction is successful
+ ...
+ else:
+ # Transaction failed
+ ...
+
+
In the views.py::
- stripe_obj = get_integration("stripe")
+ stripe_obj = get_integration("stripe_example")
return render_to_response("some_template.html",
{"stripe_obj": stripe_obj},
context_instance=RequestContext(request))
In the urls.py::
- stripe_obj = get_integration("stripe")
+ stripe_obj = get_integration("stripe_example")
urlpatterns += patterns('',
(r'^stripe/', include(stripe_obj.urls)),
)
@@ -66,4 +83,3 @@ Example:
.. _`Stripe Payment`: https://stripe.com
.. _`stripe`: http://pypi.python.org/pypi/stripe/
-
Please sign in to comment.
Something went wrong with that request. Please try again.