luigel/laravel-paymongo
Paymongo for Laravel
A Laravel client for the PayMongo API. Typed responses, first-class webhooks, built-in testing fakes.
This package is not affiliated with PayMongo.
- Full documentation: https://paymongo.rigelkentcarbonel.com/docs
- Upgrading from 2.x? Read the upgrade guide.
Requirements
- PHP 8.2 or newer (Laravel 13 itself requires PHP 8.3+)
- Laravel 11, 12, or 13
Installation
composer require luigel/laravel-paymongo:^3.0
Add your keys to .env (grab them from the PayMongo dashboard):
PAYMONGO_SECRET_KEY=sk_test_...
PAYMONGO_PUBLIC_KEY=pk_test_...
# The endpoint secret_key returned when you register a webhook.
PAYMONGO_WEBHOOK_SECRET=whsk_...
Optionally publish the config file to config/paymongo.php:
php artisan vendor:publish --tag=paymongo-config
Example
use Luigel\Paymongo\Enums\PaymentIntentStatus;
use Luigel\Paymongo\Facades\Paymongo;
// 1. Create the intent. Amounts are integer centavos: 150050 = PHP 1,500.50.
$intent = Paymongo::paymentIntents()->create([
'amount' => 150050,
'currency' => 'PHP',
'payment_method_allowed' => ['card'],
'description' => 'Order #1234',
]);
// 2. Create a payment method (normally done client-side with your public key).
$method = Paymongo::paymentMethods()->create([
'type' => 'card',
'details' => [
'card_number' => '4343434343434345',
'exp_month' => 12,
'exp_year' => 34,
'cvc' => '123',
],
]);
// 3. Attach it to the intent to trigger the payment.
$intent = Paymongo::paymentIntents()->attach($intent->id, $method->id);
if ($intent->status === PaymentIntentStatus::Succeeded) {
// Paid. $intent->payments holds the resulting Payment resources.
}
Documentation
Guides for every flow (Checkout Sessions, Payment Intents, Payment Links, QR Ph, refunds, subscriptions), webhooks, testing with Paymongo::fake(), and the full reference live at https://paymongo.rigelkentcarbonel.com/docs.
License
The MIT License (MIT). Please see License File for more information.
Related Packages
syedmahamudul/sslcommerz-laravel
The easiest SSLCommerz payment gateway package for Laravel with automatic valida...
14
4
ideacrafters/satim-laravel
Laravel package for integrating with Satim payment gateway (official Algerian in...
2,344
1
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.1 | ^8.2 | ^11.0| | MIT | |
| v3.0.0 | ^8.2 | ^11.0| | MIT | |
| v2.6.0 | ^8.2 | ^10.0| | MIT | |
| v2.5.0 | ^8.0 | ^8.0| | MIT | |
| v2.4.0 | ^8.0 | ^8.0| | MIT | |
| v2.3.0 | ^8.0 | ^8.0| | MIT | |
| v2.2.0 | ^8.0 | ^8.0| | MIT | |
| v2.1.2 | ^8.0 | ^8.0| | MIT | |
| v2.1.1 | ^8.0 | ^8.0 | MIT | |
| v2.1.0 | ^8.0 | ^8.0 | MIT | |
| v2.0.0 | ^8.0 | ^8.0 | MIT | |
| v1.5.0 | ^7.2| | ^6.0| | MIT | |
| v1.4.1 | ^7.0| | ^6.0| | MIT | |
| v1.4.0 | ^7.0| | ^6.0| | MIT | |
| v1.3.4 | ^7.0| | ^6.0| | MIT | |
| v1.3.3 | ^7.0| | ^6.0| | MIT | |
| v1.3.2 | ^7.0| | ^6.0| | MIT | |
| v1.3.1 | ^7.0| | ^6.0| | MIT | |
| v1.3.0 | ^7.0| | ^6.0| | MIT | |
| v1.2.2 | ^7.0| | 5.8.*| | MIT | |
| v1.2.1 | ^7.0| | 5.8.*| | MIT | |
| v1.2.0 | ^7.0| | 5.*| | MIT | |
| v1.1.2 | ^7.0| | 5.*| | MIT | |
| v1.1.1 | ^7.0| | 5.*| | MIT | |
| v1.1.0 | ^7.0| | 5.*| | MIT | |
| v1.0.0 | ^7.0| | 5.*| | MIT |
Pre-releases (2)
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.0-beta.2 | ^8.2 | ^11.0| | MIT | |
| v3.0.0-beta.1 | ^8.2 | ^11.0| | MIT |