如何在Magento中关闭PayPal IPN? [英] How do I turn off PayPal IPN in Magento?

查看:278
本文介绍了如何在Magento中关闭PayPal IPN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当人们在我的Magento网上商店中使用PAyPal成功付款时,它会自动创建具有唯一发票编号的发票.由于簿记原因,我必须将其禁用.

When people make a successful payment with PAyPal in my Magento webshop it automatically creates an invoice with unique invoice number. For bookkeeping reasons, I have to disable it.

我已经搜索了几个星期,但仍然没有找到解决该问题的方法.到目前为止,我所知道的是这是由IPN引起的.问题是我不知道如何在不损坏我的商店或贝宝付款的情况下将其关闭.

I've been searching for a few weeks now but I still haven't found the solution for this problem. What I know so far is that this is caused by IPN. The problem is I don't know how to turn this off without damaging my shop or paypal payments.

更多规格: -版本:Magento 1.6.2.0 -标准贝宝

Some more specs: - Version: Magento 1.6.2.0 - Standard paypal

包含IPN的文件: www/app/code/core/Mage/Paypal/controllers

Files containing IPN: www/app/code/core/Mage/Paypal/controllers

推荐答案

将其关闭"有点含糊,但是Magento上没有配置设置,允许您使用IPN系统接受PayPal标准付款,但是不创建发票.您正在寻找编写自定义代码来做到这一点.这里是一些起点.

"Turning it Off" is sort of vague, but there's no configuration setting on the Magento side that will allow you to accept PayPal standard payments using the IPN system but not create invoices. You're looking at writing custom code to do this. Here are some starting points.

PayPal IPN使用回调URL.也就是说,一旦PayPal处理了付款,它就会从Magento中获取一个特定的URL,并在post字段中包含一组特定的数据.然后,基于此信息,采取适当的措施(创建发票,发出贷方等).因此,达到目标的最快方法是更改​​PayPal配置中的IPN URL.这意味着PayPal仍在通知URL,但未通知Magento URL,并且永远不会创建发票.

PayPal IPN works with a callback URL. That is, once PayPal has processed a payment, it fetches a specific URL from Magento with a specific set of data in the post field. Then, based on this information, appropriate action is taken (an invoice is created, a credit is issued, etc.). So the quickest way to achieve your goal would be to change the IPN URL in your PayPal configuration. This means PayPal is still notifying a URL, but not the Magento URL, and an invoice never gets created.

如果这行不通或产生不​​可接受的副作用,这是您感兴趣的代码点.假设您使用的是标准的Magento PayPal设置,其IPN URL配置为

If that doesn't work or has unacceptable side effects, here's the code points you're interested in. Assuming you're using a standard Magento PayPal setup with an IPN URL configured at

http://yourstore.example.com/paypal/ipn/

Magento将使用

Magento will handles this request with the indexAction method in

#File: app/code/core/Mage/Paypal/controllers/IpnController.php
public function indexAction()
{
    if (!$this->getRequest()->isPost()) {
        return;
    }

    try {
        $data = $this->getRequest()->getPost();
        Mage::getModel('paypal/ipn')->processIpnRequest($data, new Varien_Http_Adapter_Curl());
    } catch (Exception $e) {
        Mage::logException($e);
    }
}

此方法(包括创建发票)的业务逻辑始于paypal/ipn模型.在标准系统中,这解析为位于

The business logic for this method (including your invoice creation) starts in the paypal/ipn model. In a standard system this resolves to the class at

#File: app/code/core/Mage/Paypal/Model/Ipn.php
class Mage_Paypal_Model_Ipn
{
    ....
}

从此处跟踪代码以查找要rewrite所需的方法,并实现所需的功能更改(不创建发票).最好的选择是设置一个PayPal开发人员沙箱帐户,以便您可以重复访问该URL,直到将代码跟踪到正确的位置为止.

Trace the code from here to find the method you'll want to rewrite and implement your desired functionality changes (not creating an invoice). Your best bet will be setting up a PayPal developer sandbox account so you can repeatedly hit the URL until you've traced your code to the right spot.

祝你好运!

这篇关于如何在Magento中关闭PayPal IPN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