This is a public project demonstrating how to integrate modern payment methods like Apple Pay and Google Pay into a Laravel application. It is built with the TALL stack (Tailwind CSS, Alpine.js, Livewire, and Laravel) and uses Stripe Payment Intents for a secure and robust payment flow.
- Stripe Payment Intents: Securely process payments without ever having your server handle sensitive card information.
- Dynamic Payment Element: Stripe's single UI component automatically displays relevant payment methods to the user (Cards, Google Pay, Apple Pay, etc.).
- TALL Stack: A fully reactive frontend experience built with Livewire and Alpine.js.
- Secure API Key Handling: Follows Laravel best practices for managing secret keys using the
.envfile.
Follow these instructions to get the project up and running on your local machine.
- PHP >= 8.2
- Composer
- Node.js & NPM
- A Stripe Account
-
Clone the repository:
git clone [https://github.com/phccoder/laravel-payment-gateway.git](https://github.com/phccoder/laravel-payment-gateway.git) cd laravel-payment-gateway -
Install dependencies:
composer install npm install npm run build
-
Set up your environment file:
cp .env.example .env
-
Generate an application key:
php artisan key:generate
-
Add your Stripe API keys:
- Log in to your Stripe Dashboard.
- Open your
.envfile and add your Publishable Key and Secret Key.
STRIPE_KEY=pk_test_YourPublishableKeyGoesHere STRIPE_SECRET=sk_test_YourSecretKeyGoesHere
-
Run the database migrations:
php artisan migrate
-
Serve the application:
php artisan serve
Once the application is running, navigate to the following URL in your browser to see the payment form in action:
http://127.0.0.1:8000/pay
This project is configured to use environment variables for API keys. Your .env file is included in .gitignore by default. Never commit your .env file or hardcode your secret API keys directly into your application code.
This project is open-sourced software licensed under the MIT license.