Quickstart

Quickstart: use the Credicorp public API in Vue 3

Here is the idiomatic way to call the Credicorp public API from Vue 3. Fetch the product catalogue, cache it, and read the base host from configuration — the same shape you extend later for pricing and quotes, always keeping partner secrets server-side.

2 min read

Vue 3Idiomatic integration
cacheCatalogue changes rarely
configBase URL from env

Call the API from Vue 3

<script setup>
import { ref, onMounted } from 'vue';
const products = ref([]);
onMounted(async () => {
  const res = await fetch(`${import.meta.env.VITE_CREDICORP_BASE}/products`);
  products.value = (await res.json()).data;
});
</script>

<template>
  <ul><li v-for="p in products" :key="p.id">{{ p.name }}</li></ul>
</template>

Fetch in `onMounted` and hold the result in a `ref`. As with any front-end, the base URL is a public env var and no secret ever ships to the browser.

Point at sandbox in development

Set the base URL to https://sandbox.credicorp.co.uk/public/v1 in development and CI, and to https://api.credicorp.co.uk/public/v1 in production — driven by the one environment variable your framework already exposes. See choosing a base URL.

Next steps

From here you can add a quote form, an enquiry submission or an embeddable product picker. Send applicants to apply to start a real journey.

Frequently asked questions

Do I need a store?

For a single read like the product list, a component ref is enough. Reach for Pinia only when several components share the same fetched data.

Should I cache the product list?

Yes. The catalogue changes infrequently, so cache it for the response's max-age. This keeps the API off your hot path and well under the rate limit.

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.