macro64
macro64

Reputation: 61

Sylius V0.17 How to add payment methods

I installed Sylius via composer create-project -s dev sylius/sylius-standard acme on my local server to take a closer look at it for a upcoming project. Now I'm stuck at adding payment-methods/ a payment-gateway.

I tried to follow the docs and install omnipay-bundle but composer require "sylius/omnipay-bundle" failed with:

  Problem 1
    - Installation request for sylius/omnipay-bundle ^0.9.0 -> satisfiable by sylius/omnipay-bundle[v0.9.0].
    - Conclusion: remove omnipay/omnipay 2.3.2
    - Conclusion: don't install omnipay/omnipay 2.3.2
    - sylius/omnipay-bundle v0.9.0 requires omnipay/omnipay 1.0.* -> satisfiable by omnipay/omnipay[v1.0.0, v1.0.1, v1.0.2, v1.0.3, v1.0.4].
    - Can only install one of: omnipay/omnipay[v1.0.0, 2.3.2].
    - Can only install one of: omnipay/omnipay[v1.0.1, 2.3.2].
    - Can only install one of: omnipay/omnipay[v1.0.2, 2.3.2].
    - Can only install one of: omnipay/omnipay[v1.0.3, 2.3.2].
    - Can only install one of: omnipay/omnipay[v1.0.4, 2.3.2].
    - Installation request for omnipay/omnipay == 2.3.2.0 -> satisfiable by omnipay/omnipay[2.3.2].

Adding the bundle to the appkernel.php anyway and/or adding configuration to config.yml (like described in the docs) prevents the Server from starting.

I found this issue: https://github.com/Sylius/Sylius/issues/4396 which seems related.

Question: - Should there be some choices other than 'Offline' in 'Payment Methods' in the Admin-Frontend (without adding code to the freshly-pulled sylius)? - Is Sylius changing so rapidly that the docs are not matching? - Lets assume I want to add '2checkout' (just as exampl) as payment gateway, what would i have to do?

I have the feeling i missed something fundamental with this problem :) Thanks for your help in advance!

Upvotes: 2

Views: 1256

Answers (1)

macro64
macro64

Reputation: 61

My Question was answered in the Git-issue 4369

So, the sylius-standard already contains the Symfony2-Bundles. To add a payment-gateway they just need to be configured in config.yml:

payum:
    gateways:
        paypal_express_checkout:
            paypal_express_checkout_nvp:
                username:  %paypal.express_checkout.username%
                password:  %paypal.express_checkout.password%
                signature: %paypal.express_checkout.signature%
                sandbox:   %paypal.express_checkout.sandbox%
        klarna_checkout:
            klarna_checkout:
                secret:  'required'
                merchant_id: 'required'
                sandbox: true
sylius_payment:
    gateways:
        paypal_express_checkout: Paypal Express Checkout
        klarna_checkout: Klarna Checkout

Additional configuration reference can be found here: https://github.com/Payum/PayumBundle/blob/master/Resources/doc/configuration_reference.md

Thanks!

PS: The cache has to be cleared before restarting the server.

Upvotes: 3

Related Questions