Download the PHP package lunarphp/stripe without Composer
On this page you can find all versions of the php package lunarphp/stripe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package stripe
This addon enables Stripe payments on your Lunar storefront.
Alpha Release
This addon is currently in Alpha, whilst every step is taken to ensure this is working as intended, it will not be considered out of Alpha until more tests have been added and proved.
Tests required:
- [ ] Successful charge response from Stripe.
- [ ] Unsuccessful charge response from Stripe.
- [ ] Test
manual
config reacts appropriately. - [x] Test
automatic
config reacts appropriately. - [ ] Ensure transactions are stored correctly in the database
- [x] Ensure that the payment intent is not duplicated when using the same Cart
- [ ] Ensure appropriate responses are returned based on Stripe's responses.
- [ ] Test refunds and partial refunds create the expected transactions
- [ ] Make sure we can manually release a payment or part payment and handle the different responses.
Minimum Requirements
- Lunar >=
0.6
- A Stripe account with secret and public keys
Optional Requirements
- Laravel Livewire (if using frontend components)
- Alpinejs (if using frontend components)
- Javascript framework
Installation
Require the composer package
Publish the configuration
This will publish the configuration under config/getcandy/stripe.php
.
Publish the views (optional)
Lunar Stripe comes with some helper components for you to use on your checkout, if you intend to edit the views they provide, you can publish them.
Enable the driver
Set the driver in config/getcandy/payments.php
Add your Stripe credentials
Make sure you have the Stripe credentials set in config/services.php
Keys can be found in your Stripe account https://dashboard.stripe.com/apikeys
Configuration
Below is a list of the available configuration options this package uses in config/getcandy/stripe.php
Key | Default | Description |
---|---|---|
policy |
automatic |
Determines the policy for taking payments and whether you wish to capture the payment manually later or take payment straight away. Available options manual or automatic |
Backend Usage
Create a PaymentIntent
This method will create a Stripe PaymentIntent from a Cart and add the resulting ID to the meta for retrieval later. If a PaymentIntent already exists for a cart this will fetch it from Stripe and return that instead to avoid duplicate PaymentIntents being created.
Fetch an existing PaymentIntent
Syncing an existing intent
If a payment intent has been created and there are changes to the cart, you will want to update the intent so it has the correct totals.
Webhooks
The plugin provides a webhook you will need to add to Stripe. You can read the guide on how to do this on the Stripe website https://stripe.com/docs/webhooks/quickstart.
The 3 events you should listen to are payment_intent.payment_failed
,payment_intent.processing
,payment_intent.succeeded
.
The path to the webhook will be http:://yoursite.com/stripe/webhook
.
You can customise the path for the webhook in config/lunar/stripe.php
.
You will also need to add the webhook signing secret to the services.php
config file:
Storefront Examples
First we need to set up the backend API call to fetch or create the intent, this isn't Vue specific but will likely be different if you're using Livewire.
Vuejs
This is just using Stripe's payment elements, for more information check out the Stripe guides
Payment component
Contributing
Contributions are welcome, if you are thinking of adding a feature, please submit an issue first so we can determine whether it should be included.
Testing
A MockClient class is used to mock responses the Stripe API will return.