- Can I use andrepayone/payone-symfony-bundle directly in a Laravel project?
- No, this bundle is designed for Symfony and requires adaptation. You’ll need to use the underlying SDK (`andrepayone/payone-sdk`) directly or build a Laravel wrapper via Service Providers to bridge Symfony’s DI and event systems. Start by installing the SDK alone for basic transactions.
- How do I handle PAYONE webhooks in Laravel if I’m using this bundle?
- Create a Laravel route for `/payone/webhook`, validate HMAC signatures with `hash_hmac('sha512', $payload, config('payone.webhook_secret'))`, and dispatch a custom event (e.g., `PayoneWebhookHandled`). Use Laravel’s middleware to filter and queue webhook processing for idempotency.
- What Laravel versions support this bundle’s underlying SDK (payone-sdk v0.3.1)?
- The SDK requires PHP 8.0+, so Laravel 8.x+ is compatible. Test thoroughly with your Laravel version, as Symfony components may introduce minor breaking changes. Pin the SDK version in `composer.json` to avoid updates.
- How do I mock PAYONE API responses for testing in Laravel?
- Use Laravel’s HTTP testing helpers (`$this->post('/payments', [...])`) with a mock HTTP client like `mockery` or `VCR` to record PAYONE sandbox responses. Alternatively, stub the `PayoneClient` interface in PHPUnit to return predefined transaction results.
- What’s the best way to manage payment failures in Laravel with this bundle?
- Trigger Laravel’s exception system for critical failures (e.g., `throw new PaymentFailedException`) or dispatch a custom `PaymentFailed` event for async handling. Log failures to Laravel’s `logs` table and notify admins via `Notification::route()` if needed.
- Are there Laravel-native alternatives to this Symfony bundle?
- Yes, consider standalone packages like `spatie/laravel-payone` (if available) or build a custom Laravel package by extracting the SDK’s core logic. The effort depends on your needs—Symfony’s bundle offers more features out-of-the-box but requires adaptation.
- How do I handle duplicate PAYONE webhook deliveries in Laravel?
- Use Laravel’s queue system: store webhook payloads in a `webhook_attempts` table with `attempts` and `failed_at` columns. Retry failed jobs via `queue:failed` or implement idempotency keys in your payloads to skip duplicates.
- What’s the migration path from Symfony to Laravel for this bundle?
- Phase 1: Install `andrepayone/payone-sdk` directly in Laravel and implement basic transactions. Phase 2: Add webhook validation and event dispatching. Phase 3 (optional): Wrap the bundle in a Laravel Service Provider to unify DI and events.
- Does this bundle support Laravel’s queue system for async payment processing?
- Indirectly—you’ll need to dispatch queued jobs (e.g., `PaymentProcessJob`) from Laravel’s event listeners or webhook handlers. The SDK itself doesn’t queue, but you can integrate it with Laravel Queues for refunds, payouts, or status updates.
- How do I configure the bundle’s Symfony dependencies in Laravel’s Service Provider?
- Bind Symfony interfaces (e.g., `PayoneClientInterface`) to Laravel’s container using `$this->app->bind(PayoneClientInterface::class, function ($app) { return new PayoneClient($app['config']['payone']); });`. Avoid direct Symfony DI—use Laravel’s bindings to resolve dependencies.