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

Skip Navigation Links.

Single-Item Payment: Donation Button

Donation buttons are suitable for single-item payments. You can use a Donation button to Collect contributions to your cause on your website, Enable donors to choose the amount of their secure donation or set donations to fixed amounts. Good for non-profit and advocacy groups.

If you already have a PayPal account and if you have obtained this Control (ASP.NET PayPal Control for Website Payments Standard), you are just few steps away from collecting money from your donors using the features of PayPal Website Payments Standard.

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

In order to start collecting money using a Donation Button, please follow the following steps:

  1. Drag and drop an instance of the Donation button control from your Visual Studio Toolbox 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 may want to set few more properties like Predetermined Amount, Donation Name, Donation Number etc and you can do all of these using the Button Wizard which can be invoked by clicking the link found in the Smart Tag as shown in the following ScreenShot.


  4. Furthermore, you may choose to set the visual styles and PayPal page behaviors for the buy now button. Just click the button "Next" shown in the wizard and you will be taken to configure the display page as shown in the following screenshot.


    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 Donation button and taken to PayPal website. You will see your email address as the header of the page.

  5. 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. While you are configuring your Donation Button so that your customer can submit it to PayPal, you can setup options for handling Instant Payment Notification (IPN) for the transaction related to the Donation Button too. 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.

    Go to Step 3 by clicking the Next Button for setting up IPN related properties.



  6. 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 Donation 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.


    Go to Step 4 by clicking the Next Button for setting up PayPal return / PDT related properties.


     

  7. If you want to set this value programmatically in the run mode, you can use snippets (C#.Net) like this : Assume that the instance of the control in the page is named by "btnDonation".



  8. If you already have provided the LicenseKey  from the design mode Smart Tag, then you are ready to accept donations from your donors from this page. If you run this page, the customer will be able to click the button and then he/she will be taken to PayPal website immediately and your customer will be asked to donate 10.50$ by PayPal. If you did not provide the License Key yet, your donor will be taken to PayPal SandBox.


Click Event:

You may want to set the properties of your Donation Button after the customer has clicked the Button. For instance, in your web form, you may have a text box asking your donor's name. So, if the button is clicked, you can set DonationNumber by the name of the donor and send the information to PayPal. In order to do that, this control has an event named "Click". It is similar to any standard ASP.NET button control's Click Event as shown in the following figure:

 

If you attach an event handler to this event, then the event handler method will be executed before the data is transferred to PayPal.

 

If your textbox for your Donor's name has ID = txtDonorsName and if you want to set DonationNumber with the name of your Donor then, then following snippet (C#.Net) shows how to perform this task within Click Event Handler:

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.


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