Add PayPal checkout provider

This commit is contained in:
Codex Agent
2026-02-04 12:18:14 +01:00
parent 56a39d0535
commit fc5dfb272c
33 changed files with 1586 additions and 571 deletions

View File

@@ -74,6 +74,8 @@ class CheckoutSessionService
$session->status = CheckoutSession::STATUS_DRAFT;
$session->lemonsqueezy_checkout_id = null;
$session->lemonsqueezy_order_id = null;
$session->paypal_order_id = null;
$session->paypal_capture_id = null;
$session->provider_metadata = [];
$session->failure_reason = null;
$session->coupon()->dissociate();
@@ -117,10 +119,20 @@ class CheckoutSessionService
{
$provider = strtolower($provider);
if (! in_array($provider, [
CheckoutSession::PROVIDER_LEMONSQUEEZY,
CheckoutSession::PROVIDER_FREE,
], true)) {
$configuredProviders = config('checkout.providers', []);
if (! is_array($configuredProviders) || $configuredProviders === []) {
$configuredProviders = [
CheckoutSession::PROVIDER_LEMONSQUEEZY,
CheckoutSession::PROVIDER_PAYPAL,
CheckoutSession::PROVIDER_FREE,
];
}
if (! in_array(CheckoutSession::PROVIDER_FREE, $configuredProviders, true)) {
$configuredProviders[] = CheckoutSession::PROVIDER_FREE;
}
if (! in_array($provider, $configuredProviders, true)) {
throw new RuntimeException("Unsupported checkout provider [{$provider}]");
}