Isy*_*Isy 2 authorize.net magento
任何人都可以帮助我使用Authorize.Net获取授权和捕获步骤(代码)吗?似乎每个人都知道如何同时使用两者,但是,没有解释为什么我们可以这样做到特殊步骤,首先授权和之后的Capture(使用trasactionID).
请按照以下步骤在授权后自动捕获您的订单:
将付款方式配置为授权(非直接销售)
创建一个观察器,它将处理sales_order_payment_place_end使用方法调用的事件automaticalyCaptureOrder
使用以下观察者方法代码:
public function automaticalyCaptureOrder(Varien_Event_Observer $observer)
{
$payment = $observer->getEvent()->getPayment();
// Add additional check for payment method instance,
// We need to be sure that only Authorize.Net payment will be captured
if ($payment->getMethodInstance() instanceof Mage_Paygate_Model_Authorizenet) {
$payment->capture(null); // null value tells Magento to create
// an invoice automatically
}
}
Run Code Online (Sandbox Code Playgroud)坐下来放松一下:)
如果您对此解决方案有任何困难,请告诉我,我会尽快给您回复.
更新:
要在一段时间后捕获订单付款,您应该按其唯一ID加载订单对象,并执行与以前类似的操作,但您还需要在调用捕获方法后保存订单对象:
$order->load($orderId); // Or $order->loadByIncrementId($incrementId);
$order->getPayment()->capture(null); // Capturing the payment
$order->save(); // Save updated information (transaction ids, order status)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5070 次 |
| 最近记录: |