vfixtechnology / bagisto-cashfree
Cashfree payment gateway for bagisto laravel open source ecommerce platform.
Package info
github.com/vfixtechnology/bagisto-cashfree
pkg:composer/vfixtechnology/bagisto-cashfree
Requires
None
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A modern Cashfree payment gateway integration for Bagisto with secure webhook-based order creation.
โจ Features
- ๐ณ Cashfree Checkout support for Sandbox and Live environments
- ๐ Automatic order creation via webhook โ even if the customer never returns to the store
- ๐ HMAC signature verification for every webhook request
- โป๏ธ Idempotent order creation โ no duplicate orders from redirect + webhook overlaps
- ๐งพ Automatic invoice generation after successful payment
- ๐ท๏ธ Cart mapping via Cashfree
order_tags - ๐ก๏ธ Server-side payment status verification with the Cashfree API
- ๐งฉ Supports both modern JSON webhooks and legacy form-encoded webhooks
- ๐ฆ Bagisto native order, invoice, and payment records
๐ Requirements
- ๐ Bagisto 2.x
- ๐ PHP 8.1+
- ๐ PHP cURL extension
- ๐ Cashfree merchant account with API credentials
๐ Installation
The package ships with its own service provider, payment method configuration, routes, and webhook handler, so once Composer has downloaded it you only need to register the provider and enable the payment method from the Bagisto admin panel.
๐ ๏ธ Need help with installation? Paid installation support is available.
๐ Call: +91 8447 525 204
๐ฌ WhatsApp: +91 8447 525 204
1๏ธโฃ Install via Composer
composer require vfixtechnology/bagisto-cashfree
2๏ธโฃ Register the service provider
Add the provider to bootstrap/providers.php:
Vfixtechnology\Cashfree\Providers\CashfreeServiceProvider::class,
3๏ธโฃ Clear the configuration cache
php artisan optimize:clear
4๏ธโฃ Enable the payment method
Go to Admin Panel โ Configure โ Sales โ Payment Methods โ Cashfree.
โ๏ธ Configuration
Get your credentials from the Cashfree dashboard:
Cashfree Dashboard โ Developers โ API Keys
| Setting | Description |
|---|---|
| ๐ท๏ธ Title | Payment method name shown at checkout |
| ๐ Website Status | Sandbox for testing, Live for production |
| ๐ Client ID | Cashfree App ID |
| ๐ Secret Key | Cashfree Secret Key |
| ๐ Webhook URL | Optional. Leave blank to use /cashfree/webhook |
| โ Status | Enable or disable the payment method |
๐ Webhook Setup (Recommended)
The webhook is the most reliable way to create the Bagisto order. It runs server-to-server, so the order is still created when:
- ๐ช The customer closes the browser after paying
- ๐ด The connection drops during the redirect back to the store
- ๐ฑ The customer switches to a UPI app and never returns
- โณ The return URL arrives before Cashfree finishes processing the payment
Configure it in Cashfree
- Go to Cashfree Dashboard โ Payment Gateway โ Developers โ Webhook Configuration.
- Add your endpoint:
https://your-store.com/cashfree/webhook
- Subscribe to the Payment Success event:
PAYMENT_SUCCESS_WEBHOOK
- Save the configuration.
๐ก The webhook URL is also sent automatically in the Cashfree order's
notify_url. In production, Cashfree requires an HTTPS URL.
How the webhook works
Customer pays
โ
โโโ โถ Return URL โโโ
โ โโโ โถ Verify payment โโ โถ Create order (once)
โโโ โถ Webhook โโโโโโโ
- ๐ Verifies the
x-webhook-signatureheader using your Cashfree secret - ๐ Resolves the Bagisto cart from
order_tags.cart_idor the Cashfree order id - ๐ฐ Confirms the payment status with the Cashfree API
- ๐ฆ Creates the order and invoice inside a database transaction
- โป๏ธ Skips creation if an order already exists for that cart
- ๐งพ Supports legacy form-encoded webhooks by confirming the order with Cashfree before creating anything
โฉ๏ธ Return URL
The package automatically sends its return URL to Cashfree in the order's return_url:
https://your-store.com/cashfree/callback
You do not need to configure this manually. After payment, Cashfree redirects the customer to this URL, where the package verifies the payment and shows the success page.
๐ก The return URL can fail if the customer closes the browser or loses connection โ that is why the webhook is recommended as the primary order-creation path. If both fire, the order is still created only once.
๐ Payment Flow
- ๐๏ธ Customer selects Cashfree at checkout.
- ๐ Bagisto creates a Cashfree order and redirects the customer to the payment page.
- โ After payment, Cashfree calls both the return URL and the webhook.
- ๐ The package verifies the payment and creates the Bagisto order exactly once.
- ๐ The customer is redirected to the success page, or the order is created silently by the webhook.
๐งช Sandbox Testing
- Set Website Status to
Sandbox. - Use your sandbox Client ID and Secret Key.
- Add your webhook URL in the Cashfree sandbox dashboard.
- For local development, expose your store with a tunnel such as ngrok and use the HTTPS URL as the webhook URL.
๐ ๏ธ Troubleshooting
| Problem | Solution |
|---|---|
| โ Webhook does not create an order | Check the webhook URL, event selection, and Cashfree secret |
| ๐ Signature verification fails | Ensure the Secret Key matches the Cashfree environment |
| ๐ Webhook is not reachable | Use a public HTTPS URL; localhost is not accessible from Cashfree |
| โป๏ธ Duplicate order concern | Orders are created only once per cart, even if both redirect and webhook fire |
| โ๏ธ Settings not updating | Run php artisan optimize:clear |
Logs are written to storage/logs/laravel.log with the Cashfree prefix.
๐ ๏ธ Paid Installation Support
Need Cashfree installed, configured, or customized for your Bagisto store? Vfix Technology provides paid installation and customization support.
- ๐ Call: +91 8447 525 204
- ๐ฌ WhatsApp: +91 8447 525 204
- โ๏ธ Email: info@vfixtechnology.com
๐ค Support This Project
If this package helps your store, please consider:
- โญ Starring the repository
- ๐ฃ Sharing it with your developer community
- ๐ Reporting issues you encounter
Your support helps keep this project maintained and improving for everyone. โค๏ธ
๐ฌ Contact
For help, paid installation, or customization:
- ๐ Website: vfixtechnology.com
- โ๏ธ Email: info@vfixtechnology.com
- ๐ Phone: +91 8447 525 204
- ๐ฌ WhatsApp: +91 8447 525 204
Made with โค๏ธ by Vfix Technology