# give/4.17.0/src/PaymentGateways/PayPalCommerce/PayPalCheckoutSdk/Requests/GetAccessToken.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.17.0. 32 lines.

- Page: https://pluginprobe.com/plugins/give/4.17.0/code/src/PaymentGateways/PayPalCommerce/PayPalCheckoutSdk/Requests/GetAccessToken.php
- Raw: https://pluginprobe.com/plugins/give/4.17.0/raw/src/PaymentGateways/PayPalCommerce/PayPalCheckoutSdk/Requests/GetAccessToken.php
- Modified: 2025-04-16T13:25:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.17.0/code/src/PaymentGateways/PayPalCommerce/PayPalCheckoutSdk/Requests/GetAccessToken.php#L10-L20`.

```php
<?php

namespace Give\PaymentGateways\PayPalCommerce\PayPalCheckoutSdk\Requests;

use PayPalHttp\HttpRequest;

/**
 * Class GetAccessTokenWithClientCredentials
 *
 * @since 4.1.0 Add PayPal-Partner-Attribution-Id header
 * @since 2.32.0
 */
class GetAccessToken extends HttpRequest
{
    /**
     * @since 2.32.0
     *
     * @param array $requestBody Request body.
     * @param array $headers Headers to be added to the request.
     */
    public function __construct(array $requestBody, array $headers)
    {
        parent::__construct('/v1/oauth2/token', 'POST');

        $this->headers = wp_parse_args($headers, $this->headers);

        $this->headers["Content-Type"] = "application/x-www-form-urlencoded";
        $this->headers["PayPal-Partner-Attribution-Id"] = give('PAYPAL_COMMERCE_ATTRIBUTION_ID');
        $this->body = $requestBody;
    }
}

```
