Deploy Ladill Events / deploy (push) Successful in 29s
Ticket and contribution checkouts use platform Pay for fees and wallet settlement, with legacy QREP-* fallback via Billing. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.3 KiB
PHP
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();
|
|
}
|
|
}
|