flux-se / sylius-payum-stripe-plugin
Payum Stripe gateways plugin for Sylius.
Installs: 2 419
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 3
Forks: 6
Open Issues: 2
Type:sylius-plugin
Requires
- php: ^7.3
- flux-se/payum-stripe-bundle: ^1.2
- sylius/sylius: ^1.5
Requires (Dev)
- ext-json: *
- behat/behat: ^3.7
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- lakion/mink-debug-extension: ^2.0.0
- phpspec/phpspec: ^7.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: 0.12.64
- phpstan/phpstan-doctrine: 0.12.13
- phpstan/phpstan-strict-rules: ^0.12.0
- phpstan/phpstan-webmozart-assert: 0.12.7
- phpunit/phpunit: ^9.5
- sensiolabs/security-checker: ^6.0
- sylius-labs/coding-standard: ^3.2
- symfony/browser-kit: ^4.4
- symfony/debug-bundle: ^4.4
- symfony/dotenv: ^4.4
- symfony/intl: ^4.4
- symfony/web-profiler-bundle: ^4.4
- vimeo/psalm: 4.3.1
README
Sylius Payum Stripe checkout session gateway plugin
This plugin is designed to add a new gateway to Payum to support Stripe checkout session over Sylius plugin
See https://stripe.com/docs/payments/checkout for more information.
Installation
Install using Composer :
$ composer require flux-se/sylius-payum-stripe-plugin
Enable this plugin :
<?php # config/bundles.php return [ // ... FluxSE\SyliusPayumStripePlugin\FluxSESyliusPayumStripePlugin::class => ['all' => true], // ... ];
Configuration
API keys
Get your publishable_key
and your secret_key
on your Stripe account :
https://dashboard.stripe.com/test/apikeys
Webhook key
Then get a webhook_secret_key
configured with at least two events :
payment_intent.canceled
checkout.session.completed
The URL to fill is the route named payum_notify_do_unsafe
, here is an example :
http://localhost/payment/notify/unsafe/stripe_session_checkout_with_sca
https://dashboard.stripe.com/test/webhooks
Test or dev environment
Webhooks are triggered by Stripe on their server to your server. If the server is into a private network, Stripe won't be allowed to reach your server.
Stripe provide an alternate way to catch those webhook events, you can use
Stripe cli
: https://stripe.com/docs/stripe-cli
Follow the link and install Stripe cli
, then use those command line to get
your webhook key :
First login to your Stripe account (needed every 90 days) :
stripe login
Then start to listen for the 2 required events, forwarding request to you local server :
stripe listen \ --events checkout.session.completed,payment_intent.canceled \ --forward-to https://localhost/payment/notify/unsafe/stripe_session_checkout_with_sca
Replace the --forward-to argument value with the right one you need.
Sylius configuration
Go to the admin area, log in, then click on the left menu item "CONFIGURATION > Payment methods". Create a new payment method type "Stripe Checkout Session (with SCA support)" :
Then a form will be displayed, fill-in the required fields :
-
the "code" field (ex: "stripe_session_checkout_with_sca").
-
choose which channels this payment method will be affected to.
-
the gateway configuration (need info from here) :
NOTE1: You can add as many webhook secret keys as you need here, however generic usage need only one.
NOTE2: the screenshot contains false test credentials.
-
give to this payment method a display name (and a description) for each language you need
Finally, click on the "Create" button to save your new payment method.
Advanced usages
See documentation here : https://github.com/FLUX-SE/PayumStripe/blob/master/README.md