PayPal PDT Sandbox Setup

Wednesday, August 01, 2007

I recently implemented a PayPal checkout solution using Payment Data Transfer (PDT) to retrieve the transaction details. Testing the transaction process required using PayPal Sandbox, which I have used before and for which I already had my acccount set up. But when my customer wanted to do some testing, I had them set up their own Sandbox account, and was reminded that the initial setup is not simple. Eventually, I had to provide step by step instructions to get them up and running correctly.

Here are those instructions for anyone needing to go through this for the first time:
1. Go to https://developer.paypal.com/ and create a new PayPal Developer account. After confirming the account, log in and you will see:
    - Tab for Test Accounts – this is where you create Buyer and Seller accounts. A Seller account provides you with a fake online store, and a Buyer account allows you to make fake purchases from that store.
    - Tab for Test Email – this is where all the order/payment emails are sent during test purchases. The emails are contained within the Sandbox environment, not sent to external email accounts.
    - Tab for API Credentials – for a PDT application, ignore this tab completely. There is an Identity Token here, but it is not the one needed for the "PayPalPDTID” in the web.config. There is also a seller password here, but it is not the one you will use during testing.

2. In the upper right corner, click “Enter Sandbox”.
    - Log in to Sandbox using the Seller Test Account credentials. For PDT to work, go to “Profile” tab, then “Selling Preferences”, then “Website Payment Preferences” and confirm you have the following settings:
    “Auto Return for Website Payments” is on, return URL is set to http://www.yoursite.com/PDTHandler.aspx (or whatever page you use to process the transaction details.
    “Payment Data Transfer” is on. Note that this is where you get the Identity Token that should be used in the web.config.

Back in the project, you need to open the web.config and check these settings:

<appSettings>
	<add key="RootURL" value="http://localhost:xxxxx/ProjectName/"/>
		   
	<!-- Sandbox Settings -->
	<add key="PayPalServer" value="https://www.sandbox.paypal.com/cgi-bin/webscr"/>
	<add key="UseSandbox" value="true"/>
	<add key="PayPalEmailAddress" value="Seller email address used to login to Sandbox"/>
	<add key="PayPalPDTID" value="Identity Token from the Website Payment Preferences"/>		
</appSettings>

You are finally ready to run the project and make a purchase. When it redirects to PayPal, make sure it goes to https://www.sandbox.paypal.com/cgi-bin/webscr and login using the Buyer Test Account credentials. Complete the purchase and wait for it to redirect back to the project. You should have a message page advising that the transaction failed or was completed.

Finally, you can go back to https://developer.paypal.com/, enter Sandbox, login using the Seller credentials, and under My Account - History, see a report of all the transactions posted.

Comments

Leave Comment
Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!