- How do I install luigel/laravel-paymongo in a Laravel application?
- Install it with Composer using composer require luigel/laravel-paymongo. Laravel package auto-discovery registers the service provider and the Paymongo facade, so no manual registration is normally needed. Publish the config file with php artisan vendor:publish and then add your PayMongo keys to your .env file. Confirm that your PHP and Laravel versions satisfy the package composer.json and that guzzlehttp/guzzle is present.
- Which Laravel and PHP versions does laravel-paymongo support?
- The package requires a standard PHP and Laravel version floor plus guzzlehttp/guzzle, but the exact constraints are defined in its composer.json and change between releases. Check that file against your actual PHP and Laravel matrix before committing, especially if you run older Laravel versions. Because it is a leaf dependency with no framework coupling beyond events and config, upgrading your own stack is usually the bigger constraint.
- How do I configure my PayMongo API keys and webhook signing secret?
- Publish the package config file and set your public key, secret key, and webhook signing secret through the environment variables the config reads. Keep the secret key and webhook secret out of version control and use separate keys per environment in the PayMongo dashboard. Never expose the secret key to the browser, since front-end flows only need the public key.
- How do I accept GCash or card payments with laravel-paymongo?
- For e-wallets such as GCash you typically create a source, redirect the customer to the returned checkout URL, and then create a payment once the source is chargeable. For cards you generally create a payment intent and attach a payment method, or use a hosted checkout session. The package exposes fluent methods for sources, payment intents, and checkout sessions, so the flow stays close to PayMongo's own API documentation.
- What is the difference between payment intents, sources, and checkout sessions in PayMongo?
- A payment intent represents the overall attempt to collect a specific amount and tracks its status through to success or failure. A source is the redirect-based authorization flow used by e-wallets and other asynchronous methods like GCash. A checkout session is PayMongo's hosted payment page, which bundles line items and multiple payment methods behind a single URL. Most integrations use sources or checkout sessions at the edge and payment intents underneath.
- How do I handle PayMongo webhooks in Laravel with this package?
- The package ships a webhook route and controller that verifies the PayMongo signature and maps incoming payloads into Laravel events. You register the package webhook URL in the PayMongo dashboard and then add listeners for the Luigel\Paymongo\Events classes you care about. A generic WebhookReceived event is also dispatched for anything not explicitly enumerated, which is the safer hook to depend on. Register your listeners in an EventServiceProvider or via Event::listen and keep the handler idempotent.
- Why did my webhook listener break after upgrading to laravel-paymongo 3.0.1?
- Version 3.0.1 removed nine WebhookEventType enum cases and their matching Luigel\Paymongo\Events classes, including payment_intent.succeeded, subscription.activated, qr.paid, refund.succeeded, dispute.created, and the payout events. Any use statement, Event::listen registration, match arm, or config referencing those names will now fail at class load or throw an UnhandledMatchError, and WebhookEventType::from() on a stored string can throw a ValueError. PayMongo never actually emitted these events, so live payment flows should not have depended on them, but your tests, fixtures, and dashboards may still reference them. Pin the exact version 3.0.1 rather than a caret constraint and expect similar removals in future patch releases.
- Should I use the generic WebhookReceived event instead of the specific PayMongo event classes?
- Yes, for anything money-critical. Unrecognized or missing event names still dispatch WebhookReceived, which preserves forward compatibility when PayMongo adds, renames, or removes events. Route that event into an idempotent, logged consumer that persists the payload before acting on it. You can still listen to specific event classes for convenience, but do not make them the only path your payment state machine depends on.
- How do I test a PayMongo integration without hitting the live API?
- Mock Laravel's HTTP client and return recorded PayMongo payloads for the endpoints your code calls, then assert that the right jobs and listeners fire. Be careful with stored or fixture event strings: any removed value passed to WebhookEventType::from() will throw a ValueError in tests. Also test the signature verification path and the generic WebhookReceived handler, since that is the branch you want to survive future package changes. No database schema is owned by the package, so test fixtures are mostly payloads and event assertions.
- Is luigel/laravel-paymongo production-ready, and what are the alternatives?
- It is a thin, conventional boundary adapter with a small architectural surface area: a service provider, facade, config file, webhook controller, and event translation. That makes it reasonable in production if you isolate it behind an application-owned payment interface and add idempotency keys, a persisted webhook log, signature verification, and reconciliation against the PayMongo API. The main caution is maintenance and bus factor, so keep a fork-or-wrap contingency and confirm that refunds, disputes, and payouts are observable by polling the API. Alternatives are calling the PayMongo REST API directly with Guzzle or using PayMongo's official PHP SDK without the Laravel conveniences.