I have an install of Sylius which I'm trying to get hooked up to Stripe for payments. I did some reading, and found out that Stripe is included within Payum. Okay, off to install Payum.
So I followed the first part of the instructions here: https://github.com/Payum/Stripe/blob/master/Resources/docs/checkout.md
php composer.phar require payum/stripe php-http/guzzle6-adapter
After that, it seemed that Sylius and Symfony went their separate ways with configs, because everything I've read about Payum on sylius references the standard config.yml file, rather than the config.php file which is referenced in the Payum documentation. So I found the basic configuration online elsewhere instead, and added this to my config.yml:
payum:
security:
token_storage:
myBundle\CoreBundle\Entity\PayumSecurityToken:
doctrine:
driver: orm
contexts:
stripe:
omnipay:
type: Stripe
options:
apiKey: my_key_is_here
testMode: true
actions:
- sylius.payum.stripe.action.capture_order_using_credit_card
- sylius.payum.action.obtain_credit_card
- sylius.payum.action.order_status
- sylius.payum.action.execute_same_request_with_payment_details
storages:
myBundle\CoreBundle\Entity\Order:
doctrine:
driver: orm
Sylius\Bundle\PaymentsBundle\Model\Payment:
doctrine:
driver: orm
sylius_payments:
driver: doctrine/orm
gateways:
stripe: Stripe
With these changes, I now receive the error:
There is no extension able to load the configuration for "sylius_payments" (in /Users/Me/Code/mysite/app/config/config.yml). Looked for namespace "sylius_payments", found "sylius_installer", "sylius_order", "sylius_money", "sylius_currency", "sylius_contact", "sylius_locale", "sylius_settings", "sylius_cart", "sylius_product", "sylius_archetype", "sylius_channel", "sylius_variation", "sylius_attribute", "sylius_taxation", "sylius_shipping", "sylius_payment", "sylius_mailer", "sylius_report", "sylius_promotion", "sylius_addressing", "sylius_inventory", "sylius_taxonomy", "sylius_flow", "sylius_pricing", "sylius_sequence", "sylius_content", "sylius_search", "sylius_rbac", "sylius_user", "sylius_ui", "sylius_admin", "sylius_shop", "sylius_metadata", "sylius_association", "sylius_review", "sylius_core", "sylius_web", "sylius_resource", "sylius_grid", "winzou_state_machine", "sylius_api", "sonata_block", "cmf_core", "cmf_block", "cmf_content", "cmf_routing", "cmf_menu", "cmf_create", "cmf_media", "doctrine", "doctrine_cache", "doctrine_phpcr", "assetic", "framework", "monolog", "security", "swiftmailer", "twig", "sonata_intl", "bazinga_hateoas", "fos_oauth_server", "fos_rest", "fos_elastica", "knp_gaufrette", "knp_menu", "knp_snappy", "liip_imagine", "payum", "jms_serializer", "jms_translation", "stof_doctrine_extensions", "white_october_pagerfanta", "doctrine_migrations", "sylius_fixtures", "sylius_payum", "sylius_theme", "debug", "web_profiler" in /Users/Me/Code/mysite/app/config/config.yml (which is being imported from "/Users/Me/Code/mysite/app/config/config_dev.yml").
I'm not sure where to go from here, as there is very little documentation to be found on the subject.
I'd like to propose a possible answer. Based on help I received from the comments and external resources, I've formulated that my config.yml might simply need the following (after installing via composer of course: php composer.phar require payum/stripe php-http/guzzle6-adapter)
payum:
gateways:
stripe:
factory: stripe_checkout
publishable_key: my_pusblishable_key
secret_key: my_secret_key
This seems to be all it needs to not throw an error upon starting, like the code in my original question did. I've since cleared the cache, and restarted the server. However, I don't see any new options appearing in my 'payment methods' panel in the Sylius admin. Shouldn't this now be showing as a viable option? I won't accept my answer until we figure out what it takes to really get Stripe working.
edit
Looks like that other little bit I had, activating the gateway I just defined, was correct. After adding that, everything is now working and the gateway shows up correctly in the admin panel. Huzzah!
sylius_payments:
driver: doctrine/orm
gateways:
stripe: Stripe
The full solution to getting Stripe working in Sylius is:
Install via composer:
Add this to your config.yml:
payum:
gateways:
stripe:
factory: stripe_checkout
publishable_key: my_publishable_key
secret_key: my_secret_key
sylius_payment:
driver: doctrine/orm
gateways:
stripe: Stripe
Clear the cache:
php app/console cache:clear
Restart the web server, for good measure. That's it!