$correlationId ); } $payLoad = $this->toJSON(); $call = new PayPalRestCall($apiContext); $json = $call->execute( array('PayPal\Handler\RestHandler'), "/v1/payments/payment", "POST", $payLoad, $headers ); $this->fromJson($json); return $this; } /** * Get a Refresh Token from Authorization Code * * @param $authorizationCode * @param ApiContext $apiContext * @return string|null refresh token */ public static function getRefreshToken($authorizationCode, $apiContext = null) { $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $credential = $apiContext->getCredential(); return $credential->getRefreshToken($apiContext->getConfig(), $authorizationCode); } /** * Updates Access Token using long lived refresh token * * @param string|null $refreshToken * @param ApiContext $apiContext * @return void */ public function updateAccessToken($refreshToken, $apiContext) { $apiContext = $apiContext ? $apiContext : new ApiContext(self::$credential); $apiContext->getCredential()->updateAccessToken($apiContext->getConfig(), $refreshToken); } }