views:

577

answers:

2

I found this related question which confirmed a lot of what I already thought

but one question remains; how does a custom payment module integrate with the store's database?

I am developing a custom payment method that transfers the user to a secure site, hosted by a bank in Australia which will process credit card transactions. For this module, I'll need to pass information onto the bank's site and also get information back once the transaction is complete.

Naturally, I don't want to have any database updates happening before the transaction is complete, so how do I configure my method to

A. stop the database from updating and
B. update the database once the transaction confirmation is relayed back from the bank?

Thanks in advance, no one seems to want to help me over at the Magento forums...

A: 

I don't know exactly how it's handled, but I'd look at Magento's own implementation for similar payment gateways like Google Checkout or Paypal. They work in a manner similar to what you describe for your payment processor.

timdev
A: 

You need to update order history/comments base on response that you get from payment website.

$order = Mage::getModel('sales/order'); if ($response['SUCCESS'] == 'Y') $order->addStatusToHistory($order->getStatus(), Customer successfully returned from payment website');

hope it will help

AK