klarna/checkout
Deprecated Klarna Checkout PHP library/SDK for integrating Klarna Checkout. This package is no longer supported; use the maintained replacement klarna/kco_rest_php instead. Documentation and examples available at developers.klarna.com.
queue:work for async processing).POST /checkout/v3/orders) into method chaining (e.g., Klarna::createOrder()).KlarnaAuthMiddleware).queue:work with retries (e.g., spatie/laravel-queue-retries).KlarnaPaymentCaptured).klarna_order_id in orders table) for reconciliation.klarna/kco_rest_php..env and not hardcoded.klarna/laravel-checkout) that reduce this risk?omnipay/klarna) for feature parity.AppServiceProvider::boot() with config binding:
$this->app->singleton(Klarna::class, function ($app) {
return new Klarna([
'shared_secret' => config('services.klarna.shared_secret'),
'api_url' => config('services.klarna.api_url'),
]);
});
Http facade for low-level API calls if extending the wrapper.event(new KlarnaPaymentEvent($webhookPayload));
KlarnaWebhook::dispatch($payload)->onQueue('klarna');
klarna_order_id to orders table and use Eloquent relationships:
public function klarnaOrder()
{
return $this->hasOne(KlarnaOrder::class, 'order_id');
}
https://api.playground.klarna.com).config('features.klarna_enabled')) to toggle Klarna flows.spatie/laravel-circuitbreaker) to switch to a backup payment method (e.g., Stripe) if Klarna fails.composer require klarna/checkout..env:
KLARNA_SHARED_SECRET=your_secret
KLARNA_API_URL=https://api.klarna.com
KLARNA_WEBHOOK_URL=https://your-app.com/klarna/webhook
$order = Klarna::createOrder([
'purchase_country' => 'SE',
'lines' => [['type' => 'physical', 'reference' => '123', 'quantity' => 1, 'unit_price' => 1000]],
]);
Route::post('/klarna/webhook', [KlarnaWebhookController::class, 'handle']);
KlarnaService::handlePayment()).Log::channel('klarna')->info('Order created', ['order_id' => $order->id]);
laravel-monitor).composer show klarna/checkout).composer.json:
"require": {
"klarna/checkout": "4.0.0"
}
phpunit/phpunit compatibility).shared_secret).integration@klarna.com).use Spatie\QueueRetries\Retryable;
class KlarnaWebhook implements Retryable { ... }
$order = Cache::remember("klarna_order_{$id}", now()->addHours(
How can I help you explore Laravel packages today?