|
Rank: Starting Member
Groups: Registered
Joined: 9/6/2005 Posts: 1 Location: ,
|
I've installed the SDK, created a test account in the Sandbox, and downloaded the certificate. I then created a profile for it. When I try to run the first call to PayPal via the code generated from the API, I get this:
object(setexpresscheckoutresponsetype)(11) {
["Token"]=>
NULL
["_elements"]=>
array(7) {
["Timestamp"]=>
array(4) {
["required"]=>
bool(false)
["type"]=>
string(8) "dateTime"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["Ack"]=>
array(4) {
["required"]=>
bool(true)
["type"]=>
string(11) "AckCodeType"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["CorrelationID"]=>
array(4) {
["required"]=>
bool(false)
["type"]=>
string(6) "string"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["Errors"]=>
array(4) {
["required"]=>
bool(false)
["type"]=>
string(9) "ErrorType"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["Version"]=>
array(4) {
["required"]=>
bool(true)
["type"]=>
string(6) "string"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["Build"]=>
array(4) {
["required"]=>
bool(true)
["type"]=>
string(6) "string"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["charset"]=>
string(10) "iso-8859-1"
}
["Token"]=>
array(3) {
["required"]=>
bool(true)
["type"]=>
string(24) "ExpressCheckoutTokenType"
["namespace"]=>
string(22) "urn:ebay:api:PayPalAPI"
}
}
["_attributes"]=>
array(0) {
}
["_attributeValues"]=>
array(0) {
}
["_namespace"]=>
string(22) "urn:ebay:api:PayPalAPI"
["Timestamp"]=>
string(20) "2005-09-01T19:31:11Z"
["Ack"]=>
string(7) "Failure"
["CorrelationID"]=>
string(6) "NotSet"
["Errors"]=>
object(errortype)(9) {
["_elements"]=>
array(5) {
["ShortMessage"]=>
array(3) {
["required"]=>
bool(true)
["type"]=>
string(6) "string"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
}
["LongMessage"]=>
array(3) {
["required"]=>
bool(false)
["type"]=>
string(6) "string"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
}
["ErrorCode"]=>
array(3) {
["required"]=>
bool(true)
["type"]=>
string(5) "token"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
}
["SeverityCode"]=>
array(3) {
["required"]=>
bool(true)
["type"]=>
string(16) "SeverityCodeType"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
}
["ErrorParameters"]=>
array(3) {
["required"]=>
bool(false)
["type"]=>
string(18) "ErrorParameterType"
["namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
}
}
["_attributes"]=>
array(0) {
}
["_attributeValues"]=>
array(0) {
}
["_namespace"]=>
string(31) "urn:ebay:apis:eBLBaseComponents"
["ShortMessage"]=>
string(35) "Authentication/Authorization Failed"
["LongMessage"]=>
string(30) "Username/Password is incorrect"
["ErrorCode"]=>
string(5) "10002"
["SeverityCode"]=>
string(5) "Error"
["ErrorParameters"]=>
NULL
}
["Version"]=>
string(8) "2.000000"
["Build"]=>
string(6) "1.0006"
}
The part that stands out is "Username/Password is incorrect". I've deleted and recreated the certificate three times but it always says the username/password is incorrect. Here is the code the API generated:
require_once 'Services/PayPal.php';
require_once 'Services/PayPal/Profile/Handler/File.php';
require_once 'Services/PayPal/Profile/API.php';
$handler =& ProfileHandler_File::getInstance(array (
'path' => '/web/sites/photon/gacancercoalition.com',
'charset' => 'iso-8859-1',
));
if (Services_PayPal::isError($handler)) {
var_dump($handler->getMessage());
exit;
}
$profile =& APIProfile::getInstance('85107ed58a82ecacccddc27d31fc3313', $handler);
if (Services_PayPal::isError($profile)) {
var_dump($profile->getMessage());
exit;
}
$profile->setAPIPassword('1000monkeys');
$caller =& Services_PayPal::getCallerServices($profile);
if (Services_PayPal::isError($caller)) {
var_dump($caller->getMessage());
exit;
}
$OrderTotal =& Services_PayPal::getType('BasicAmountType');
if (Services_PayPal::isError($OrderTotal)) {
var_dump($OrderTotal);
exit;
}
$OrderTotal->setattr('currencyID', 'USD');
$OrderTotal->setval($Total, 'iso-8859-1');
$SetExpressCheckoutRequestDetails =& Services_PayPal::getType('SetExpressCheckoutRequestDetailsType');
if (Services_PayPal::isError($SetExpressCheckoutRequestDetails)) {
var_dump($SetExpressCheckoutRequestDetails);
exit;
}
$SetExpressCheckoutRequestDetails->setcpp_header_image('http://www.georgiacancer.org/images/logoforpaypal.jpg', 'iso-8859-1');
$SetExpressCheckoutRequestDetails->setOrderDescription('event tickets', 'iso-8859-1');
$SetExpressCheckoutRequestDetails->setCancelURL('http://www.georgiacancer.org/paypalcancel.php', 'iso-8859-1');
$SetExpressCheckoutRequestDetails->setReturnURL('http://www.georgiacancer.org/paypalcontinue.php', 'iso-8859-1');
$SetExpressCheckoutRequestDetails->setOrderTotal($OrderTotal);
$SetExpressCheckout =& Services_PayPal::getType('SetExpressCheckoutRequestType');
if (Services_PayPal::isError($SetExpressCheckout)) {
var_dump($SetExpressCheckout);
exit;
}
$SetExpressCheckout->setSetExpressCheckoutRequestDetails($SetExpressCheckoutRequestDetails);
$result = $caller->SetExpressCheckout($SetExpressCheckout);
if (Services_PayPal::isError($result)) {
var_dump($result);
} else {
/* Success */
var_dump($result);
}
What am I doing wrong?
|
|
Rank: Starting Member
Groups: Registered
Joined: 8/13/2005 Posts: 23 Location: ,
|
You're either confusing your Sandbox account certificate with your Live account certificate, or you're not passing in your correct username and password. This is NOT your PayPal username/password login that you specifiy at www.paypal.com, this is the API Username given to you when you download the certificate, and the API Password used when you created the certificate.
|