andreia / filament-stripe-payment-link
Filament action to generate a Stripe payment link
Fund package maintenance!
andreia
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
- stripe/stripe-php: ^9.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.1.1||^7.10.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- pestphp/pest-plugin-livewire: ^2.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
Provides an action to generate a Stripe payment link.
Installation
You can install the package via composer:
composer require andreia/filament-stripe-payment-link
You can publish the config using:
php artisan vendor:publish --tag="filament-stripe-payment-link-config"
or run the install command:
php artisan andreia/filament-stripe-payment-link:install
This is the contents of the published config file:
return [ 'action' => [ 'icon' => 'heroicon-m-link', 'requires-confirmation' => false, ], 'payment-link-key-location' => 'services.stripe.payment-link-key', ];
Requirements
Setup
Stripe
On Stripe dashboard, create a restricted API key:
- Add a descriptive name for your key on "Key name" field
- Add
write
permission toProducts
,Prices
, andPayment Links
- Click on "Create key" button
On the redirected page, in "Restricted keys" section, locate the name of your key. Click to reveal the secret key and copy it. It will be used to connect to Stripe.
Laravel Project
In your Laravel application, add the following on your config/services.php
file:
'stripe' => [ 'payment-link-key' => env('STRIPE_PAYMENT_LINK_KEY') ],
And on your .env
file, add the secret key generated on Stripe dashboard:
STRIPE_PAYMENT_LINK_KEY="your key here"
Usage
Add the Stripe payment link action to a Filament form input field:
use Andreia\FilamentStripePaymentLink\GenerateStripeLinkAction; public static function form(Form $form): Form { return $form ->schema([ TextInput::make('stripe_payment_link') ->required() ->suffixAction(GenerateStripeLinkAction::make('stripe_payment_link')), ]); }
This is how the action will look like:
When the user clicks on the link icon, a modal will be shown with the product name
, amount
, and currency
fields:
After filling the form data and submitting, the payment link will be added to the form field:
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.