Quickstart

Quickstart: Build a live repayment illustration

A live illustration that quotes as the user moves a slider feels great — debounce it so you respect the rate limit. This recipe shows the exact code, uses only the unauthenticated public ring, and links out to the endpoints and the application flow so the reader always has a next step.

2 min read

debounceOne call per pause
quoteReal figures
disclaimerIllustrative only

Debounce the quote call

let t;
slider.addEventListener('input', () => {
  clearTimeout(t);
  t = setTimeout(async () => {
    const res = await fetch(`${BASE}/quote`, {
      method: 'POST', headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ amount: Number(slider.value), term_months: 6 }),
    });
    const q = await res.json();
    output.textContent = `\u00a3${q.repayment}/month`;
  }, 300);
});

A 300ms debounce means one call per pause, not one per pixel — smooth for the user and easy on the limit.

Prefer client-side maths where you can

If you fetch pricing config once, you can compute the illustration entirely in the browser and skip the per-drag call altogether. Reserve the quote endpoint for the final confirmed figure.

Frequently asked questions

Will a slider trip the rate limit?

Not if you debounce. One call per pause keeps you comfortably under the limit; without debouncing a drag could fire dozens of calls.

Client-side or API maths?

Fetch pricing config and compute in the browser for a smooth slider, then confirm with a real quote before the reader applies.

Funding for UK limited companies

Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.