2016-10-25 3 views
0

私は、単一の支払いを扱うクラスです彼らはいくつかのレベル に到達したときに、ユーザーへの支払いを送信するWebアプリケーションがあります。私は支払いをしようとするとペイパルの支払いは常に403エラーを返す

public function pagaSingoloAction(Request $request, $id_richiesta) 
{ 
    $richiesta_pagamento = $this->getDoctrine()->getRepository("AppBundle:RichiestaPagamento")->find($id_richiesta); 
    if ($richiesta_pagamento) 
    { 
     $logger = $this->get('logger'); 
     $em = $this->getDoctrine()->getManager(); 
     $tassa = $this->get('application.settings')->ritornaImpostazioneDaNome("percentuale_tasse_pagamenti_richieste"); 
     if (!$tassa) 
      $tassa = 0; 

     $totale_richiesta_aggiornato = $richiesta_pagamento->getTotale(); 
     $totale_tassa_decurtata_network = 0; 
     if ($tassa != 0) 
     { 
      $totale_tassa_decurtata_network = (($tassa/100) * $totale_richiesta_aggiornato); 
      $totale_richiesta_aggiornato = $totale_richiesta_aggiornato - $totale_tassa_decurtata_network; 
     } 

     $imp = new ImpostazioniApplicazione($this->getDoctrine()); 

     $apiContext = new ApiContext(new OAuthTokenCredential(
      $imp->getPaypalAppId(), 
      $imp->getPaypalAppSecret() 
     )); 
     $apiContext->setConfig(array(
      'mode' => $this->getParameter('paypal_mode'), 
      'log.LogEnabled' => true, 
      'log.FileName' => 'PayPal.log', 
      'log.LogLevel' => 'FINE' 
     )); 

     $logger->info("SETTATA CONFIGURAZIONE API CONTEXT"); 
     $payouts = new Payout(); 
     $sender_batch_header = new PayoutSenderBatchHeader(); 

     $sender_batch_header->setSenderBatchId(uniqid()) 
      ->setEmailSubject("New payment from request!"); 

     $sender_item = new PayoutItem(); 
     $sender_item->setRecipientType('EMAIL') 
      ->setNote("Payment request n. " . $richiesta_pagamento->getId()) 
      ->setReceiver($richiesta_pagamento->getEmailPaypal()) 
      ->setSenderItemId(uniqid()) 
      ->setAmount(new Currency('{ 
        "value" : "'. $totale_richiesta_aggiornato .'", 
        "currency" : "EUR" 
      }')); 

     $payouts->setSenderBatchHeader($sender_batch_header) 
      ->addItem($sender_item); 

     $output = ""; 
     try{ 
      $output = $payouts->createSynchronous($apiContext, null); 
      $logger->error(var_export($output, true)); 
     }catch (Exception $ex){ 
      $logger->error($ex->getMessage()); 
     } 


     $payout_item = $output->getItems()[0]; 


     if ($payout_item->getTransactionStatus() == "SUCCESS") 
     { 
      //ITS ALL OK 

     } 

     return $this->render('pagamento_singolo_richiesta/singolo_pagamento_dettagli.html.twig', array(
      'pagamento' => $pagamento_singolo, 
     )); 

    } 
    else{ 
     return $this->render('pagamento_singolo_richiesta/pagamento_errore.html.twig'); 
    } 
} 

を:

try{ 
     $output = $payouts->createSynchronous($apiContext, null); 
     $logger->error(var_export($output, true)); 
    }catch (Exception $ex){ 
     $logger->error($ex->getMessage()); 
    } 

私はいつも403 AUTORIZHATIONを取得しますが、1ヶ月前にはすべて素晴らしいです!

私は何が問題なのか理解できません...私はpaypalのドキュメントにphpサンプルコードでチェックしてあり、それは私のコードのように大丈夫です。

私のアプリケーションではsymfonyフレームワークを使用しています。 私は問題なく支払いを受けるが、私はお金を送ることはできない。

私はまた、すべてのバンドルとsymfony自体をアップグレードしようとしましたが、同じ問題は変わっていません。 PayPalのエラーログです :

[25-10-2016午前11時21分08秒]ペイパル\コア\ PayPalHttpConnection:INFO:応答ステータス:403 [25-10-2016午前11時21分08秒] PayPalの\ Core \ PayPalHttpConnection:エラー:https://api.paypal.com/v1/payments/payouts?sync_mode=trueにアクセスすると、HTTP応答コード403が表示されます。 {"name": "AUTHORIZATION_ERROR"、 "message": "承認エラーが発生しました"、 "debug_id": "3676075eac96e"、 "information_link": "https://developer.paypal.com/docs/api/payments.payouts-batch/#errors"}

答えて

0

PayPal APIの403応答は、あなたの資格情報に何か問題があります。希望のPayPalアカウントがまだ有効かどうかチェックしましたか?クライアントIDの秘密IDはまだ合法ですか?

+0

返信ありがとうございます。 はい、私はチェックして、それはすべてOKです 私はまだ支払いを受け取ります –

関連する問題