Apologies in advance if this is a silly question. I did try digging around, but couldn't find an answer.
I'm trying to set up a chained payment (at the sandbox environment), but am getting error 520009 (Account is restricted). Tried several email addresses, and they all give me this error. The email addresses are not registered with Paypal, but as far as I know this shouldn't be an issue as the adaptive payments module doesn't require the receivers to have Paypal accounts in advance (though they will need accounts to actually get the money, of course).
What am I doing wrong? I did set the fee payer to EACHRECEIVER (as suggested on some threads), but the error remains.
This is what I get back: ERROR Code: 520009 ERROR Message: Account [email protected] is restricted
Here's my code:
// Config
$endpoint = trim("https://svcs.sandbox.paypal.com/AdaptivePayments/Pay");
$API_UserName = "MY_USERNAME_FROM_SANDBOX";
$API_Password = "MY_PASSWORD_FROM_SANDBOX";
$API_Signature = "MY_SIGNATURE_FROM_SANDBOX";
$API_AppID = "APP-80W284485P519543T";
$API_RequestFormat = "NV";
$API_ResponseFormat = "NV";
// Create request payload with minimum required parameters
$bodyparams = array (
"requestEnvelope.errorLanguage" => "en_US",
"actionType" => "PAY_PRIMARY",
"cancelUrl" => 'http://www.beta.com/cancel',
"returnUrl" => 'http://www.beta.com/return',
"currencyCode" => 'USD',
"feesPayer" => "EACHRECEIVER",
"actionType" => "PAY_PRIMARY",
"receiverList.receiver[0].email" => '[email protected]',
"receiverList.receiver[0].amount" => '10',
"receiverList.receiver[0].primary" => 'true',
"receiverList.receiver[1].email" => '[email protected]',
"receiverList.receiver[1].amount" => '5',
"receiverList.receiver[1].primary" => 'false',
);
// Convert payload array into url encoded query string
$body_data = http_build_query($bodyparams, "", chr(38));
try
{
//create request and add headers
$params = array("http" => array(
"method" => "POST",
"content" => $body_data,
"header" =>
"X-PAYPAL-SECURITY-USERID: " . $API_UserName . "\r\n" .
"X-PAYPAL-SECURITY-SIGNATURE: " . $API_Signature . "\r\n" .
"X-PAYPAL-SECURITY-PASSWORD: " . $API_Password . "\r\n" .
"X-PAYPAL-APPLICATION-ID: " . $API_AppID . "\r\n" .
"X-PAYPAL-REQUEST-DATA-FORMAT: " . $API_RequestFormat . "\r\n" .
"X-PAYPAL-RESPONSE-DATA-FORMAT: " . $API_ResponseFormat . "\r\n"
));
//create stream context
$ctx = stream_context_create($params);
//open the stream and send request
$fp = @fopen($endpoint, "r", false, $ctx);
//get response
$response = stream_get_contents($fp);
//check to see if stream is open
if ($response === false) {
throw new Exception("php error message = " . "$php_errormsg");
}
//close the stream
fclose($fp);
//parse the ap key from the response
$keyArray = explode("&", $response);
foreach ($keyArray as $rVal){
list($qKey, $qVal) = explode ("=", $rVal);
$kArray[$qKey] = $qVal;
}
//print the response to screen for testing purposes
If ( $kArray["responseEnvelope.ack"] == "Success") {
foreach ($kArray as $key =>$value){
echo $key . ": " .$value . "<br/>";
}
}
else {
echo 'ERROR Code: ' . $kArray["error(0).errorId"] . " <br/>";
echo 'ERROR Message: ' . urldecode($kArray["error(0).message"]) . " <br/>";
}
}
catch(Exception $e) {
echo "Message: ||" .$e->getMessage()."||";
}
Thanks!
EDIT: I could solve the problem by removing the "feesPayer" param, which needs to be the default value (i.e., EACHRECEIVER) in case of a unilateral payment.
I'm stuck with this issue, too.
I wonder how I could achieve a "unilateral payment", which is described by PayPal as follows:
You can use the Pay API operation to make unilateral payments under limited circumstances. A unilateral payment is a payment that is made to a receiver who does not have a PayPal account. Unilateral payments can be used with simple or parallel payments that are implicit or preapproved. Unilateral payments are not designed to be used with chained payments or payments that require manual approval through the web flow. When you send a unilateral payment, you send a payment request that includes an email address for a receiver, and this email address is not linked to a registered PayPal account. The receiver receives an email notifying the receiver to create an account and claim the payment. PayPal holds a payment to a receiver whose email address is not yet registered or confirmed until the receiver creates a PayPal account and confirms the email address. If a refund specifies a receiver whose email address is not yet registered or confirmed, the payment to the receiver is canceled.
Anyone having an idea what parameter-setting using NVP is required to achieve this without getting ERROR Code: 520009 ERROR Message: Account [email protected] is restricted
Any hint is highly appreciated!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With