Wednesday, November 24, 2010

Gotcha of the Day: Configuring a PayPal Sandbox Account for DoDirectPayment API Access

A new project I'm working on for a client calls for me to implement PayPal's Website Payment's Pro. Doing so is fairly straightforward as the API calls are little more than query string parameters passed over HTTP.

With some skeleton code in place, I started running some tests. I pointed the app to the production server and using the client's PayPal account tried to invoke DoDirectPayments. The result was error 10501:

This transaction cannot be processed due to an invalid merchant configuration

The account I was using was not still in the process of being approved by PayPal, so it seemed reasonable to get this error.

Giving the Sandbox a Try

Next up, I decided I'd setup a sandbox account for the client and utilize that. I have mixed feelings about the PayPal sandbox approach: on one hand, it's quite impressive that they offer such a complete testing environment to use, with the ability to create your own little universe of buyers and sellers. On the other hand, it's an absolute pain to use - the nested series of logins required to use it always trip myself and clients up.

In any case, I figured using the sandbox server would made perfect sense as not only was I in test mode, but also didn't want to have to wait for PayPal to complete the approval process.

I dutifully setup a new seller account, and made sure to select the website payments pro option when doing so. When it was all said and done, I ran the same transaction above and again got the same error message: This transaction cannot be processed due to an invalid merchant configuration. What the heck?

Debugging the Sandbox Setup

I poked around the sandbox area, struggling to see if there was a step I missed. I couldn't find one. Googling the error message brought up these odd exchanges between developers and moderators:

DPayPal says:
   API Username:
   Please enable my billing agreement.

   PP_MTS_Justin says:
   The Direct Payment API has now been enabled for your account.
   Thanks !

The above message is from 2007 - surely I don't need to post on a message board to activate my account, do I?

This morning, I gave my good friends at PayPal a call. After talking to 5 reps or so, I finally got to someone who broke the news to me: the sandbox site is buggy. In order to get an active user who can make calls to DoDirectPayment I'd need to work with PayPal directly. Not only that, but the user I created who was specifically set up to be a Website Payments Pro client is so broken that I needed to create a fresh user and have him modify that one.

I'm just shocked. Here's a company that's had the same critical bug since 2007 and they have yet to fix it? Or maybe it just re-appeared.

Regardless, if you want to use the PayPal Pro API and the sandbox, give PayPal call at: 800-852-1973 (or, 866-837-1851, or 888-221-1161 -- all phone numbers I was told to call) to just fix the problem directly.

So. Strange.

No comments:

Post a Comment