Setting up a PayPal Sandbox Account

March 29, 2011

I’m trying to get my webapp set up to accept payments via PayPal. Trying to get it set up was a bit overwhelming, just because of all the PayPal options out there. So here’s a quick walkthrough on how to set up a sandbox account for Website Payments Standard, the simplest way to just add a single Buy Now button to your web site.

Note: you do not need to have a real PayPal Business account set up in order to set up a sandbox account. They’re totally separate.

  1. Go to developer.paypal.com.
  2. Click “Sign Up Now”, and fill in your information to register. This creates a developer account. You can use this to create multiple test accounts. For example, if you wanted to test a setup where you’re paid via bank account, and another setup where you’re paid via credit card, you could set up one test account for each. You sign into developer.paypal.com with your developer account, and you will sign into http://www.sandbox.paypal.com with your test accounts.
  3. Once you’re logged in to developer.paypal.com under your new developer account, click “Create a preconfigured account”.
  4. Choose the “Seller” account type, then enter any other information you’d like.
  5. Once that account is created, go to the Test Accounts tab. This will list your sandbox accounts, showing the e-mail address login for each.
  6. Click “Enter Sandbox Test Site” to be sent to www.sandbox.paypal.com (or you could just go there manually).
  7. Sign in using your test account.
  8. When you’re logged in here, a warning: make sure the address of the site always says http://www.sandbox.paypal.com. I clicked a certain link and was incorrectly sent to the production PayPal site, so that could have been unfortunate.
  9. On the top tab bar, click “Products & Services.”
  10. Then click “Get Paid” on the bar below that.
  11. Scroll down to find the “Add Payment Buttons” link and click it.
  12. Click the “Setting Up” tab in the middle of the page.
  13. Choose the style of button you want, and click it.
  14. Make sure you’re still on http://www.sandbox.paypal.com–if not, go there and start over.
  15. Follow the instructions on the screen to customize your button. In particular, under Step 3 you may want to enter a success and cancel URL to send users to, so they can get back to your app and so your app gets information about the purchase.
  16. Click “Create Button” and you’ll be given the code for your button. That’s it!

When you’re ready to create your real business account, it’s easy: just go to paypal.com, click Sign Up, choose Business account, create it, then start at step 9 above and go through the same steps to create the production version of your button.


Running JUnit 4 Tests in Maven

December 8, 2010

I was trying to convert my JUnit tests to JUnit-4-style annotations, and they would run fine individually in Eclipse, but the Maven Surefire plugin wasn’t running them properly. Seems that it was running them using a JUnit 3 runner, because it detected tests by finding methods with “test” at the start of the method name, but ignored @Test and @Before annotations.

I read a number of articles online about how to fix this, but what they said didn’t work. Eventually, I found that I had to add the following entry exactly (can’t omit junitArtifactName, or add a version number to it).


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<includes>
<include>**/Test*.java</include>
</includes>
<junitArtifactName>junit:junit</junitArtifactName>
</configuration>
</plugin>
</code>


Follow

Get every new post delivered to your Inbox.

Join 525 other followers