Javascript Magento支付网关文档
根据官方文档,支付网关的主要预定义功能是Javascript Magento支付网关文档,javascript,php,xml,magento,Javascript,Php,Xml,Magento,根据官方文档,支付网关的主要预定义功能是capture()和authorize(),它们应该在使用选定的支付方式下订单后执行 我试图设置的支付网关正在请求https POST数据并返回json响应。它基本上只是cc支付网关 此post数据应正确放置在模块内的何处 如何在完成显示顺序后使用gateways json响应(这样我知道它执行正确) 模块结构应该如何满足此任务的最基本需求 这就是我的代码要做的: <?php class Mycompany_Pay_Model_Pay ex
capture()
和authorize()
,它们应该在使用选定的支付方式下订单后执行
我试图设置的支付网关正在请求https POST数据并返回json响应。它基本上只是cc支付网关
<?php
class Mycompany_Pay_Model_Pay extends Mage_Payment_Model_Method_Abstract
{
protected $_code = 'mycompany_pay';
protected $_isGateway = true;
protected $_canCapture = true;
protected $_canRefund = true;
protected $_canUseInternal = true;
protected $_allowCurrencyCode = array('EUR', 'HRK');
protected $_minValue = 1;
// taking predefined objects for further usage
public function capture(Varien_Object $payment, $amount){
$order = $payment->getOrder();
//$order = Mage::getModel('sales/order')->load($orderId);
$billingInfo = $order->getBillingAddress();
$customer = Mage::getSingleton('customer/session')->getCustomer();
$postfields = array('order_id'=>9999, // temp number for debugging
'name'=> $customer->getName(),
'mail'=> $customer->getEmail(),
'address'=> $billingInfo->getStreet(1),
'zip'=> $billingInfo->getPostcode(),
'city'=> $billingInfo->getCity(),
'state'=> $billingInfo->getRegion(),
'country'=> $billingInfo->getCountry(),
'amount'=> $amount,
'currency'=>$order->getBaseCurrencyCode(),
'cc'=> $payment->getCcNumber(),
'cvv'=> $payment->getCcCid());
curl_setopt($ch, CURLOPT_URL, 'https://mygatewayUrl');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
print $result;
}
}
我认为本教程将介绍实现您所需的方法:
我可以提取其中的部分内容来回答您的问题,但我认为Manish Prakash给出的整个概述可能会丢失,它以非常清晰的方式涵盖了整个过程,请看。如果您有多个问题,您应该自己问他们。