My advice would be to use Stripe.com for processing payments. You'll be
amazed at how easy it is to get started AND customers don't have to leave
your site!
(I'm not associated with Stripe in any way... just using it with App Engine
and can attest to its ease of use)
I may re-add PayPal at some point (in addition to Stripe) but it's a pita
to deal with the user leaving your site, processing the ipn notifications,
and then HOPING the user hits the button to return to your site when he's
finished on PayPal. With PayPal there's no guarantee the user will return
to your site (although it's fairly likely). I've also noticed that the
initial redirect to PayPal can take a while (for the page to load). Just
my experience... I'm sure there are others that really like it.
On Thursday, January 2, 2014 4:52:23 PM UTC-5, Robert Avram 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!!!
>
>
> class Buy(generichandler.MainHandler):
>
> def get(self):
>
> api = paypalrestsdk.set_config(
>
> mode="sandbox",
>
> client_id="myclientid",
>
> client_secret="secret")
>
> api.get_token()
>
> paymentDic = {"intent": "sale",
>
> "payer": {
>
> "payment_method": "credit_card",
>
> "funding_instruments": [{
>
> "credit_card": {
>
>
> "type": "visa",
>
>
> "number": "4417119669820331",
>
>
> "expire_month": "11",
>
>
> "expire_year": "2018",
>
>
> "cvv2": "874",
>
>
> "first_name": "Joe",
>
>
> "last_name": "Shopper",
>
>
> "billing_address": {
>
>
> "line1": "52 N Main ST",
>
>
> "city": "Johnstown",
>
>
> "state": "OH",
>
>
> "postal_code": "43210",
>
>
> "country_code": "US" }}}]},
>
> "transactions": [{
>
> "amount": {
>
> "total": "1.47",
>
> "currency": "USD",
>
> "details":{
>
> "subtotal":
> "1.41",
>
> "tax": "0.03",
>
> "shipping":
> "0.03"}},
>
> "description": "This is the
> payment transaction description." }]}
>
> payment = paypalrestsdk.Payment(paymentDic)
>
> payment.create()
> Enter code here...
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.