How to configure Stripe Credit Card payment?¶
Danger
We’re sorry but this documentation section is outdated. Please have that in mind when trying to use it. You can help us making documentation up to date via Sylius Github. Thank you!
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:~4.1
Add a payment method with the Stripe gateway in the Admin Panel¶
Note
To test this configuration properly you will need a developer account on Stripe.
Create a new payment method, choosing the
Stripe Credit Card
gateway from the gateways choice dropdown and enable it for chosen channels.
Go to the https://localhost:8000/admin/payment-methods/new/stripe_checkout
url.
Fill in the Stripe configuration form with your developer account data (
publishable_key
andsecret_key
).Save the new payment method.
Tip
If your are not sure how to do it check how we do it for Paypal in this cookbook.
Warning
When your project is behind a loadbalancer and uses https you probably need to configure trusted proxies. Otherwise the payment will not succeed and the user will endlessly loopback to the payment page without any notice.
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.
Done!