On Thu, Jan 2, 2014 at 3:52 PM, Robert Avram <robert.av...@gmail.com> wrote:

> I'm trying to figure out how to process payments using paypal python sdk
> and google app engine.
> the following code seems to work, but I can't figure out, based on the
> SDK, how to handle the exceptions (wrong credit card number etc).
> I would like the customer to be able to see the error. I would appreciate
> any input! thanks!
>


You can do this (at the bottom of your code):

*if payment.create():*
*  # Preapproval successful, redirect the customer to the approval URL.*
*else:*
*  # Payment failed*
*  self.response.write(payment.error)*

*Payment.error* holds the reason why the preapproval failed, but you may
want to do some post-processing to clean up the error text and present a
more user-friendly response.


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to