ASP.NET PayPal Control for Website Payments Standard
Online Documentation.

Skip Navigation Links.

Multiple-Item Payment: Upload Complete Cart Button

With shopping carts, buyers select multiple items and pay for them with a single payment. A shopper browses your entire catalog of products and adds the ones for purchase to a virtual shopping cart. Buyers review the items in their carts before checking out and making their payments. Shopping carts comes in two basic forms: 

- The PayPal Shopping Cart,  which is hosted by PayPal 
- Third party shopping carts that are compatible with PayPal and that integrate using Website Payments Standard.

Instead of relying on the PayPal Shopping Cart, many merchants use third party shopping carts that integrate with PayPal. This section describes how developers of third party carts integrate with PayPal using ASP.NET PayPal Control for Website Payments Standard.

There are two ways to integrate your third party shopping cart with PayPal and Website Payments Standard:

  1. Pass the details of the individual items. 
  2. Pass the aggregate amount of the total cart payment, rather than the individual item details.

 

By the way, If you did not upgrade your account to a Premier or Business account, you cannot receive payment. So, you should upgrade your PayPal account before you do any experiment with Website Payments Standard features. You can do this easily through the account itself by logging in and visiting https://www.paypal.com/us/cgi-bin/webscr?cmd=_business-upgrade-info

 

Passing Individual Item Details to PayPal:

If you code your third party shopping cart to pass individual items to PayPal, information about the items is included in buyers’ and the merchants’ transaction history and notifications.

  1. Drag and drop an instance of the Upload Complete Cart Button  control from your Visual Studio Toolbox to your web form as shown below:


  2. The first property of this control that you need to set is your Business Email Address or Merchant ID. Merchant ID is an alternative to using your Email address. It is better not to expose your business email address in order to protect your Email Inbox from SPAMs. You can get your Merchant ID from your PayPal account's Profile section. You can set either Business Email or Merchant ID from the Smart Tag or from the Property Editor.

  3. Now, you would need to populate the Collection type property named PayPalCartItems. You can populate this Collection type property either in DesignMode or RunMode. It is more practical that you programmatically populate this property in RunMode based on the present cart items selected by your customer in your third party shopping cart. DesignMode population is useful if you want to test and debug your web application. For example, please see the following screenshot, you see that PayPalCartItems collection property has rich design time support where you can populate the property with some values and Run the WebApplication and see if the items information is passed to PayPal as individual items.



    If you want to set this value programmatically in the run mode, you can use snippets like this : Assume that the instance of the control in the page is named by "btnUploadCompleteCart".

     
  4. Your are all set. If you already have eady have provided the LicenseKey  from the design mode Smart Tag, then the post data will be submitted to PayPal Website otherwise, the post data will be submitted to PayPal Sandbox. 


Click Event:

You may want to set the properties of your "Upload Complete Cart" Button after the customer has clicked the Button. If you attach an event handler to this event, then the event handler method will be executed before the data is transmitted to PayPal. The previous code example shows an usage of Click Event for the purpose of Upload Complete Cart Button.

Additional properties that you may want to set for your Upload Complete Cart Button:

In addition, you may want to set additional properties like Buyer Information, PayPal Display Page styles, IPN handling options, PDT authentication Token if you want to handle PDT, Form Submission settings like if post Target = "_blank" or "_top" etc. This control comes with a rich set of properties, collection classes, composite properties etc. You can easily explore those properties from Visual Studio Property Editor or Intellisence in code file or directly from the class reference.

Here is a screenshot of the Visual Studio Design Time Wizard for setting Visual Styles of the PayPal page.


Please note: If your account is not upgraded to a Premier or Business account, then, you will not see any affect of these styling properties for PayPal page. For example, if you set a header image url, you will not see that image when you click the Upload Complete Cart button and taken to PayPal website. You will see your email address as the header of the page. 

 

Not only PayPal related properties, you can also set Image Button related properties like Image URL, Border Color, Border Width etc from the property editor.

 

Passing the Aggregate Shopping Cart Amount to PayPal:

You can aggregate your entire shopping cart and pass the total amount to PayPal. You must post a single ItemName for the entire cart and the total price of the cart contents in Amount as though it were a purchase of a single item. In order to do that, you have 2 options:

  1. Using BuyNow Button Control: You can use an instance of a BuyNow Button Control and set property ItemName to be the shopping cart name and the property Amount to be the total Amount.

  2. Using Upload Complete Cart Button Control: You can an instance of this Upload Complete Cart Button and follow the technique for passing individual item details to PayPal where add only one item in the PayPalCartItems collection.

Handling Instant Payment Notification (IPN) from PayPal:

Instant Payment Notification is a mechanism by which you receive transaction data, and it allows you to integrate PayPal payments with your website’s back-end operations. Once you have programmed your "Upload Complete Cart" Button so that your customer can submit it to PayPal, you can handle Instant Payment Notification (IPN) for the transaction related to the "Upload Complete Cart" Button. It is very easy when you have this control as you wont have to do any change in your PayPal profile but handle IPN_Notified event and attach an event handler method. This control will send necessary information to PayPal so that IPN is activated and processed. Only you need to make sure that you have a PayPal premier or business account rather than just a personal account. Please Click here for learning IPN handling in details.

In order to configure IPN related settings for your "Upload Complete Cart" button, please follow the following wizard screen shot:


 

Programming "Thank You for Payment" Page:

Whenever your customer is transferred back to your website from PayPal website after completing or cancelling a payment (pursuant to submission of your "Upload Complete Cart" button), you can execute post payment business logic on your website by handling Payment Data Transfer (PDT). This control is capable of firing an event named PayPal_Returned whenever your customer is returned to your website from PayPal website. You can program this "Return page" very easily when you have this control. Please Click here for learning PDT handling in details.

In order to configure PayPal return/PDT related settings for your "Uploade Complte Cart" button, you can follow the following screenshot of the design time wizard:

 

Still Confused ?

If you are still confused, please check the sample application that comes with the setup.exe file you have downloaded from our website. Also please do not hesitate to ask us as many questions as you want from our Help Desk