Add Business tier and Paystack prepaid billing for POS.
Deploy Ladill POS / deploy (push) Successful in 35s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-30 01:55:38 +00:00
co-authored by Cursor
parent f800f0c1ca
commit d66e656b9c
11 changed files with 403 additions and 90 deletions
+48
View File
@@ -49,4 +49,52 @@ class BillingClient
return ['ok' => true, 'insufficient' => false, 'balance_minor' => null, 'error' => null];
}
/**
* @param array<string, mixed> $metadata
* @return array{checkout_url: string, reference: string}
*/
public function initiatePlanCheckout(
User $user,
string $plan,
int $months,
int $amountMinor,
string $returnUrl,
array $metadata = [],
): array {
$res = Http::withToken((string) config('billing.api_key'))
->acceptJson()->timeout(15)
->post(rtrim((string) config('billing.api_url'), '/').'/plan-checkout', [
'user' => $user->public_id,
'app' => (string) config('billing.service', 'pos'),
'plan' => $plan,
'months' => $months,
'amount_minor' => $amountMinor,
'return_url' => $returnUrl,
'metadata' => $metadata,
]);
$res->throw();
return [
'checkout_url' => (string) $res->json('checkout_url'),
'reference' => (string) $res->json('reference'),
];
}
/** @return array<string, mixed> */
public function verifyPlanCheckout(string $reference): array
{
$res = Http::withToken((string) config('billing.api_key'))
->acceptJson()->timeout(15)
->post(rtrim((string) config('billing.api_url'), '/').'/plan-checkout/verify', [
'reference' => $reference,
]);
if ($res->status() === 422) {
return ['paid' => false, 'error' => $res->json('error')];
}
$res->throw();
return $res->json();
}
}