2012-09-03 15 views
6

Tôi nhận được lỗi 520009 (Tài khoản [email protected] bị hạn chế) khi cố thực hiện thanh toán song song. Mã của tôi làm việc tốt bằng cách sử dụng sandbox nhưng tôi chuyển sang điểm cuối sống và nó bắt đầu thất bại. Tài khoản được đề cập là tài khoản paypal hợp lệ và tôi đang sử dụng "feepayer = SENDER". Tui bỏ lỡ điều gì vậy? Không nên trả tiền cuộc gọi trả tiền ngay cả khi người nhận thanh toán là tài khoản cơ bản? Tại sao điều này lại xảy ra?Lỗi # 520009 - Tài khoản bị giới hạn

Đây là mã của tôi để tham khảo

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

Chủ sở hữu ứng dụng có tài khoản kinh doanh paypal không? – dearlbry

+0

nó hoạt động mà không có phần '' $ payRequest-> feePayer = ... ''? – pencil

Trả lời

7

Không! Bạn không thể làm điều đó với một tài khoản cơ bản.

Để API hoạt động, bạn cần có Tài khoản doanh nghiệp được xác minh.

Trong API họ nó nói:

LƯU Ý:
Chủ sở hữu ứng dụng phải có tài khoản PayPal kinh doanh.

+0

Tài khoản của tôi là tài khoản doanh nghiệp được xác minh – Avinash

+0

Tất cả người nhận đều có tài khoản PayPal, còn '$ config ['email']' là tài khoản PayPal hợp lệ không? –

+0

có. cả hai email đều là tài khoản paypal hợp lệ. – Avinash

Các vấn đề liên quan