Files
ladill-mini/app/Services/Pay/PayClient.php
T
isaaccladandCursor cf6dda5793
Deploy Ladill Mini / deploy (push) Successful in 29s
Route Mini payments through Ladill Pay API.
Checkout and settlement now go via platform Pay instead of direct Paystack + Billing credit, with legacy MIN-* support retained.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 05:20:09 +00:00

51 lines
1.3 KiB
PHP

<?php
namespace App\Services\Pay;
use Illuminate\Support\Facades\Http;
/**
* Client for the platform Ladill Pay HTTP API — checkout and settlement for
* merchant↔buyer money. Paystack is the processor today; settlement lands in
* the one UserWallet via Platform Billing.
*/
class PayClient
{
private function base(): string
{
return rtrim((string) config('pay.api_url'), '/');
}
private function token(): string
{
return (string) (config('pay.api_key') ?? '');
}
/** @param array<string,mixed> $payload */
public function createCheckout(array $payload): array
{
$res = Http::withToken($this->token())->acceptJson()->timeout(15)->post($this->base().'/checkouts', $payload);
$res->throw();
return (array) $res->json();
}
public function verify(string $reference): array
{
$res = Http::withToken($this->token())->acceptJson()->timeout(15)->post($this->base().'/checkouts/verify', [
'reference' => $reference,
]);
$res->throw();
return (array) $res->json();
}
public function show(string $reference): array
{
$res = Http::withToken($this->token())->acceptJson()->timeout(10)->get($this->base().'/orders/'.$reference);
$res->throw();
return (array) $res->json();
}
}