Thank you, Joseph and Andrew!
I'm Japanese university student and try django oscar with stripe.

I refer to your advise but i can't send the data to stripe dashboard...

2017年1月5日木曜日 14時00分22秒 UTC+9 Andrew Edwards:
>
> Awesome post Joseph!
>
> I just wanted to update this for as of this post's creation time. I had to 
> modify the end of the Facade class with:
>
> except stripe.error.CardError as e:
>     raise UnableToTakePayment(self.get_friendly_decline_message(e))
> except stripe.error.StripeError as e:
>     raise InvalidGatewayRequestError(self.get_friendly_error_message(e))
>
>
> instead of:
>
> except stripe.CardError, e:
>     raise UnableToTakePayment(self.get_friendly_decline_message(e))
> except stripe.StripeError, e:
>     raise InvalidGatewayRequestError(self.get_friendly_error_message(e))
>
>
> ***If you don't follow this next step, the transaction will never 
> complete.***
> I also had to add to my preview template in the block 'hiddenforms':
>
> <div style="display:none">
>     {% block hiddenforms %}
>         {{ stripe_token_form }}
>     {% endblock %}
> </div>
>
> This allowed the stripe payment details to persist to the preview page and 
> so when the user clicks the place order button the payment is actually 
> taken from the card.
>
> One other thing I had to do was modify the else statement of the 
> get_context_data method in your local PaymentDetailsView class such that 
> the total price appears in the 'Pay' button of the Stripe form when you are 
> entering payment details on the payment details page:
>
> def get_context_data(self, **kwargs):
>     ctx = super(PaymentDetailsView, self).get_context_data(**kwargs)
>     if self.preview:
>         ctx['stripe_token_form'] = forms.StripeTokenForm(self.request.POST)
>         ctx['order_total_incl_tax_cents'] = (
>             ctx['order_total'].incl_tax * 100
>         ).to_integral_value()
>     else:
>         ctx['order_total_incl_tax_cents'] = (
>             ctx['order_total'].incl_tax * 100
>         ).to_integral_value()
>         ctx['stripe_publishable_key'] = settings.STRIPE_PUBLISHABLE_KEY
>     return ctx
>
>
> Hope this helps someone!
>
>

-- 
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
--- 
You received this message because you are subscribed to the Google Groups 
"django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-oscar+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/django-oscar/b2deb68b-181d-4e61-a71d-5f1ccb03481f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to