code: public function new_limit_url($type, $params) {
  
      // $params are passed in
      // Optional $params are saved in $request and removed from $params
      // $params now only contains params for the payments
      // $payment_params is created containing sub-object named after $type
      // Merge $payment_params, $request and mandatory params
      // Sign
      // Generate query string
      // Return resulting url
  
      // Declare empty array
      $request = array();
  
      // Add in merchant id
      $params['merchant_id'] = $this->account_details['merchant_id'];
  
      // Define optional parameters
      $opt_params = array(
        'redirect_uri',
        'cancel_uri',
        'state'
      );
  
      // Loop through optional parameters
      foreach ($opt_params as $opt_param) {
        if (isset($params[$opt_param])) {
          $request[$opt_param] = $params[$opt_param];
          unset($params[$opt_param]);
        }
      }
  
      // If no method-specific redirect submitted then
      // use class level if available
      if ( ! isset($request['redirect_uri']) && isset($this->redirect_uri)) {
        $request['redirect_uri'] = $this->redirect_uri;
      }
  
      // Create array of payment params
      $payment_params = array($type => $params);
  
      // Put together all the bits: passed params inc payment params & mandatory
      $request = array_merge($request, $payment_params,
        $this->generate_mandatory_params());
  
      // Generate signature
      $request['signature'] = GoCardless_Utils::generate_signature($request,
        $this->account_details['app_secret']);
  
      // Generate query string from all parameters
      $query_string = GoCardless_Utils::generate_query_string($request);
  
      // Generate url NB. Pluralises resource
      return $this->base_url . '/connect/' . $type . 's/new?' . $query_string;
  
    }
docs: Generate a new payment url
  
  @param string $type Payment type
  @param string $params The specific parameters for this payment
  
  @return string The new payment URL