【问题标题】:Sylius V0.17 How to add payment methodsSylius V0.17 如何添加支付方式
【发布时间】:2016-03-13 15:43:12
【问题描述】:

我通过composer create-project -s dev sylius/sylius-standard acme 在我的本地服务器上安装了 Sylius,以便为即将到来的项目仔细查看它。现在我一直在添加支付方式/支付网关。

我尝试关注docs 并安装omnipay-bundle,但composer require "sylius/omnipay-bundle" 失败:

  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].

无论如何将包添加到 appkernel.php 和/或将配置添加到 config.yml(如文​​档中所述)会阻止服务器启动。

我发现了这个问题:https://github.com/Sylius/Sylius/issues/4396 这似乎相关。

问题: - 管理前端的“付款方式”中是否应该有“离线”以外的其他选择(不向新拉的 sylius 添加代码)? - Sylius 变化如此之快以至于文档不匹配? - 假设我想添加“2checkout”(如示例)作为支付网关,我需要做什么?

我觉得我错过了这个问题的一些基本内容:) 提前感谢您的帮助!

【问题讨论】:

  • omnipay/1.x 已被弃用很长时间。必须有支持omnipay 2.x 的sylius omnipay 捆绑包或sylius 本身的更高版本。最好向 sylius 开发人员提出问题,询问您应该在那里做什么。
  • 进一步挖掘,似乎 sylius/omnipay-bundle 已过时——已有 2 年多的历史了。 sylius 本身在主项目中直接集成了omnipay,这似乎是最新的。要添加付款方式,您可能只需要适当的网关,例如作曲家需要全支付/贝宝
  • 感谢您的回答! composer require omnipay/paypal 在清除缓存时失败,而 composer require omnipay/2checkout 在渲染 An Exception was thrown while handling: Internal Server Error 时成功。日志说:"Attempted to call an undefined method named "setResourceOwnerMap" of class "HWI\Bundle\OAuthBundle\Security\OAuthUtils" 在我需要的适当文件中修复它之后(仅用于测试):omnipay/omnipay omnipay/stripe payum/payum payum/stripe 但除了离线之外,仍然没有任何其他支付方式的迹象。我一直在挖……

标签: payment gateway sylius omnipay


【解决方案1】:

我的问题已在 Git 问题 4369 中得到解答

所以,sylius-standard 已经包含 Symfony2-Bundles。 要添加支付网关,只需在 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

可在此处找到其他配置参考: https://github.com/Payum/PayumBundle/blob/master/Resources/doc/configuration_reference.md

谢谢!

PS:重启服务器前必须清除缓存。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-06
    • 2018-06-06
    • 2022-08-17
    • 2014-07-22
    • 2019-04-04
    • 2019-08-16
    • 2014-03-16
    • 1970-01-01
    相关资源
    最近更新 更多