Search by

vfixtechnology / bagisto-cashfree

vfixtechnology.com

Cashfree payment gateway for bagisto laravel open source ecommerce platform.

Package info

github.com/vfixtechnology/bagisto-cashfree

pkg:composer/vfixtechnology/bagisto-cashfree

Statistics

Installs: 67

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.6 2026-10-29 12:01 UTC

This package is auto-updated.

Last update: 2026-11-13 18:07:47 UTC


README

Latest Version Total Downloads License

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

  1. Go to Cashfree Dashboard โ†’ Payment Gateway โ†’ Developers โ†’ Webhook Configuration.
  2. Add your endpoint:
https://your-store.com/cashfree/webhook
  1. Subscribe to the Payment Success event:
PAYMENT_SUCCESS_WEBHOOK
  1. 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-signature header using your Cashfree secret
  • ๐Ÿ›’ Resolves the Bagisto cart from order_tags.cart_id or 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

  1. ๐Ÿ›๏ธ Customer selects Cashfree at checkout.
  2. ๐ŸŒ Bagisto creates a Cashfree order and redirects the customer to the payment page.
  3. โœ… After payment, Cashfree calls both the return URL and the webhook.
  4. ๐Ÿ” The package verifies the payment and creates the Bagisto order exactly once.
  5. ๐ŸŽ‰ The customer is redirected to the success page, or the order is created silently by the webhook.

๐Ÿงช Sandbox Testing

  1. Set Website Status to Sandbox.
  2. Use your sandbox Client ID and Secret Key.
  3. Add your webhook URL in the Cashfree sandbox dashboard.
  4. 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.

๐Ÿค 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:

Made with โค๏ธ by Vfix Technology