PayPal Sandbox: how to use it properly
Escrito por:Rubén Muñoz
PayPal is one of the safest payment methods available on the Internet, no one doubts today. More and more the pages they want to use PayPal on their websites, and more and more users are grateful to these pages that implement the payment gateway PayPal. But one of the first questions of the developers and / or vendors when implementing PayPal in the system is clear: how I can prove that payments are made correctly? Answers to this question are two: first, most obvious, which is creating items whose price is 0.01 €, for actual payments and see if the system works. What entails having to play with money, small amounts it is, and that’s not always like. The second, somewhat unknown, does not involve actual payments: [def] PayPal Sandbox [/ def] .
Important (19/03/2013) : PayPal has totally changed the way we use Sandbox and developer tools. This tutorial is in part outdated, but is provided to give a general idea of how the system works. We recommend you read first PayPal Developer changes , and give us a little time to update our tutorials. Sorry for the inconvenience, thank you for trusting us.
Update (29/03/2013) : We have posted a new tutorial aimed at testing new site PayPal Developer. You got here: New PayPal Developer Tutorial . Obsolete parts of this tutorial you will see them
What is PayPal Sandbox?
PayPal Sandbox is neither more nor less than a copy of PayPal, everything works exactly the same, except for two things:
- PayPal accounts can not be used with PayPal Sandbox, and vice versa.
- All the money that moves in PayPal Sandbox is fictitious. Do not specify or credit cards or anything like that, it’s all dummy data, testing, and money, “toy”. As if you paid in your store with Monopoly bills.
Otherwise, PayPal and PayPal Sandbox are clones.
In addition, PayPal Sandbox features an administration panel from which you will manage the various accounts we believe. But step by step, first things first.
Checking into the system As already mentioned, PayPal accounts not serve us in PayPal Sandbox, so no matter whether we realize it or not in PayPal touches register here: https://developer.paypal.com/ . It is quite clear about one thing: Is PayPal, but it is not. It says “Sandbox” everywhere. Clicking on the button “Sign Up Now” will access the registration form. I will fill and send us an activation link to the email we have specified. We finished the registration process by selecting the account from this link. If we see this, great! Now we accessed from the blue box “Member Log In”.
Managing our users Now change the chip. The email we just recorded is not what we use to receive or make payments. It’s a simple username to access the system Sandbox. Within the system we can create accounts for such purposes, which we are very interested, and we can have a mind “personal” and a “business”, for example, to pay and to receive payments as a company. Test accounts: Accounts tests. Here we will create new accounts to use in our proof of payments. Test email: When we make or receive a payment, PayPal generates and sends an email to both the receiver and transmitter. If the accounts are fictitious, Where get these emails? Well, mail trays our test users are here. API and Payment Card credentials: Adjustments and settings necessary when using PayPal Payments Pro or Express Checkout, or a credit card instead of PayPal. Test tools: Here you will find interesting tools for testing. Specifically Two: Campaigns & Incentives simulator and IPN Simulator. For now, we will create two users, because without them we can not do anything. Why two? Because we need an account of type “Custom” which will serve as a fictitious customer in our shop, and other business account of type “Business” to receive payments. To save lots invent and introduce fictitious information, look for “New test account” and click “Preconfigured”. For personal account, choose: Country: Spain. Account Type: Buyer (the first). First Name and Last Name: Full Name, put what you see. Login Email: A fictitious email we will use to pay PayPal Sandbox system. It allows 6 characters, then PayPal will write more. Password: You can set up a new or point and leave the default one. Add Credit Card: We can leave it at Visa. Add Bank Account: We leave to “yes”. Account Balance: Funds account. Make sure you give him enough room to make many payments of amounts you go to manage. Do not let him 300 euros in the background if you want to try items from 1500 euros. Then we can “reset” these values, but not modify (ie, whenever the account reseteemos back to the initial background we establish now). Notes: not necessary. Now click on Add account and we have a personal account. Repeat the process to create the business account, but select a few different things: Country: Spain. Account Type: Sellers. First Name and Last Name: Full Name, put what you see. Login Email: A fictitious email we will use to collect the PayPal Sandbox system. It allows 6 characters, then PayPal will write more. Password: You can set up a new or point and leave the default one. Add Credit Card: We can leave it at Visa. Add Bank Account: We leave to “yes”. Account Balance: Funds account. Notes: not necessary. We have added two accounts. Look at the detail that the personal account before the @, just in _per, and business account in _biz . These accounts are the ones that we use in our transactions. We can create as many accounts as you want, but for now use two. To access the settings for each account, simply select it, and then press the ” Enter Sandbox Test Site “. This will open a new popup a login box in PayPal Sandbox. We must sign one of the two accounts we just created .
The Business Account The Business account is the use in the business. From here we will see payments received, the balance available, and we can set preferences for payments, notifications, etc.. IPN settings (and also some other more relevant) the you can see in our previous post on PayPal IPN , in the part called “Configuring PayPal”. Remember that PayPal takes a commission from each payment charge, so here in the Sandbox, we will see that reflected: each payment reaches us, we will come to this committee and subtracted. When you are sending the information from the seller on PayPal buttons, or in our plugins or add-ons, is the business account which we set as payment receiving account.
The Personal Account This is the account you use to make trial payments on our website. Is the “client” to access our store and purchase one or more items. While I have loaded money account, but we can always reset the account. From the test site can see the movements you have made and your remaining balance available.
Reset an account If we return to an account in its initial state of movement and backgrounds, just go to PayPal Sandbox and look in the account the “Reset” (in the right column). We will open a form to reset certain values. This action also changes the password , if you do not want to change, you had already Establish the start.
The emails inboxes It is true that when a customer buys something at a store and pay with PayPal, the customer will get an email confirming your payment, and the seller, another confirming receipt of payment. If we see that this is true, how do we do if our accounts are fictitious? In the left menu, the link “Test email” Inboxes are the accounts we have created. Here are the emails we wanted to see. Yes, they are mixed, so we have to look at the “To” to know who it is for each email.
Simulating an IPN notification In “Test Tools” we have a simulator IPN notifications. This comes in handy for us to check whether our system and processed correctly supports IPN notifications without having to make purchases on our website if we wish. IPN handler URL in the URL must establish receptor IPN data from our system. We chose a type of transaction (for example, “Cart checkout” for shopping carts), and loads a form. In this form we see the usual fields a PayPal transaction which move as message type $ _POST to our website. If the fill and click on Send IPN, PayPal IPN sends a notification to the web we have specified above. We should check our web page successfully processed though PayPal itself will return a success or failure message in the process of sending IPN.
Use PayPal Sandbox means that you have to make a couple of changes in our code so that when you enter the payment gateway, a gateway will redirect to PayPal Sandbox, and not an actual PayPal.
If you use a component or a plugin that gives you the option to enable test mode (or PayPal Sandbox), activadlo. If you do not use any plugins, or your plugin do not offer this option, we will have to go to HTML PayPal button. This will have a line like this:
<form action="https://www.paypal.com/cgi-bin/webscr" method='post' name='paypalform' />
We must change the URL to look like this one:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method='post' name='paypalform' />
This will make the payment through the PayPal site testing, and not the actual PayPal. Remember to change it back when you open the store to the public.
Made this change, we must set up the account of the person receiving the payment. Again, if you use a plugin that allows you to configure, establecedlo there. If not, to tweak the code: it’s in a hidden field (hidden) the button called “business”. Here we set the account business (finished in firstname.lastname@example.org) you provided PayPal Sandbox.
Technically, it’s all ready for you to do your tests.
“There is no reason for an individual to have a computer in their home”
– Ken Olson, President of Digital Equipment Corporation in 1977