Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dmjcv91913's avatar

Stripe Integration - Quote to Payment Cycle Laravel

Has anyone integrated Quote, Customer Confirmation, then Payment , the Payment Confirmation cycle using Laravel. Laravel seems to take care of the Cashier or Payments side, but is LAravel integrated with Stripes api, so I can provide quotes first, as the products have variable pricing and are custom tailored to each customer. Any thoughts or points of direction would be helpful. I was hoping to not have to customize too much.

0 likes
2 replies
LaryAI's avatar
Level 58

To implement a quote to payment cycle using Laravel with Stripe, you can follow these general steps. This approach will involve creating a quote, sending it to the customer for confirmation, and then processing the payment using Stripe. Laravel Cashier can be used for handling the payment part, but you'll need to handle the quote and confirmation logic yourself.

Step 1: Set Up Stripe and Laravel Cashier

  1. Install Laravel Cashier: If you haven't already, install Laravel Cashier for Stripe.

    composer require laravel/cashier
    
  2. Configure Stripe: Add your Stripe API keys to your .env file.

    STRIPE_KEY=your-stripe-key
    STRIPE_SECRET=your-stripe-secret
    
  3. Publish Cashier's Migrations: Run the following command to publish the necessary migrations.

    php artisan vendor:publish --tag="cashier-migrations"
    
  4. Run Migrations: Execute the migrations to create the necessary tables.

    php artisan migrate
    

Step 2: Create a Quote System

  1. Create a Quote Model and Migration: Generate a model and migration for quotes.

    php artisan make:model Quote -m
    
  2. Define the Quote Schema: In the migration file, define the necessary fields for a quote, such as customer_id, amount, status, etc.

    Schema::create('quotes', function (Blueprint $table) {
        $table->id();
        $table->foreignId('customer_id')->constrained();
        $table->decimal('amount', 8, 2);
        $table->string('status')->default('pending');
        $table->timestamps();
    });
    
  3. Run the Migration: Apply the migration to create the quotes table.

    php artisan migrate
    

Step 3: Implement Quote Confirmation

  1. Create a Controller for Quotes: Generate a controller to handle quote creation and confirmation.

    php artisan make:controller QuoteController
    
  2. Add Methods for Quote Creation and Confirmation:

    public function createQuote(Request $request)
    {
        $quote = Quote::create([
            'customer_id' => $request->customer_id,
            'amount' => $request->amount,
            'status' => 'pending',
        ]);
    
        // Send quote to customer for confirmation (e.g., via email)
        // ...
    
        return response()->json(['quote' => $quote]);
    }
    
    public function confirmQuote($quoteId)
    {
        $quote = Quote::findOrFail($quoteId);
        $quote->status = 'confirmed';
        $quote->save();
    
        // Proceed to payment
        return redirect()->route('payment.process', ['quote' => $quote]);
    }
    

Step 4: Process Payment with Stripe

  1. Create a Payment Controller: Generate a controller to handle payments.

    php artisan make:controller PaymentController
    
  2. Add a Method to Process Payments:

  3. Create a Payment Form View: Create a Blade view to handle the payment form and Stripe elements.

Conclusion

This setup provides a basic flow for creating quotes, confirming them, and processing payments using Stripe in a Laravel application. You can expand upon this by adding more features such as email notifications, detailed quote items, and more robust error handling.

martinbean's avatar

@dmjcv91913 What is it you’re actually asking here? Laravel can’t magically encode your business logic for you; you’ll need to call the appropriate Stripe API endpoints for the flow you want.

Please or to participate in this conversation.