<small id='3LKna'></small><noframes id='3LKna'>

  • <legend id='3LKna'><style id='3LKna'><dir id='3LKna'><q id='3LKna'></q></dir></style></legend>
      <bdo id='3LKna'></bdo><ul id='3LKna'></ul>
  • <tfoot id='3LKna'></tfoot>

        <i id='3LKna'><tr id='3LKna'><dt id='3LKna'><q id='3LKna'><span id='3LKna'><b id='3LKna'><form id='3LKna'><ins id='3LKna'></ins><ul id='3LKna'></ul><sub id='3LKna'></sub></form><legend id='3LKna'></legend><bdo id='3LKna'><pre id='3LKna'><center id='3LKna'></center></pre></bdo></b><th id='3LKna'></th></span></q></dt></tr></i><div id='3LKna'><tfoot id='3LKna'></tfoot><dl id='3LKna'><fieldset id='3LKna'></fieldset></dl></div>

        Paypal PHP REST 服务 - “访问令牌没有所需的范围"

        Paypal PHP REST service - quot;access token does not have required scopequot;(Paypal PHP REST 服务 - “访问令牌没有所需的范围)
        • <bdo id='4mOvT'></bdo><ul id='4mOvT'></ul>

        • <small id='4mOvT'></small><noframes id='4mOvT'>

          <i id='4mOvT'><tr id='4mOvT'><dt id='4mOvT'><q id='4mOvT'><span id='4mOvT'><b id='4mOvT'><form id='4mOvT'><ins id='4mOvT'></ins><ul id='4mOvT'></ul><sub id='4mOvT'></sub></form><legend id='4mOvT'></legend><bdo id='4mOvT'><pre id='4mOvT'><center id='4mOvT'></center></pre></bdo></b><th id='4mOvT'></th></span></q></dt></tr></i><div id='4mOvT'><tfoot id='4mOvT'></tfoot><dl id='4mOvT'><fieldset id='4mOvT'></fieldset></dl></div>

                <tbody id='4mOvT'></tbody>
              <legend id='4mOvT'><style id='4mOvT'><dir id='4mOvT'><q id='4mOvT'></q></dir></style></legend>
                  <tfoot id='4mOvT'></tfoot>
                  本文介绍了Paypal PHP REST 服务 - “访问令牌没有所需的范围"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Paypal REST SDK 在 PHP 中编码.我已将我的 Sandbox 帐户设置为使用 AUD.在意识到我的初始交易是美元并且交易被搁置后,我解决了这个问题.

                  使用我修改后的代码,我正在尝试创建付款 - 我假设我会返回一个 URL,该 URL 将允许我重定向用户以批准付款.

                  我收到一条消息:

                  <块引用>

                  异常:访问

                  I'm coding in PHP using the Paypal REST SDK. I've set up my Sandbox account to use AUD. I worked this out after realising that my initial transactions were in USD and the transactions were getting held.

                  Using my revised code I'm trying to create payment - I assume I'll get back a URL which will allow me to redirect the user to approve the payment.

                  I'm getting a message which says:

                  Exception: Got Http response code 403 when accessing https://api.sandbox.paypal.com/v1/payments/payment. Retried 0 times. string(215) "{"name":"REQUIRED_SCOPE_MISSING","message":"Access token does not have required scope","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING","debug_id":"34683601f5dcd"}"

                  My code is: $apiContext = new ApiContext(new OAuthTokenCredential( 'xxxxxx', 'xxxxxx'));

                      //### FundingInstrument
                      // A resource representing a Payer's funding instrument.
                      // For direct credit card payments, set the CreditCard
                      // field on this object.
                      $fi = new FundingInstrument();
                      $creditCardToken = new CreditCardToken();
                      $creditCardToken->setCreditCardId($creditcard->cardToken);
                      $fi->setCreditCardToken($creditCardToken);
                  
                      // ### Payer
                      // A resource representing a Payer that funds a payment
                      // For direct credit card payments, set payment method
                      // to 'credit_card' and add an array of funding instruments.
                      $payer = new Payer();
                      $payer->setPaymentMethod("credit_card")
                          ->setFundingInstruments(array($fi));
                  
                      // ### Itemized information
                      // (Optional) Lets you specify item wise
                      // information
                      $paymentItems=Yii::app()->session['paymentitems'];
                      $items=array();
                      $total=0;
                      foreach ($paymentItems as $item)
                      {
                          $pp_item = new Item();
                          $pp_item->setName("Donation to ".$item->organisation->organisationName)
                              ->setCurrency('AUD')
                              ->setQuantity(1)
                              ->setPrice($item->amount);
                          array_push($items,$pp_item);
                          $total+=(float)$item->amount;
                      }
                      $itemList = new ItemList();
                      $itemList->setItems($items);        
                      // ### Amount
                      // Lets you specify a payment amount.
                      // You can also specify additional details
                      // such as shipping, tax.
                      $amount = new Amount();
                      $amount->setCurrency("AUD")
                          ->setTotal($total);
                  
                      // ### Transaction
                      // A transaction defines the contract of a
                      // payment - what is the payment for and who
                      // is fulfilling it. 
                      $transaction = new Transaction();
                      $transaction->setAmount($amount)
                          ->setItemList($itemList)
                          ->setDescription("Payment description");
                  
                      // ### Payment
                      // A Payment Resource; create one using
                      // the above types and intent set to sale 'sale'
                      $payment = new Payment();
                      $payment->setIntent("sale")
                          ->setPayer($payer)
                          ->setTransactions(array($transaction));
                      // ### Create Payment
                      // Create a payment by calling the payment->create() method
                      // with a valid ApiContext (See bootstrap.php for more on `ApiContext`) href
                  
                      // The return object contains the state.
                      try {
                          $response=$payment->create($apiContext);
                          var_dump($response);
                          //$this->redirect($response->links[0]->href);
                      } catch (PayPalExceptionPPConnectionException $ex) {
                          echo "Exception: " . $ex->getMessage() . PHP_EOL;
                          var_dump($ex->getData());
                          exit(1);
                      }
                  

                  Any thoughts as to what this message means. It would seem that direct credit card payments are not supported by Paypal in Australia, but I don't think that's the problem.

                  解决方案

                  In your Paypal developer account, under My Apps > [Your App], make sure the feature you are trying to use is enabled in the APP SETTINGS section.

                  这篇关于Paypal PHP REST 服务 - “访问令牌没有所需的范围"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                • <tfoot id='LN5DI'></tfoot>
                • <small id='LN5DI'></small><noframes id='LN5DI'>

                • <i id='LN5DI'><tr id='LN5DI'><dt id='LN5DI'><q id='LN5DI'><span id='LN5DI'><b id='LN5DI'><form id='LN5DI'><ins id='LN5DI'></ins><ul id='LN5DI'></ul><sub id='LN5DI'></sub></form><legend id='LN5DI'></legend><bdo id='LN5DI'><pre id='LN5DI'><center id='LN5DI'></center></pre></bdo></b><th id='LN5DI'></th></span></q></dt></tr></i><div id='LN5DI'><tfoot id='LN5DI'></tfoot><dl id='LN5DI'><fieldset id='LN5DI'></fieldset></dl></div>

                      <tbody id='LN5DI'></tbody>

                          <bdo id='LN5DI'></bdo><ul id='LN5DI'></ul>

                          <legend id='LN5DI'><style id='LN5DI'><dir id='LN5DI'><q id='LN5DI'></q></dir></style></legend>