Skip to content

Commit

Permalink
Updated the stripe docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
theju committed Jan 27, 2012
1 parent 3df6217 commit 023ef61
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions docs/offsite/stripe_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``)
Expand All @@ -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)),
)
Expand All @@ -66,4 +83,3 @@ Example:

.. _`Stripe Payment`: https://stripe.com
.. _`stripe`: http://pypi.python.org/pypi/stripe/

0 comments on commit 023ef61

Please sign in to comment.