Payment (Stripe) Setup
Freemium
Each newly registered user is granted 10 free prompts by default.
This value can be modified in the following migration file:
database/migrations/2025_09_12_070001_add_free_prompts_to_users_table.php
After free prompts will expire, automatically user will be redirected to pricing page.
Stripe
Start with Stripe test sandbox, and change in .env next parameters to your:
STRIPE_KEY="pk_test_SOME_LONG_NUMBERS_AND_LETTERS"
STRIPE_SECRET="sk_test_SOME_LONG_NUMBERS_AND_LETTERS"
Pricing Models
The Starter Kit supports two pricing models, both integrated with Stripe.
1. Pay-As-You-Go
A one-time payment model where users purchase a fixed number of prompts (e.g. 100 or 200 prompts).
- Prompt packages can be:
- Non-expiring, or
- Time-limited (e.g. 6 months, 1 year, or a custom duration).
- The default expiration period is 6 months. This value can be modified in:
config/subscription-plans.phpusing thelifetime_in_monthsparameter. Note that this parameter applies only to the one-time payment (pay-as-you-go) model.
Create this model in Stripe:
- Create a new Product in the Stripe Dashboard.
- Select the appropriate Tax Code:
- SaaS – personal use for B2C products
- SaaS – business use for B2B products
- For the Pricing model, select One-off.
This product will be used for one-time purchases of prompt packages.
2. Monthly Subscription with Overage
A recurring subscription model that includes a fixed number of prompts per month, with an additional charge for overusage.
Example:
- $11.37 per month for 200 prompts
- $0.079 per additional prompt beyond the monthly limit
This model is suitable for active users who require predictable monthly usage with flexible scaling.
Create this model in Stripe using official Stripe documentation. Under Meter, create a new meter to record usage. Use the meter name prompts
In config/subscription-plans.php edit plans value with your data. It will be used to show automatically Pricing table in the frontend and to manage subscriptions in the backend. Notice that you will need to copy 2 price ids (metered and flat) for the monthly subscription.
Test locally
To test locally you will need Stripe CLI. Install it, then run using this command:\
./stripe listen --forward-to localhost:8888/stripe/webhook
It will output secret key ofr webhook. Copy it and paste in .env in
STRIPE_WEBHOOK_SECRET="whsec_SOME_LONG_NUMBERS_AND_LETTERS"
Logging
All payment-related logs are written using Laravel’s configured log driver.
- The default log channel is
stack. Logs are stored in:storage/lods/laravel.log - You can change the log driver by updating the log environment variable
Live Mode
After completing local testing in Stripe test mode, you need to setup live mode for production.
Copying Products from Stripe Sandbox to Live Mode
To migrate products from the Stripe sandbox to live mode:
- Open the Stripe Dashboard in test mode.
- Navigate to Product Catalog.
- Click the three-dot menu next to the product.
- Select Copy to live mode.
After copying the products:
- Retrieve the live Product IDs and Price IDs.
- Update the corresponding values in your
.envfile.
Create Live webhook in Stripe
After deploying the Starter Kit to production, you must configure Live Stripe webhook.
Run the following command on your production server:
php artisan cashier:webhook
(Documentation for the above command)
Note: This step alone is not sufficient. You must also enable the required events in the Stripe Dashboard.
Enable Additional Events in Stripe Dashboard
- Open the Stripe Dashboard.
- Navigate to Developers → scroll to the bottom and click Open Workbench.
- Go to Webhooks.
- In the breadcrumb navigation, click Back to return to Event destinations.
- Locate your webhook endpoint, click the three-dot menu, and select Edit.
- Ensure that the required webhook events are enabled (listed below).
Subscription Events
- customer.subscription.created - When a new subscription is created
- customer.subscription.updated - When a subscription is updated (e.g., plan change)
- customer.subscription.deleted - When a subscription is canceled
- invoice.payment_succeeded - When a subscription invoice is paid successfully
- invoice.payment_failed - When a subscription payment attempt fails
Metered Usage Events
- invoice.created - When an invoice is created containing metered usage
- invoice.finalized - When a draft invoice with metered usage is finalized
- invoice.payment_succeeded - When a metered usage invoice is paid
One-Time Purchase Events
- checkout.session.completed - When a one-time purchase Checkout flow completes
- payment_intent.succeeded - When a direct one-time payment succeeds
- payment_intent.payment_failed - When a one-time payment fails
- charge.succeeded - When a charge is successful
- charge.failed - When a charge fails