One of very important payment methods in e-commerce are credit cards. Payments via credit card are in Sylius supported by 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
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 http://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 </cookbook/payments/paypal>
.
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.
From now on Stripe Credit Card will be available in Checkout in the channel you have added it to.
Done!
Payments concept documentation </book/orders/payments>
- Payum - Project Documentation