首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在magento中实现基于自定义API的支付方式的三维安全验证

在magento中实现基于自定义API的支付方式的三维安全验证
EN

Stack Overflow用户
提问于 2014-02-13 12:09:56
回答 1查看 842关注 0票数 2

我正在开发基于自定义API的支付网关。对于3D安全验证,支付网关返回编码表单,需要提交给第三方站点上的用户重定向进行卡验证。

我是工作在这个代码捕获功能的支付模式。

在这里,我的问题是,我如何使用编码形式重定向用户从支付模式捕获方法到第三方网站。

我使用getOrderPlaceRedirectUrl在宿主表单方法中重定向用户。

请建议一下。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-13 15:50:39

我创建了一个新的控制器操作,并将用户从getOrderPlaceRedirectUrl()重定向到它。这个新的控制器动作将显示一个隐藏形式,它将MD、PaReq等显示为隐藏字段。然后,此表单可以自动提交给ACS URL。

下面是一些未经测试的伪代码。您将需要根据您的需要对其进行修改,但希望它能让您了解这个想法。

在您的支付方法实例中:

代码语言:javascript
运行
复制
function getOrderPlaceUrl() {
    Mage::getModel('core/session')->setMd('valuehere'); //  Set all the 3DS params into the session by the time this function call finished.  Don't set them here in actual code - bad style.  This is just for demonstration.
    return Mage::getUrl('module/payment/action');
}

app/code/local/Namespace/Module/controllers/Payment.php:

代码语言:javascript
运行
复制
class Namespace_Module_PaymentController extends Mage_Core_Controller_Varien_Front {
    public function redirectAction() {
        $this->loadLayout();
        $this->renderLayout();
    }
}

app/design/frontent/base/default/layout/module.xml:

代码语言:javascript
运行
复制
<namespace_module_payment_redirect>
    <reference name="content">
        <block type="namespace_module/payment_redirect</block" name="namespace.module.payment.redirect" template="namespace/module/payment/redirect.tpl" />
    </reference>
</namespace_module_payment_redirect>

app/code/local/Namespace/Module/Block/Payment/Redirect.php:

代码语言:javascript
运行
复制
class Namespace_Module_Block_Payment_Redirect extends Mage_Core_Block_Abstract
    public function getMd() {
        return Mage::getModel('core/session')->getMd();
    }
}

app/design/frontend/base/default/templates/module/payment/redirect.tpl:

代码语言:javascript
运行
复制
<form action="payment_gateway_url_here" method="post">
    <input type="hidden" name="MD" value="<?php print $this->getMd(); ?>" />
</form>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21753859

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档