You are here

public function CheckoutSdk::getAccessToken in Commerce PayPal 8

Gets an access token.

Return value

\Psr\Http\Message\ResponseInterface The HTTP response.

Overrides CheckoutSdkInterface::getAccessToken

File

src/CheckoutSdk.php, line 92

Class

CheckoutSdk
Provides a replacement of the PayPal SDK.

Namespace

Drupal\commerce_paypal

Code

public function getAccessToken() {
  return $this->client
    ->post('/v1/oauth2/token', [
    'auth' => [
      $this->config['client_id'],
      $this->config['secret'],
    ],
    'form_params' => [
      'grant_type' => 'client_credentials',
    ],
  ]);
}