Recipe

Quote a Business Loan with the PHP SDK

The PHP SDK wraps the public quote endpoint so you fetch a live figure in three lines. It handles the HTTP, the JSON and the range error — you pass an amount and a term.

2 min read

PHPSDK
PublicNo token
£50–£500Range

Construct and call

Point the public client at the hub and call the quote method with an amount and term within the engine range:

$credicorp = new Credicorp\\PublicClient();
$quote = $credicorp->quote()->oneTime(amount: 300, term: 30, frequency: 'weekly');
echo $quote->totalRepayable;

Handle the range error

An out-of-range amount or term surfaces as a typed range exception rather than a raw 422 — catch it and clamp:

try {
    $quote = $credicorp->quote()->oneTime(amount: $amount, term: $term);
} catch (Credicorp\\RangeException $e) {
    // amount 50-500, term 14-84 — clamp and retry
}

When to drop to raw HTTP

For a single public read like this, raw HTTP is also fine — see the quote-widget recipe. The SDK earns its keep on partner flows with token and retry handling. See choosing an SDK.

Frequently asked questions

Does the PHP SDK need a token for quotes?

No. Quotes are on the public ring, so the public client needs no credential. You only authenticate the SDK when you use the partner-ring methods.

How does the SDK surface the 422 range error?

As a typed RangeException rather than a raw HTTP error, so you can catch it and clamp the amount (50-500) or term (14-84) idiomatically.

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.