Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cashfree Laravel Package

loveycom/cashfree

Laravel package for CashFree (India) integrating Marketplace Settlement and Payment Gateway APIs. Includes config publishing, environment switching (test/prod), and helper classes like Marketplace (e.g., checkBalance) to simplify CashFree API calls in Laravel.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Modular and Aligned with CashFree’s API: The package mirrors CashFree’s official API structure (Marketplace Settlement vs. Payment Gateway), enabling granular adoption. Ideal for products requiring both vendor payouts and transaction processing (e.g., marketplaces, SaaS).
    • Laravel-Native Design: Leverages Laravel’s service providers, config publishing, and dependency injection, reducing boilerplate. Example: Configuring CashFreeServiceProvider and publishing config/cashfree.php follows Laravel’s conventions.
    • Webhook-Ready: Explicit support for notifyUrl in payment flows, critical for real-time event handling (e.g., payment success/failure). Integrates with CashFree’s webhook system out-of-the-box.
    • Lightweight Abstraction: Focuses solely on CashFree APIs without unnecessary bloat (e.g., no frontend UI or database models), keeping the package lean for backend use.
  • Cons:

    • Rigid API Mapping: Methods like Order::create() enforce CashFree’s payload structure, limiting flexibility for custom fields or non-standard use cases. Overrides may require extending the package or modifying requests manually.
    • No Async/Queue Support: All operations are synchronous, risking timeouts for high-latency endpoints (e.g., batch settlements). Requires manual implementation of queues/jobs for scalability.
    • Limited Error Handling: Documentation lacks details on retries, exponential backoff, or custom error responses. May need wrapper enhancements for production resilience.
    • India-Centric: Hardcoded to CashFree’s Indian-focused APIs (e.g., customerPhone validation for Indian numbers). Non-Indian use cases (e.g., international vendors) may require workarounds.

Integration Feasibility

  • Stack Fit:

    • High for Laravel: Designed for Laravel 5.6+, but compatibility with newer versions (9.x/10.x) is untested. Key checks:
      • HTTP Client: Uses Guzzle under the hood (default in Laravel). Confirm no conflicts with Laravel’s built-in HTTP client.
      • Service Container: Assumes Laravel’s DI; manual instantiation may break if using non-Laravel PHP.
      • Config System: Published config (config/cashfree.php) integrates seamlessly with Laravel’s config management.
    • Low for Non-Laravel: Requires significant refactoring to adapt to frameworks like Symfony or WordPress.
  • Migration Path:

    • Phased Adoption:
      1. Sandbox Testing: Use testURL and isLive = false to validate core flows (e.g., order creation, refunds) before going live.
      2. Webhook Setup: Configure CashFree’s dashboard for webhooks and implement a Laravel route to handle notifyUrl events (e.g., POST /cashfree/webhook).
      3. Vendor Payouts: Pilot Marketplace features (e.g., Vendor::create(), withdraw()) in a non-critical environment.
    • Backward Compatibility: None. Existing CashFree integrations (e.g., raw API calls) must be migrated to this package.
  • Compatibility:

    • Dependencies: Requires PHP 7.0+ and Laravel 5.6+. Test for conflicts with:
      • Guzzle Version: Ensure alignment with Laravel’s bundled Guzzle (e.g., guzzlehttp/guzzle:^6.0).
      • Carbon: Used for date handling; confirm version compatibility (e.g., nesbot/carbon).
    • Database: No ORM/models provided. Store order/vendor data in your existing DB (e.g., orders table with cashfree_order_id foreign key).

