PayPal\Auth\OAuthTokenCredential::getRefreshToken PHP Метод

getRefreshToken() публичный Метод

Get a Refresh Token from Authorization Code
public getRefreshToken ( $config, $authorizationCode = null, array $params = [] ) : string | null
$config
$authorizationCode
$params array optional arrays to override defaults
Результат string | null
    public function getRefreshToken($config, $authorizationCode = null, $params = array())
    {
        static $allowedParams = array('grant_type' => 'authorization_code', 'code' => 1, 'redirect_uri' => 'urn:ietf:wg:oauth:2.0:oob', 'response_type' => 'token');
        $params = is_array($params) ? $params : array();
        if ($authorizationCode) {
            //Override the authorizationCode if value is explicitly set
            $params['code'] = $authorizationCode;
        }
        $payload = http_build_query(array_merge($allowedParams, array_intersect_key($params, $allowedParams)));
        $response = $this->getToken($config, $this->clientId, $this->clientSecret, $payload);
        if ($response != null && isset($response["refresh_token"])) {
            return $response['refresh_token'];
        }
        return null;
    }