A couple days ago I had to deal with PayPal WPP (Express Checkout) for some application and I found the module in the GitHub: https://github.com/dcramer/django-paypal.
Which works great but it was very hard to find how to set up the PayPal Payment Pro with Express Checkout method and fill customer forms in PayPal. I decided to find how to deal with it and I figured out how to do that.
After all developing stuff related to install this module to your django aplication you need to know how to send requests to PayPal using this method. And here’s the answer:
1. Do everything what you have in documention of this module (Using PayPal Payments Pro (WPP) section – https://github.com/dcramer/django-paypal)
2. Create the function in your views
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
def express_payment(request): item = { "amt": "0.00", # amount to charge for item "inv": "inventory", # unique tracking variable paypal 'currencycode': 'USD', 'shiptoname' : 'John Smith', 'shiptostreet' : 'Street 1', 'shiptostreet_2' : 'Street 2', 'landingpage' : 'Billing', 'shippingamt' : 0, 'shiptocity' : 'Las Vegas', 'shiptostate' : 'Nevada', 'shiptocountrycode' : 'USD', 'shiptozip' : '89044', # is country 'shiptophonenum' : "666-666-5948", 'addroverride' : "1", 'email' : 'john@smith.com', # "noshipping" : "0", "custom": '555', # custom tracking variable for you # of course in this case URL is your webpage URL "cancelurl": settings.URL + "error", # error page "returnurl": settings.URL + "success"} # success page amount = 50 # your items item["l_name0" ] = "Extra product #1" item["l_amt0"] = 25 item["l_qty0"] = 1 item["l_name1" ] = "Extra product #2" item["l_amt1"] = 25 item["l_qty1"] = 1 # rewrite about item['amt'] = amount kw = {"item": item, # what you're selling "success_url": "/success/"} # redirect location after success, I am not sure but it shouldn't work ppp = PayPalPro(**kw) return ppp(request) |
3. Configure your urls (urls.py)
1 2 3 |
# ... url(r'^payment$', 'some_module.views.express_payment'), # ... |
4. Go to http://your_app/payment?express and you should be redirected to PayPal
More information how to send specific requests to PayPal you can find here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPECIntegration
That’s all. Questions? Feel free to put some in the comment box.
Taras Di
/ September 4, 2012Hi,
I’ve been following the instructions with a bit of success. Do you know if it’s possible to set up WPP using a separate light box like in https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_IntegratingExpressCheckoutDG?
Thanks
strife
/ September 11, 2012Hi Taras Di,
To be honest I got no idea. I’m not familiar with this light box thing on PayPal. But if make it the answer would be great to share it somewhere
Best,
M