lib/GoCardless/Client.php
public function fetch_access_token($params) {

    if ( ! isset($params['redirect_uri'])) {
      throw new GoCardless_ArgumentsException('redirect_uri required');
    }

    $params['http_authorization'] = $this->account_details['app_id'] . ':' .
      $this->account_details['app_secret'];

    $response = $this->request('post', '/oauth/access_token', $params);

    $merchant = explode(':', $response['scope']);
    $merchant_id = isset($merchant[1]) ? $merchant[1] : null;
    $access_token = $response['access_token'];

    return array(
      'merchant_id'   => $merchant_id,
      'access_token'  => $access_token
    );

  }
public function fetch_access_token($params) {

    if ( ! isset($params['redirect_uri'])) {
      throw new GoCardless_ArgumentsException('redirect_uri required');
    }

    $params['http_authorization'] = $this->account_details['app_id'] . ':' .
      $this->account_details['app_secret'];

    $response = $this->request('post', '/oauth/access_token', $params);

    $merchant = explode(':', $response['scope']);
    $merchant_id = isset($merchant[1]) ? $merchant[1] : null;
    $access_token = $response['access_token'];

    return array(
      'merchant_id'   => $merchant_id,
      'access_token'  => $access_token
    );

  }
Fetch an access token for the current user

@param array $params The parameters to use

@return array Array containing the Merchant ID ('merchant_id') and Access Token ('access_token')