title: Paypal PHP REST service - "access token does not have required scope"
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>I'm getting a message which says: </p>
  
  <blockquote>
    <p>Exception: Got Http response code 403 when accessing <a href="https://api.sandbox.paypal.com/v1/payments/payment" rel="noreferrer">https://api.sandbox.paypal.com/v1/payments/payment</a>. Retried 0 times.
     string(215) "{"name":"REQUIRED_SCOPE_MISSING","message":"Access token does not have required scope","information_link":"<a href="https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING" rel="noreferrer">https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING</a>","debug_id":"34683601f5dcd"}"</p>
  </blockquote>
  
  <p>My code is:
      $apiContext = new ApiContext(new OAuthTokenCredential(
                  'xxxxxx',
                  'xxxxxx'));</p>
  
  <pre><code>    //### 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-&gt;setCreditCardId($creditcard-&gt;cardToken);
      $fi-&gt;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-&gt;setPaymentMethod("credit_card")
          -&gt;setFundingInstruments(array($fi));
  
      // ### Itemized information
      // (Optional) Lets you specify item wise
      // information
      $paymentItems=Yii::app()-&gt;session['paymentitems'];
      $items=array();
      $total=0;
      foreach ($paymentItems as $item)
      {
          $pp_item = new Item();
          $pp_item-&gt;setName("Donation to ".$item-&gt;organisation-&gt;organisationName)
              -&gt;setCurrency('AUD')
              -&gt;setQuantity(1)
              -&gt;setPrice($item-&gt;amount);
          array_push($items,$pp_item);
          $total+=(float)$item-&gt;amount;
      }
      $itemList = new ItemList();
      $itemList-&gt;setItems($items);        
      // ### Amount
      // Lets you specify a payment amount.
      // You can also specify additional details
      // such as shipping, tax.
      $amount = new Amount();
      $amount-&gt;setCurrency("AUD")
          -&gt;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-&gt;setAmount($amount)
          -&gt;setItemList($itemList)
          -&gt;setDescription("Payment description");
  
      // ### Payment
      // A Payment Resource; create one using
      // the above types and intent set to sale 'sale'
      $payment = new Payment();
      $payment-&gt;setIntent("sale")
          -&gt;setPayer($payer)
          -&gt;setTransactions(array($transaction));
      // ### Create Payment
      // Create a payment by calling the payment-&gt;create() method
      // with a valid ApiContext (See bootstrap.php for more on `ApiContext`) href
  
      // The return object contains the state.
      try {
          $response=$payment-&gt;create($apiContext);
          var_dump($response);
          //$this-&gt;redirect($response-&gt;links[0]-&gt;href);
      } catch (PayPal\Exception\PPConnectionException $ex) {
          echo "Exception: " . $ex-&gt;getMessage() . PHP_EOL;
          var_dump($ex-&gt;getData());
          exit(1);
      }
  </code></pre>
  
  <p>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. </p>