views:

702

answers:

1

I am looking at using PayPal as a payment option for my custom shopping cart I have built. I already have a cart set up, and a checkout 'complete'. It asks the user for their address. Once they have completed all the fields, they hit 'Pay with PayPal'. This does not send them to PayPal yet. First it processes the data they entered, THEN redirects them off to PayPal to pay.

This is all using PayPal Express Checkout.

The desired flow is something like this.

  1. The user adds items to the cart. All this happens and is already handled by my server, with no calls to PayPal. I want the user to manage the cart on MY WEBSITE, not PayPal.
  2. Once finished, the user hits 'checkout'. This then takes them to another page on my server (for example http://mywebsite.com/store/checkout/) where they confirm their shopping cart and enter their shipping address and other details.
  3. Once they finish that, they click a 'Pay with PayPal' button and are sent to another page on MY server (for example, http://mywebsite.com/store/checkout/pay/) where my web application processes the order and information and adds it to the database. Now, HERE is where I want the paypal magic to happen.
  4. During the processing of the previous page (step three), I want my web application to contact paypal using the SetExpressCheckout API and redirect the user to the PayPal payment page.
  5. The user enters their credit card or PayPal details and pays on https://paypal.com.
  6. The user is then sent back to my website to be told that payment has been received (if it has) or any other alerts that they need to be aware of. The order status is updated accordingly and the order is shipped off.

I am quite sure this is all possible. Is it? I am using Python and Django.

My only problem is that I do not want the users to have to enter their shipping/payment address TWICE (once on my website, once on the paypal payment website). I do not want the user to have to enter their shipping/payment address at the PayPal payment website. There is no need for this as I already have it. Is it possible to remove the address fields from the PayPal website, or just pre-fill them with data from my website?

+1  A: 

Yes, there is an option in the Paypal API to override the address input. See here:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing#id0864F070OHS__id0864H804030

Relevant info copied here for convenience:

To override the shipping address:

Set the ADDROVERRIDE parameter to 1 in the call to SetExpressCheckout.
Set the following shipping address parameters in the call to SetExpressCheckout to the address values you want to use for the new address.

SHIPTONAME
SHIPTOSTREET
SHIPTOCITY
SHIPTOSTATE (Optional)
SHIPTOCOUNTRYCODE
SHIPTOZIP
SHIPTOSTREET2 (Optional)
Amber