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.