Error #520009 - Account is restricted

拥有回忆 提交于 2020-01-03 11:46:14

问题


I get a 520009 error (Account xx@xx.com 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'));
    }
}

回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/12247050/error-520009-account-is-restricted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!