That is helpful (thanks).. but I was wondering about the reference in the Cartridge release note (see the link) It mentions a Stripe payment handler?
On Tuesday, February 25, 2014 3:13:12 PM UTC-6, Josh Cartmell wrote: > > Hey Tom, is this for use with Cartridge or something else? > > If something else I have used something like the following. > > in the template: > <script src="https://checkout.stripe.com/checkout.js"></script> > <script> > $(document).ready(function() { > > var handler = StripeCheckout.configure({ > key: '{{ settings.STRIPE_PUBLIC_KEY }}', > image: '{% static "whatever_image.png" %}', > token: function(token, args) { > $('#checkout-button').prop('disabled', true); > $('#id_stripe_token').val(token.id); > $('#id_email').val(token.email); > $('#hourly-form').submit(); > } > }); > document.getElementById('checkout-button').addEventListener('click', > function(e) { > amount = cost(); > // Open Checkout with further options > > if (amount){ > handler.open({ > name: '{{ settings.SITE_TITLE }}', > amount: amount, > billingAddress: true > }); > } else { > alert('You must choose at least one service') > } > e.preventDefault(); > }); > }); > </script> > > Then in the forms clean method: > stripe.api_key = settings.STRIPE_SECRET_KEY > token = cleaned_data['stripe_token'] > try: > cleaned_data['charge'] = stripe.Charge.create( > amount=amount, # amount in cents, again > currency="usd", > card=token, > ) > except stripe.CardError: > raise forms.ValidationError("The card has been declined") > > Some of the above is a bit specific to my case (so it'll require a bit of > editing) and I'm using the stripe checkout custom integration which is > slightly more complicated but lets you specify custom buttons/images and > other options. > > Hopefully that helps. > > > On Tue, Feb 25, 2014 at 11:21 AM, Tom Brander <[email protected]<javascript:> > > wrote: > >> I saw here >> https://groups.google.com/d/msg/mezzanine-users/hFQeqVJP1S8/5C0fvvNpFg8Ja >> mention of a stripe payment handler >> Suggestions where to go next? >> Any other pointers to code or docs? >> Just trying to wrap my head around security, auth, oauth and checkout >> needs for an app.. and among other things stripe seems to be able to use >> oauth, and not sure how or if I want to?? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mezzanine Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
