This project demonstrates the integration of Xendit payment gateway with Laravel 11. It includes a simple product catalog and checkout system with various payment methods supported by Xendit.
- Product catalog with price and stock management
- Simple checkout process
- Multiple payment methods through Xendit
- Payment status webhook handling
- Stock management after successful payment
- Responsive design with Tailwind CSS
- PHP >= 8.2
- Laravel 11.x
- Composer
- MySQL/PostgreSQL
- Xendit account and API keys
- Clone the repository
git clone https://github.com/iritmaulana/laravel-xendit.git
cd laravel-xendit
- Install dependencies
composer install
- Create and configure .env file
cp .env.example .env
- Configure your database and Xendit credentials in .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password
XENDIT_SECRET_KEY=your_xendit_key_here
XENDIT_CALLBACK_TOKEN=your_callback_token_here
- Generate application key
php artisan key:generate
- Run migrations and seeders
php artisan migrate --seed
- id
- name
- description
- price
- stock
- image
- timestamps
- id
- product_id
- invoice_id
- amount
- status
- payment_method
- payment_channel
- payment_status
- customer_name
- customer_email
- timestamps
- GET
/
- Product listing page - GET
/products/{product}
- Product detail page - POST
/products/{product}/order
- Create new order - POST
/payment/callback
- Xendit webhook endpoint - GET
/payment/success
- Payment success page - GET
/payment/failed
- Payment failed page
- User selects a product
- User fills in customer details (name and email)
- System creates Xendit invoice
- User is redirected to Xendit payment page
- User completes payment
- Xendit sends webhook notification
- System updates order status and product stock
- User is redirected to success/failed page
- Bank Transfer (BCA, BNI, BSI, BRI, Mandiri, Permata)
- Retail Outlets (Alfamart, Indomaret)
- E-Wallets (OVO, DANA, LinkAja)
- QRIS
- Log in to your Xendit Dashboard
- Go to Settings > Webhooks
- Add new webhook URL:
https://your-domain.com/payment/callback
- Make sure to set the callback token in your .env file
To run the development server:
php artisan serve
Run the test suite:
php artisan test
- Webhook verification using callback tokens
- Input validation
- SQL injection prevention through Laravel's query builder
- XSS protection through Laravel's built-in security features
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is open-sourced software licensed under the MIT license.
For support, contact the development team or raise an issue in the GitHub repository.
- GitHub: @iritmaulana
- Email: iritmaulana@gmail.com