|
Rank: Starting Member
Groups: Registered
Joined: 8/25/2005 Posts: 2 Location: ,
|
I've successfully gotten the Direct Payment API implemented on Linux/Apache/PHP. I'm trying to implement the Express Checkout API (as required). I start off with this request...
require_once "./request_base.php";
$paymentAction = "Sale";
$version = "2.0";
$orderTotal =& Services_PayPal::getType("BasicAmountType");
$orderTotal->setattr("currencyID", "USD");
$orderTotal->setval($taxFreeTotal);
$maxOrderTotal =& Services_PayPal::getType("BasicAmountType");
$maxOrderTotal->setattr("currencyID", "USD");
$maxOrderTotal->setval($grandTotal);
$setExpressCheckoutRequestDetails =& Services_PayPal::getType("SetExpressCheckoutRequestDetailsType");
$setExpressCheckoutRequestDetails->setOrderTotal($orderTotal);
$setExpressCheckoutRequestDetails->setReturnURL("$server$rootPath/blah1.php?orderNumber=$orderNumber&uniqueId=$uniqueId");
$setExpressCheckoutRequestDetails->setCancelURL("$server$rootPath/blah2.php?orderNumber=$orderNumber&uniqueId=$uniqueId");
$setExpressCheckoutRequestDetails->setMaxAmount($maxOrderTotal);
$setExpressCheckoutRequestDetails->setInvoiceID($orderNumber);
$setExpressCheckoutRequestDetails->setPaymentAction($paymentAction);
$setExpressCheckoutRequest =& Services_PayPal::getType("SetExpressCheckoutRequestType");
$setExpressCheckoutRequest->setVersion($version);
$setExpressCheckoutRequest->setSetExpressCheckoutRequestDetails($setExpressCheckoutRequestDetails);
$setExpressCheckoutResponse = $caller->SetExpressCheckout($setExpressCheckoutRequest);
Everything seems fine and I redirect to the PayPal url and I get to login and select "Continue Checkout" and redirects back to my server and I execute this to get the customer info...
require_once "./request_base.php";
$getExpressCheckoutDetailsRequest =& Services_PayPal::getType("GetExpressCheckoutDetailsRequestType");
$getExpressCheckoutDetailsRequest->setToken($paypalToken);
$getExpressCheckoutDetailsResponse = $caller->SetExpressCheckout($setExpressCheckoutRequest);
And it always returns an Ack of "Failure" with the error code noted in the subject. I realize you guys just updated the SDK version and I tried the SDK update command (which said it completed successfully), but then it started giving me errors in my request_base.php saying setapipassword() is undefined. I restarted Apache. Same thing. Downloaded latest SDK manually. pear uninstall Service_PayPal. Success. pear install package.xml from SDK_root/Services_PayPal. Success. All works again up until the same version error problem. Direct API is working fine all the way through. What am I doing wrong?
Just a little more information...
The request_base.php is the same on the Direct Payment API calls & the Express Checkout API calls (Direct works no prob, Express fails). I've assigned $version = "1.0", as well with no luck. 1st step of Express Checkout call succeeds with no problems only on redirect back to my site and I call for the customer info is the failure happening.
|
|
Rank: Starting Member
Groups: Registered
Joined: 8/25/2005 Posts: 2 Location: ,
|
I finally figured it out...
$getExpressCheckoutDetailsResponse = $caller->SetExpressCheckout($setExpressCheckoutRequest);
...should read...
$getExpressCheckoutDetailsResponse = $caller->GetExpressCheckoutDetails($getExpressCheckoutDetailsRequest);
That's what I get for cutting & pasting from my Direct Payment code and only changing "Direct" to "ExpressCheckout". This was totally killing me. Whew!!!
|