Recipe

Call the public API from PHP

Call the Credicorp public API from PHP with curl. Read the loyalty ladder and post an enquiry using the curl extension, with a check for the 429 rate-limit response. Copy-paste snippets for both a read and a write, no key needed.

2 min read

ext-curlStandard PHP
read+writeBoth shown
no keyPublic ring

Read the loyalty tiers

$ch = curl_init('https://hub.credicorp.co.uk/public/v1/loyalty/tiers');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code === 200) {
  $data = json_decode($body, true);
  foreach ($data['tiers'] as $t) {
    echo $t['name'].': '.$t['benefit']['arrangement_fee_discount_pct']."%\n";
  }
}

Submit an enquiry

$payload = json_encode([
  'form' => 'contact-us', 'dept' => 'support',
  'fields' => ['name' => 'Jordan', 'email' => '[email protected]', 'consent' => 'yes'],
]);
$ch = curl_init('https://hub.credicorp.co.uk/public/v1/enquiries');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
  CURLOPT_POSTFIELDS => $payload,
]);
$body = json_decode(curl_exec($ch), true);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $code === 201 ? $body['id'] : $body['error']['code'];

Notes

On a 429, read the Retry-After response header and back off. Keep fields flat and set consent to "yes". See the enquiries reference.

Frequently asked questions

Which PHP extension do I need?

The standard curl extension (ext-curl). No third-party SDK and no API key are required for the public ring.

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.