peppertech / larapaymongo
Laravel-Paymongo Payment Integration
Requires
- laravel/ui: ^2.1
- luigel/laravel-paymongo: ^1.3
This package is not auto-updated.
Last update: 2025-03-20 17:58:39 UTC
README
Overview
LaraPaymongo is a PayMongo integration with Laravel. Paymongo currently supports Credit/Debit Cards (Philippines only), GCash and GrabPay Payments. LaraPaymongo provides an easy way to integrate your Laravel website with Paymongo.
Features
- Ready-made Payment Pages and Purchase Button UI component
- Laravel routes, controllers views are ready-made - almost plug-and-play.
- Developers just need to define their application's logic before and after payments are made.
Installation
composer require peppertech/larapaymongo
Configuration
Environment variables
Variable | Required | Description | Default Value |
---|---|---|---|
MIX_PAYMONGO_API_URL | Yes | PayMongo API URL | https://api.paymongo.com/v1 |
MIX_PAYMONGO_PUBLIC_KEY | Yes | PayMongo Public Key. Values for Test or Live will be provided. | none |
PAYMONGO_STATEMENT_DESCRIPTOR | Yes | The string that will appear on customer Billing Statement. This should be different per project. | none |
PAYMONGO_SECRET_KEY | Yes | PayMongo Secret Key. Values for Test or Live will be provided. | none |
PAYMONGO_PUBLIC_KEY | Yes | PayMongo Public Key. same as MIX_PAYMONGO_PUBLIC_KEY | none |
PAYMONGO_WEBHOOK_SIG | NO | PayMongo Webhook Signature. This should be different per project. Generated using PayMongo API only once per project. | none |
Integration
- Run the followign command to copy VueJS files and the
LaraPaymongoIntegrator
class to the main app
php artisan vendor:publish --tag="larapaymongo" --force
LaraPaymongoIntegrator
class
The publish command will copy LaraPaymongoIntegrator
in /app
diectory. This class will contain the necessary logic of your application to be ran before and after payment is done by the user.
updateTransactionSourceId()
method is called by LaraPaymongo when Source ID needs to be save in database against the Transaction Reference ID (this could be the Order ID in your application).getTransactionDetails()
method is called by LaraPaymongo when it needs the Transaction Details for the purchase. This method should query your database to retrive the information.completeTransaction()
method is called by LaraPaymongo after the payment is successful.
Vue Components
Vue Components are copied from this package to your app in resources/js/components
.
Ready-made Routes and Views
Here are the available routes and views for LaraPaymongo
/payment/<referid>
The Payment Page, wherereferid
is the Transaction Reference ID./payment/source/{method}/{referId}
URL that gets called to generate a Source ID from Paymongo, when GCash/GrabPay payments are selected, wheremethod
can begcash|grab_pay
andreferId
is the Transaction Reference ID./payment/verify/{paymentIntentId}
, callback URL when Card Payment is successful. wherepaymentIntentId
is Paymongo Payment Intent ID./payment/details/{referId}
callback URL for GCash and GrabPay payments. It can also be used to check the status of the Transaction.
IMPORTANT: The Views/payment.blade.php
of this package extends from view/layouts.app
of your app, so it should exist in your application's views.
Testing
- After Installation and Configuration, navigate to
http://<your app domain>/payment/111
, it should show the Payment Page. - Use the Test Credit Card numbers from PayMongo Testing