0

I'm having some trouble understanding how I can send my shopping cart items to PayPal using the IPN service without using the 'Buy Now' buttons which many tutorials seem to demonstrate.

So my shopping cart details are stored within $_SESSION['cart'] as a multidimensional array.

e.g: 
$_SESSION['cart'][0]['item_price'] 
$_SESSION['cart'][0]['item_name']
$_SESSION['cart'][0]['item_description']
$_SESSION['cart'][1]['item_price'] ...

I know that a listener is involved for the rest of the process however I cannot see how I can send the item details such as name and cost to paypal for payment processing.

Is cURL involved in anyway. Any information would be very helpful!

Daniel West
  • 1,808
  • 2
  • 24
  • 34

1 Answers1

1

IPN stands for Instant Payment Notification. IPN itself is a POST from PayPal's servers to a page on your site to let you know that a transaction has completed (or failed).

To send a shopping cart to PayPal without using the simple button method you need to use the PayPal API. Check out the SetExpressCheckout method, which initialises a cart/checkout on the PayPal site. This will give you an ID/URL you can use to redirect your customer to at a later time.

See:

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

SystemParadox
  • 8,203
  • 5
  • 49
  • 57
  • 1
    And don't forget, Express Checkout also needs DoExpressCheckoutPayment to finalize the transaction. See also my answer in http://stackoverflow.com/questions/7984864/why-is-doexpresscheckoutpayment-required-for-paypal – Robert Nov 13 '11 at 23:10
  • Hi Robert, this has helped me make sense of the flow required for integrating PayPal however, I am interested in how you can secure the hidden inputs as this doesn't seem possible? – Daniel West Nov 14 '11 at 01:23
  • @DanielWest which hidden inputs? If you use the API (SetExpressCheckout, etc) you don't use any HTML forms. It's all done with POSTS from your server (using curl or similar). – SystemParadox Nov 14 '11 at 08:27
  • @SystemParadox Yeah you are right, then its just a case of using HTTPS to make sure the connection is secure. Thanks. – Daniel West Nov 19 '11 at 16:41