TheDocumentation Index
Fetch the complete documentation index at: https://docs.laravelshopper.dev/llms.txt
Use this file to discover all available pages before exploring further.
shopper/stripe package is a first-party Stripe driver for Shopper’s payment system. It uses Stripe PaymentIntents to handle card payments with full support for 3D Secure authentication, manual and automatic capture, partial refunds, and webhook processing.
Installation
stripe driver with the payment manager and merges the default configuration.
Configuration
Publish the config file:config/shopper/stripe.php:
.env:
Capture Method
Thecapture_method setting controls when funds are collected from the customer.
| Value | Behavior | Use case |
|---|---|---|
manual | Authorize first, capture later from the admin panel | Physical goods, verify stock before charging |
automatic | Capture immediately when the customer confirms | Digital products, subscriptions, instant fulfillment |
Pending → Authorized → Paid. The merchant captures from the order detail page when ready.
Authorization holds typically expire after 7 days (varies by card network). You must capture within that window or the hold is released and the customer is not charged.
Payment Method Setup
Create a payment method record linked to the Stripe driver. This makes it selectable at checkout.Payment Flow
The Stripe driver uses the PaymentIntent API. Here’s the complete flow for a checkout with manual capture:1. Initiate at Checkout
When the customer places an order, initiate the payment. The driver creates a Stripe PaymentIntent and returns aclientSecret for the frontend.
2. Confirm on the Frontend
On your payment page, use Stripe.js with the Payment Element to collect card details and confirm the payment:return_url.
3. Handle the Callback
On the callback page, verify the payment status:payment_status is now Authorized. With automatic capture, it goes straight to Paid.
4. Capture from the Admin Panel
When the order is ready to ship, the merchant clicks Capture payment on the order detail page. This callscapturePayment() on the Stripe driver and collects the funds.
The payment status changes from Authorized to Paid.
Webhooks
Stripe sends webhook events for asynchronous payment updates. The driver handles these events and converts them into standardized actions.Setting Up
-
In your Stripe Dashboard, create a webhook endpoint pointing to your application (e.g.
https://yourstore.com/webhooks/stripe) -
Copy the signing secret to your
.env:
- Create a webhook controller:
- Register the route (excluded from CSRF verification):
Handled Events
| Stripe Event | Action | Description |
|---|---|---|
payment_intent.amount_capturable_updated | authorized | Payment authorized, ready to capture |
payment_intent.succeeded | captured | Payment captured successfully |
payment_intent.payment_failed | failed | Payment attempt failed |
payment_intent.canceled | canceled | Payment intent cancelled |
charge.refunded | refunded | Charge was refunded |
ignored.
Signature Verification
The driver verifies every webhook using the signing secret. If the signature is invalid, aStripeException is thrown. This prevents forged webhook payloads from being processed.
Refunds
The driver supports full and partial refunds through thePaymentProcessingService:
payment_status automatically updates to PartiallyRefunded or Refunded based on the total refunded amount compared to the order total.
Cancellation
Cancel an authorized payment before capture to release the hold without processing a refund:payment_status changes to Voided. No funds are collected and no refund fees apply.
Testing
Stripe Test Cards
Use Stripe’s test card numbers in test mode:| Card Number | Scenario |
|---|---|
4242 4242 4242 4242 | Successful payment |
4000 0025 0000 3155 | Requires 3D Secure authentication |
4000 0000 0000 9995 | Declined (insufficient funds) |
4000 0000 0000 0002 | Declined (generic) |
Webhook Testing
Use the Stripe CLI to forward events to your local environment:STRIPE_WEBHOOK_SECRET during development.
Test Mode
Make sure your.env uses sk_test_ and pk_test_ keys. Stripe automatically isolates test data from live data.