Tag Archives: Paypal

Paypal IPN Validation Fails with Adaptive Payments and PHP query/ post parameters

If you are looking for a solution you can find it here.
Thank you Gleb ( http://www.memberwing.com/ )

https://www.x.com/message/158509#158509

The problem comes in how the API is designed, and it takes advantage of a little known feature of query parameters and their allowed characters. Paypal uses array’ed parameters like:

&transaction[0].status=value

The problem is that PHP does not know how to parse the query parameter and either skips it or stops processing the list. ( i can’t remember which ).

Paypal’s Adaptive Payments API is neat and freshens up their functionality, and additionally uses JSON as a communication layer, so I think it’s clearly their future, however, there are a number of little problems like this as you walk through getting up to speed on the API. I hope this helps anyone in the future by saving them an hour to day.

It kinda reminds me of some of the problems we had getting the MySpaceID API up and polished so I guess this is a nod to all of those APIs that do it right the first time.

Cheers.

Getting VerifyStatus API working in Sandbox

There are a few caviots to getting the API working.
I hope this saves someone a few hours/ days.

  • CallerServices.php has a small bug
  • Only Sandbox email accounts work in the sandbox. Thanks for confiming @ppalavilli
  • ALL Sandbox accounts have the First Name: Test Thanks @ppalavilli
  • ALL Sandbox accounts have the Last Name: User Thanks @ppalavilli

If you get a

PHP Warning: Missing argument 3 for CallerServices::callWebService()

On line 101 of CallerServices.php you have:

function callWebService($request,$serviceName,$simpleXML)

It should read: //(most of the calls that use callWebService are parent::callWebService( $request,$serviceName ) anyways.

function callWebService($request,$serviceName,$simpleXML=NULL)
{
$response = null;
try {
    $endpoint=API_BASE_ENDPOINT.$serviceName;
    $response = call($request, $endpoint, $this->sandBoxEmailAddress,$simpleXML);
}
catch(Exception $ex) {
throw new FatalException('Error occurred in call method');
}
   return $response;
}

Here is the code I used. Replace {email} with one of your sandbox email addresses.

public function verify_email($params){
$VstatusRequest = new GetVerifiedStatusRequest();
 
$VstatusRequest->emailAddress = '{email}';
$VstatusRequest->matchCriteria = 'NAME';
$VstatusRequest->firstName = 'Test';
$VstatusRequest->lastName = 'User';
 
$rEnvelope = new RequestEnvelope();
$rEnvelope->errorLanguage = "en_US";
$VstatusRequest->requestEnvelope = $rEnvelope ;
 
$aa = new AdaptiveAccounts();
$response = $aa->GetVerifiedStatus($VstatusRequest);
 
echo json_encode($response);
  }

The JSON encoded object looks like such:

{"responseEnvelope":{
    "timestamp":"2011-03-25T15:37:32.44307:00",
    "ack":"Success",
    "correlationId":"42bce847aebc9",
    "build":"1772158"
},
"accountStatus":"VERIFIED"
}

@jdavid