There are three different PayPal-related sites that you’ll deal with. The first and most obvious is the real PayPal, at www.paypal.com. Before the site goes live, you’ll need a PayPal account there, representing the site. You’ll recreate your button there, and you’ll see your transactions there.
There are two sites used as part of the testing process. The first is the Sandbox, at http://developer.paypal.com. To create and use test accounts, you’ll register at the Sandbox with a real email address, and then log in. To use those sample accounts to test your site, you’ll need to remain logged in to the Sandbox (in the same browser).
The last site you’ll use is the Sandbox Test Site at www.sandbox.paypal.com. This site looks and functions exactly like the real PayPal, except that it says “Test Site”
and “Sandbox” here and there.
As you read the rest of this chapter, pay close attention to which PayPal site I refer- ence at each step. Make sure that the URL in your browser matches each instruction appropriately.
Registering at the PayPal Sandbox
The PayPal Sandbox is a replication of the real PayPal, but you create and control the cast of characters. To use it, you’ll need to register with a real email address and password to create a Sandbox account, then you can use that account to create fake buyers and sellers.
1. Go to https://developer.paypal.com.
2. If you do not already have a PayPal Sandbox account (which is not the same as a PayPal account), create one by clicking Sign Up Now.
3. Complete the simple registration form (Figure 6.2).
PayPal recommends that you use a different email address and password than your actual PayPal account, for security sake.
ptg Figure 6.2
4. Check your email.
After registering, you’ll receive an email with a link that you must click to activate your account.
5. Click the link in the email to activate the account.
6. Log in to the PayPal Sandbox using your email address and password.
Creating Test Accounts
Once you’ve registered and logged in to the Sandbox, the next step is to create at least two accounts: one merchant (the business) and one personal (the customer).
1. Log in to the PayPal Sandbox, if you have not already.
2. Click the Test Accounts link.
At the time of this writing, there are only four main areas of the Sandbox, aside from the home page.
3. Click the Preconfigured link beside the Create Account label (Figure 6.3).
Figure 6.3
tip
You can ignore the fact that Fig- ure 6.3, and perhaps your own experience, has PayPal showing Website Payments Pro.
ptg You can create test accounts in two ways: preconfigured or manually. If you
choose preconfigured, then the site will generate almost all the account information for you automatically, such as the email address, password, physical address, and more. If you choose the manual option, you’ll need to provide all this information.
4. On the Create a Sandbox Test Account page, create a Seller account (Figure 6.4).
Figure 6.4
You’ll need to indicate the seller’s country and the account type first. For the login email, use any meaningful six characters, and please note that this is not an actual email address; a temporary one will be created by the Sandbox using this value. You may want to use just “seller.” The password will be generated for you automatically, and you can leave it as is.
It’s up to you whether to add a credit card and/or a bank account balance or not. For the merchant, neither is required, although by adding one or both, the account will be marked automatically as verified (in the PayPal Sandbox world).
5. Click the Create Account button.
6. Repeat Steps 3-5 for one or more buyer accounts.
For the buyers, you’ll need to create one or more with a positive bank account balance and/or a credit card. For full testing, you can create a buyer with insufficient funds, too, or buyers from other countries.
tip
Write down every password, because you will need them for the test account.
tip
If you create a buyer account without a credit card or bank account or with insufficient funds, that buyer account will pay using pretend e-checks.
ptg Each account you create will be listed on the Test Accounts page (Figure 6.5).
Figure 6.5
Creating a Button
Once you’ve created two or more accounts, you can add a fake PayPal button to your Web site to simulate the e-commerce transactions. This is arguably the most important sequence of steps, because you’ll perform these same actions for real when you take your site live.
1. On the Sandbox Test Accounts page (see Figure 6.5), select the seller account and click the Enter Sandbox Test Site button.
By taking this step, you’ll be able to enter fake PayPal as one of the test users. Using the PayPal Sandbox Test Site, you can perform the same tasks that real PayPal users perform: check account balances, review transactions, update account details, and, for merchants, create buttons for selling prod- ucts and services.
2. In the pop-up window that appears, log in using the seller account.
The results of Step 1 will create a pop-up window that looks like the regular PayPal site, plus the words “Sandbox” and “Test Site” scattered about.
You’ll also see that the email address associated with the account selected in Step 1 will be entered automatically into the login form.
3. Click the Merchant Services tab.
4. Under Create Buttons, click Subscribe.
5. On the Create PayPal payment button page, enter an item name (Figure 6.6 on the next page).
tip
Once created, an account’s details can be updated after log- ging in to the Sandbox Test Site (using that account), as if it were a real PayPal account.
tip
In the PayPal Sandbox, all pay- ments succeed without being reviewed unless you enable pay- ment review for an account.
ptg Figure 6.6
The button type should be selected automatically (as a subscription). You may or may not want to change the currency, too.
6. Further down under Step 1 of the form, enter a billing amount and cycle period (Figure 6.7).
The billing amount is obviously the most important consideration. The billing cycle is for how long that billing amount covers. You can choose to have automatic billing stop after two or more cycles, or never.
7. Opt to use your secure merchant account ID (see Figure 6.7).
8. Under Step 2 of the form, make sure that the Save button at PayPal option is selected (Figure 6.8).
Figure 6.8
9. Under Step 3 of the form, indicate that you don’t need the customer’s shipping address.
If you were selling a physical product, you’d want the user to confirm the shipping address in PayPal. You could then use PayPal to generate the shipping label for you, taking the cost out of the money already trans- ferred to your account.
10. Also under Step 3 of the form, supply the “cancel” and “finish” URLs, and select the corresponding check boxes (Figure 6.9).
These two values must point to pages on your server, available via HTTPS. The two scripts will be created later in this chapter to be named cancel.php and thanks.php.
11. Click Create Button.
tip
In this first part of the form, you can also change the text and look of the button.
Figure 6.7
tip
If you save your button with your PayPal account, it’ll be more secure and easier to update.
Figure 6.9
ptg 12. On the next page, copy the generated code (Figure 6.10).
Figure 6.10
This is the code to be integrated into the site, which you’ll do next.