Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error #520009 - Account is restricted

I get a 520009 error (Account [email protected] is restricted) when trying to make a parallel payment. My code worked fine using the sandbox but I switched to the live endpoint and it began failing. The account in question is a valid paypal account and I am using "feespayer=SENDER". Am I missing something? Shouldn't the pay call go through even if the payee is a basic account? Why would this occur?

Here is my code for reference

function deposit($config) {
    try {
        if (isset($config['return_url']))
            $this->return_url = $config['return_url'];
        else
            return 'Return URL should be set';

        if (isset($config['return_url']))
            $this->cancel_url = $config['cancel_url'];
        else
            return 'Cancel URL should be set';

        if (isset($config['email']))
            $this->sender_email = $config['email'];
        else
            return 'Email should be defined';

        if (isset($config['amount']))
            $this->amount = $config['amount'];
        else
            return 'Amount should be defined';

        $returnURL = $this->return_url;
        $cancelURL = $this->cancel_url;
        $currencyCode = 'USD';
        $memo = 'Deposit to ' . $this->ci->config->item('site_name');
        $feesPayer = 'SENDER';


        $payRequest = new PayRequest();
        $payRequest->actionType = "PAY";
        $payRequest->cancelUrl = $cancelURL;
        $payRequest->returnUrl = $returnURL;
        $payRequest->clientDetails = new ClientDetailsType();
        $payRequest->clientDetails->applicationId = $this->ci->config->item('application_id');
        $payRequest->clientDetails->deviceId = $this->ci->config->item('device_id');
        $payRequest->clientDetails->ipAddress = $this->ci->input->ip_address();
        $payRequest->currencyCode = $currencyCode;
        //$payRequest->senderEmail = $this->sender_email;
        $payRequest->requestEnvelope = new RequestEnvelope();
        $payRequest->requestEnvelope->errorLanguage = "en_US";

        $receivers = array();

        $receiver = new receiver();
        $receiver->email = $this->ci->config->item('moneyfan_account');
        $receiver->amount = $this->amount;
        $receiver->primary = 'false';

        $receivers[] = $receiver;

        $payRequest->receiverList = $receivers;
        $payRequest->feesPayer = $feesPayer;
        $payRequest->memo = $memo;

        $ap = new AdaptivePayments();
        $response = $ap->Pay($payRequest);            
        if (strtoupper($ap->isSuccess) == 'FAILURE') {


            $this->ci->session->set_userdata('FAULTMSG', $ap->getLastError());
            return json_encode(array('status' => 'false', 'msg' => $ap->getLastError()->error->errorId .' : '. $ap->getLastError()->error->message));
            //redirect(site_url('home/api_error'));
        } else {
            $this->ci->session->set_userdata('payKey', $response->payKey);
            if ($response->paymentExecStatus == "COMPLETED") {
                redirect($returnURL);
            } else {
                $token = $response->payKey;
                $payPalURL = PAYPAL_REDIRECT_URL . '_ap-payment&paykey=' . $token;
                return json_encode(array('status' => 'true', 'msg' => $payPalURL));
                //header("Location: " . $payPalURL);
            }
        }
    } catch (Exception $ex) {

        $fault = new FaultMessage();
        $errorData = new ErrorData();
        $errorData->errorId = $ex->getFile();
        $errorData->message = $ex->getMessage();
        $fault->error = $errorData;
        $this->ci->session->set_userdata('FAULTMSG', $fault);
        redirect(site_url('home/api_error'));
    }
}
like image 905
Avinash Avatar asked Sep 03 '12 11:09

Avinash


People also ask

What does mean in error?

Definition of in error 1 : not correct : mistaken I believe your conclusion is in error. The judge was in error when she allowed the evidence to be admitted. 2 : in a way that is not correct My earlier statement was made in error. The evidence was admitted in error.

What is called as error?

An error (from the Latin error, meaning "wandering") is an action which is inaccurate or incorrect. In some usages, an error is synonymous with a mistake. In statistics, "error" refers to the difference between the value which has been computed and the correct value.

What is an error with example?

: something that is not correct : a wrong action or statement : mistake. [count] I made an error in my calculations. They uncovered several errors in his report to the committee. The paper contains numerous spelling errors.

Does error mean mistake?

Both error and mistake imply that something has been done wrong. Although error and mistake both refer to something wrong, inaccurate or faulty, there is a difference between them based on their usage. The main difference between error and mistake is that error is more formal and technical than mistake.


2 Answers

No! You cannot do that with a basic account.

For API to work you need to have a VERIFIED Business Account.

In their API it says:

NOTE:
The application owner must have a PayPal Business account.

like image 142
Mihai Iorga Avatar answered Sep 21 '22 02:09

Mihai Iorga


There are two sources of reference for the PayPal API: cms.paypal.com pages like the one referenced by Mihai Iorga, and www.x.com pages like this one: https://www.x.com/developers/paypal/documentation-tools/going-live-with-your-application

On x.com, it says you must have a verified business account, even though it is unclear from cms.paypal.com that this is the case.

like image 29
guyrt Avatar answered Sep 23 '22 02:09

guyrt