One-Time Payment Form with Stripe

Filament 3

While creating a project in Filament, you might think adding Payments is difficult as it's not the designed use case. But in reality, this is easy!

FilamentExamples ThumbBase (25)

Get the Source Code:

Only This Example

$9

One-time payment

Full source code for One-Time Payment Form with Stripe
Downloadable ZIP file with the source code
Lifetime access to this example
GitHub Sign in with GitHub to buy

Sign in first, then complete your $9 checkout.

Best value — all 173 examples

FilamentExamples Membership

$99 /year
or
$199 lifetime
Access to code of all 173 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
View membership plans

30-day money-back guarantee

How it works

In our example, you will find a Product table with name and price columns. These will be the things we are selling. So we will skip the setup, as it does not matter as long as you have an ID and price.

Once we have the product list, we can create a checkout page:

php artisan make:filament-page BuyProduct

Note: When asked where to place it - enter ProductResource or any other custom resource you have.

Once this file is created, we can paste this content there:

Note: We added critical comments inside the code for clarity.

app/Filament/Resources/ProductResource/Pages/BuyProduct.php

 
namespace App\Filament\Resources\ProductResource\Pages;
 
use App\Filament\Resources\ProductResource;
use App\Models\User;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;
use Filament\Resources\Pages\Page;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset;
use NumberFormatter;
use Stripe\Customer;
use Stripe\PaymentIntent;
use Stripe\StripeClient;
 
class BuyProduct extends Page
{
// This trait informs the Filament page that we will interact with a record
use InteractsWithRecord;
 
protected static string $resource = ProductResource::class;
 
protected static string $view = 'filament.resources.product-resource.pages.buy-product';
// ....
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.