简体   繁体   English

Magento在结帐后使用自定义付款方式处理付款

[英]Magento process payment after checkout for custom payment method

I am trying to create a custom payment module in magento. 我正在尝试在magento中创建自定义付款模块。 I found a lot of tutorials for this, but only ones that just add the order. 我为此找到了很多教程,但只有那些只是添加了订单。 My question is: How can i set the order to paid when the user clicks on checkout. 我的问题是:当用户点击结帐时,如何设置订单付款。

This is the relevant code i have so far: 这是我到目前为止的相关代码:

Config.xml Config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <My_Module>
            <version>1.0.0.0</version>
        </My_Module>
    </modules>

    <global>


        <models>
            <My_Module>
                <class>My_Module_Model</class>
            </My_Module>
        </models>
    </global>


    <default>
        <payment>
            <mypayment>
                <active>1</active>
                <model>My_Module/Payment</model>
                <order_status>processing</order_status>
                <title>Testing</title>
            </mypayment>
        </payment>
    </default>
</config>

Model/payment.php 型号/payment.php

<?php

class My_Module_Model_Payment extends Mage_Payment_model_Method_Abstract{
    protected $_code = 'mypayment';

    protected $_isInitializeNeeded      = false;
    protected $_canUseInternal          = true;
    protected $_canUseForMultishipping  = true;
}

I also find it very hard to find documentation. 我也很难找到文档。 For example, i am looking for a list of events, and a documentation for the payment method, but i do not seem to find anything. 例如,我正在寻找事件列表和付款方式的文档,但我似乎什么也没找到。 Does Magento not offer any of these? Magento是否不提供任何这些?

I think you need to utilize the Varien_Object and Sales_Quote to do any custom payment of any sorts with Magento (not sure on this), and not just the abstract payment method. 我认为您需要利用Varien_Object和Sales_Quote使用Magento进行任何形式的自定义付款(不确定这一点),而不仅仅是抽象付款方式。

Check this (the answer has a link to an actual working example of a custom payment module). 选中此项(答案具有指向自定义付款模块的实际工作示例的链接)。 Magento custom payment method Magento自定义付款方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM