How to configure Stripe Credit Card payment?

One of very important payment methods in e-commerce are credit cards. Payments via credit card are in Sylius supported by Stripe.

Install Stripe

Stripe is not available by default in Sylius, to have it you need to add its package via composer.

$ php composer require stripe/stripe-php:~2.0

Configure the gateway


To test this configuration properly you will need a developer account on Stripe. Use its data (secret_key and publishable_key) in the parameters.yml file.

# app/config/parameters.yml
    stripe.secret_key: TEST
    stripe.publishable_key: TEST

Having these parameters defined you can configure the gateway inside the app/config/payum.yml file which has to be imported in the app/config/config.yml.

# app/config/payum.yml
            factory: stripe_checkout
            secret_key: "%stripe.secret_key%"
            publishable_key: "%stripe.publishable_key%"
            payum.template.layout: SyliusShopBundle::Checkout/layout.html.twig
            payum.template.obtain_token: SyliusPayumBundle::Action/Stripe/obtainCheckoutToken.html.twig
# app/config/config.yml
    - { resource: "payum.yml" }

Add a payment method with the Stripe Credit card gateway in the Admin Panel

  • Create a new payment method, choose the Stripe Credit Card gateway for it and enable it in chosen channels.


If your are not sure how to do it check how we do it for Paypal in this cookbook.

Choosing Stripe Credit Card method in Checkout

From now on Stripe Credit Card will be available in Checkout in the channel you have added it to.