title: How to paginate over Stripe API results?
body: <p><strong>Issue:</strong> I want to find a way to paginate over Stripe API results past a certain number.  The issue is, as time goes on and more API documentation appears, a page will be loaded with way too much data.  Preferably I would like to have a months worth of data per page.</p>
  
  <p><strong>Question:</strong> How can I limit to results on the views side and create pagination for it.</p>
  
  <p>For example, I have this in my controller:</p>
  
  <pre><code>  @payouts = Stripe::Payout.list(
        {
          limit: 100,
          expand: ['data.destination']
        },
        { stripe_account: current_user.stripe_token } 
      )
  </code></pre>
  
  <p>Views:</p>
  
  <pre><code> #table html stuffs
      ...
      &lt;% @payouts.each do |payout| %&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;%= number_to_currency(as_table_row_payout(payout["amount"] / 100.00 )) %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= as_table_row_payout(Time.at(payout["arrival_date"]).strftime('%m/%d/%Y')) %&gt;&lt;/td&gt;
  
          &lt;/tr&gt;
    &lt;% end %&gt;
      ...
  </code></pre>
  
  <p>I have the will_paginate gem but that didn't seem to work.  So I figured there may be a way with jquery / JS to solve this.  Does anyone have a solution to limit the amount of API JSON data that is requested on the view page?</p>
  
  <p>Somewhat of an update and a bit off topic... (sorry if this strays from the post itself and starts a new conversation)
  I have found a gem for will_paginate to paginate through API requests</p>
  
  <p>I have found the api-pagination gem here: <a href="https://github.com/davidcelis/api-pagination" rel="nofollow noreferrer">https://github.com/davidcelis/api-pagination</a></p>
  
  <p>Although, when i installed the gem and followed the directions, nothing seemed to happen - I manually created an api_pagination.rb config file and did what it seems like the docs say to do as well... Anyone use this before?</p>