Key Questions

  1. API Stability:
    • How frequently does CashFree update its API? Are there known breaking changes (e.g., deprecated endpoints)?
    • Does the package support CashFree’s latest API versions (e.g., v2 of Payment Gateway)?
  2. Performance:
    • What are the rate limits for CashFree’s endpoints? Does the package handle throttling?
    • How does it perform under load (e.g., 1000+ concurrent orders)? Are there connection pooling optimizations?
  3. Error Handling:
    • How are CashFree’s API errors (e.g., 422 Unprocessable Entity) translated into Laravel exceptions?
    • Are retries implemented for transient failures (e.g., network issues)?
  4. Webhooks:
    • Does the package validate webhook signatures? If not, how will we secure notifyUrl endpoints?
    • What’s the retry strategy for failed webhook deliveries?
  5. Testing:
    • Are there unit/integration tests for the package? If not, what’s the plan to validate edge cases (e.g., failed refunds)?
  6. Maintenance:
    • Is the package actively maintained? Who responds to issues (e.g., CashFree support vs. community)?
    • How will we handle CashFree API deprecations (e.g., migrating from /v1 to /v2 endpoints)?

Integration Approach

Stack Fit

  • Laravel Core:
    • Service Provider: Register the package via LoveyCom\CashFree\CashFreeServiceProvider in config/app.php.
    • Config: Publish and customize config/cashfree.php for appID, secretKey, and environment (testURL/prodURL).
    • Facades/Helpers: Use the provided classes (e.g., PaymentGateway\Order, Marketplace\Vendor) directly or bind them to Laravel’s container for DI.
  • HTTP Layer:
    • Guzzle Integration: The package uses Guzzle for HTTP requests. Ensure Laravel’s HTTP client isn’t overridden or conflicts with Guzzle’s version.
    • Middleware: Add middleware to log CashFree API requests/responses (e.g., for debugging or analytics).
  • Database:
    • No Migrations: Create custom tables for:
      • orders (linking your order_id to CashFree’s orderId).
      • vendors (storing vendor details fetched via Vendor::retrieve()).
      • webhook_events (tracking notifyUrl payloads).
    • Example Schema:
      Schema::create('orders', function (Blueprint $table) {
          $table->id();
          $table->string('cashfree_order_id')->unique();
          $table->string('status'); // e.g., "PENDING", "SUCCESS"
          $table->json('metadata');
          $table->timestamps();
      });
      
  • Webhooks:
    • Route: Add a route to handle notifyUrl events:
      Route::post('/cashfree/webhook', [CashFreeWebhookController::class, 'handle']);
      
    • Controller: Validate signatures (if not handled by the package) and process events:
      public function handle(Request $request) {
          $payload = $request->all();
          // Validate CashFree signature (e.g., using `CashFree::verifyWebhook($payload)` if supported)
          // Update order status in DB, trigger jobs, etc.
      }
      

Migration Path

  1. Pre-Integration:
    • Audit Current Setup: Identify existing CashFree integrations (e.g., raw API calls, manual webhook handlers).
    • Sandbox Setup: Register a test account on CashFree’s sandbox and obtain appID/secretKey.
  2. Phase 1: Payment Gateway (Low Risk):
    • Implement Order::create() and Order::getStatus() for core transactions.
    • Test with the sandbox using the example from the README.
    • Validate webhook handling for notifyUrl events.
  3. Phase 2: Marketplace Features (Medium Risk):
    • Add Vendor::create() and withdraw() for vendor payouts.
    • Implement ledger reconciliation using getLedger().
  4. Phase 3: Advanced Features (High Risk):
    • Enable refunds (Refund::create()) and settlements (Settlement::getAll()).
    • Integrate with your billing/subscription system (e.g., Stripe → CashFree payouts).

Compatibility

  • Laravel Versions:
    • Tested: 5.6+ (PHP 7.0+).
    • Untested: 9.x/10.x. Verify compatibility with:
      • Laravel’s HTTP client (e.g., Http::post() vs. Guzzle).
      • Dependency conflicts (e.g., nesbot/carbon version).
  • CashFree API Versions:
    • Confirm the package supports your required API version (e.g., Payment Gateway v1 vs. v2).
    • Monitor CashFree’s changelog for breaking changes.
  • Third-Party Services:
    • If using CashFree with other tools (e.g., Stripe for subscriptions), ensure data flows align (e.g., syncing order_id between systems).

Sequencing

| Priority | Task | Dependencies | **

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime