Kobra's information is not fully correct.
The authorizenet.php module (not the authorizenet_aim.php module) is the one you could use as an example. Model yours after the "offsite" mode used in that module. (Ignore/skip anything used by "onsite" mode, as you should not be collecting card data on your site using a module based after this one.)
In the module you supply the $this->form_action_url as the URL where the POST data is to be sent.
Then in the module you also supply all the POST data in the process_button() function.
That will cause the "Submit" button on the payment confirmation screen to be a direct POST to the URL you supplied.
You will then want the gateway to POST its reply back to the index.php?main_page=checkout_process URL of your store (often you accomplish this by passing that return URL as part of your POST data).
Then the before_process() function will read the data posted back to the checkout_process URL and validate the data. If anything in the response suggests payment ought to be or is declined, then you do a zen_redirect() back to the payment page after setting an error via the $messageStack.
Else if the POST indicates payment is successful then before_process() should do a return (or end without redirect).
Then the normal checkout flow will generate an order number and store the order.
Then the module's after_process() function will fire. In some modules (authorizenet does, but not all do) this is used to save extra information about the transaction to the database using the issued order number.
Then confirmation emails are sent out by the order class.


Reply With Quote
