Payum Stripe gateways plugin for Sylius.

Installs: 5 823

Dependents: 0

Suggesters: 0

Security: 0

Stars: 23

Watchers: 3

Forks: 12

Open Issues: 1



Latest Version on Packagist Software License Build Status Quality Score

Sylius Payum Stripe gateway plugin

This plugin is designed to add a new gateway to Payum to support Stripe checkout session.

See https://stripe.com/docs/payments/checkout for more information.


Install using Composer :

composer require flux-se/sylius-payum-stripe-plugin

💡 If the flex recipe has not been applied then follow the next step.

Enable this plugin :


# config/bundles.php

return [
    // ...
    FluxSE\SyliusPayumStripePlugin\FluxSESyliusPayumStripePlugin::class => ['all' => true],
    // ...

Creat the file config/packages/flux_se_sylius_payum_stripe.yaml and add the following content

  - { resource: "@FluxSESyliusPayumStripePlugin/Resources/config/config.yaml" }


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)" :

Create a new payment method

Then a form will be displayed, fill-in the required fields :

1. the "code" field (ex: "stripe_checkout_session_with_sca").

💡 The code will be the gateway name, it will be needed to build the right webhook URL later (see Webhook key section for more info).

2. choose which channels this payment method will be affected to.

3. the gateway configuration (need info from here) :

Gateway Configuration

📖 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.

4. 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.

API keys

Get your publishable_key and your secret_key on your Stripe dashboard :


Webhook key

Got to :


Then create a new endpoint with at least two events :

  • payment_intent.canceled
  • checkout.session.completed

The URL to fill is the route named payum_notify_do_unsafe with the gateway param equal to the gateway name (Payment method code), here is an example :


📖 As you can see in this example the URL is dedicated to localhost, you will need to provide to Stripe a public host name in order to get the webhooks working.

📖 Use this command to know the exact structure of payum_notify_do_unsafe route

bin/console debug:router payum_notify_do_unsafe

📖 Use this command to know the exact name of your gateway, or just check the code of the payment method in the Sylius admin payment method index.

bin/console debug:payum:gateway

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 your local server :

stripe listen \
    --events checkout.session.completed,payment_intent.canceled \
    --forward-to https://localhost/payment/notify/unsafe/stripe_checkout_session_with_sca

💡 Replace the --forward-to argument value with the right one you need.

When the command finishes a webhook secret key is displayed, copy it to your Payment method in the Sylius admin, and it will be ok.

⚠️ Using stripe trigger checkout.session.completed will always result in a 500 error, because the test object will not embed any usable metadata.

Advanced usages

See documentation here : https://github.com/FLUX-SE/PayumStripe/blob/master/README.md