Skip to content
Browse files

got stripe payment gateway purchase method working

  • Loading branch information...
1 parent ba39025 commit 975ea563ae2e4e218ab1c16185f753099cc4fd3f @hayyat hayyat committed Dec 23, 2011
Showing with 8 additions and 13 deletions.
  1. +6 −11 billing/gateways/stripe_gateway.py
  2. +2 −2 example/app/views.py
View
17 billing/gateways/stripe_gateway.py
@@ -1,11 +1,11 @@
from billing import Gateway
from billing.gateway import InvalidData
from billing.signals import *
-from billing.utils.credit_card import InvalidData,Visa,MasterCard,\
+from billing.utils.credit_card import InvalidCard,Visa,MasterCard,\
AmericanExpress,Discover
import stripe
-
-class StripePaymentGateway(Gateway):
+from django.conf import settings
+class StripeGateway(Gateway):
supported_cardtypes = [Visa, MasterCard, AmericanExpress, Discover]
supported_countries = ['US']
default_currency = "USD"
@@ -21,7 +21,7 @@ def purchase(self, amount, credit_card):
raise InvalidCard("Invalid Card")
try:
response = self.stripe.Charge.create(
- amount=amount,
+ amount=amount*100,
currency="usd",
card={
'number':credit_card.number,
@@ -31,10 +31,5 @@ def purchase(self, amount, credit_card):
},)
except self.stripe.CardError, error:
- return error
- return response
-
-
-
-
-
+ return {'status': 'FAILURE', 'response': error}
+ return {'status': 'SUCCESS', 'response':response}
View
4 example/app/views.py
@@ -148,8 +148,8 @@ def stripe(request):
'amount':amount,
'response':response,
'title':'Stripe Payment'})
-
-
+
+
def offsite_paypal(request):

0 comments on commit 975ea56

Please sign in to comment.
Something went wrong with that request. Please try again.