Download the PHP package barstec/laravel-stripe-simple-payment without Composer
On this page you can find all versions of the php package barstec/laravel-stripe-simple-payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-stripe-simple-payment
Stripe simple one-time checkout for Laravel
This package is designed for seamless integration of simple Stripe payments with Laravel. It enables only one-time payments for a single item. The package encompasses table creation, payment generation using the Stripe API and PHP library, and payment verification.
Support
If this package is helpful for you, you can support my work on Ko-fi.
Installation
-
Install composer package using command:
-
Publish configuration files to your project
- Run migrations
Setup
Firstly you need to move environmental variables from .env.example to .env:
To enable testing mode, simply copy and paste the values from the Stripe testing environment above.
In the configuration file, you can define return routes, default values, the database table name, and the columns to be collected. After modifying columns, rerun the migration process.
In Stripe settings create webhook with endpoint matching notification_route from config and choose events: checkout.session.expired, checkout.session.completed
Usage/Examples
To initiate a transaction, create a Payload object in your controller and assign values. Then, create a Payment object, pass the Payload, and call redirect(). This action will start the transaction and redirect the user to the Stripe payment page. By default Payload object is configured to handle single-item payment without delivery or additional costs. You can modify it using predefined methods. If you want to add value that is not available in Payload class, you can use addAdditionalParam method to pass it manually.
Upon transaction creation, the StripeTransactionCreated event is triggered. You can use it to retrieve the payload, transaction ID and session to associate the transaction with a specific user. To achieve this, create a listener and register it in your EventServiceProvider.
By default, all transaction status changes are handled by the package. The StripePaymentCompleted event is triggered after receiving a completed signal from Stripe. For session expiration signal, the StripeSessionExpired event is triggered.
Author
License
This package is distributed under the MIT license