Jump to content

Payment Module With IPN


djpimp2010
 Share

Recommended Posts

Hi,

 

I am developing a custom payment module, and all is working well, until it comes to processing the response from the payment provider.

 

The payment provider has two parts to their system. The frontend will send postdata about the transaction, while redirecting the customer back to the website after payment. This postdata could be spoofed to force a transaction through, so it is only for display purposes (a thank-you message when the user returns to merchant website) [sTEP1]

 

The second part is an IPN system. The payment providers IPN system will send the same postdata to an IPN URL, which posts it back to validate it, and returns a response (a bit like paypal) [sTEP2]

 

Writing the code to parse the response is fine, and I can see from looking at another module, the syntax for informing the database about the sale completion is this:

$module->validateOrder((int)$cart->id, _PS_OS_PAYMENT_, ($_POST['amountReceived']/100), $module->displayName, null, array(), NULL, false, $cart->secure_key);

And this is the code that redirects the customer to the order completion page:

Tools::redirect('order-confirmation.php?id_module='.(int)$module->id.'&id_cart='.(int)$cart->id.'&key='.$customer->secure_key);

However, what I need to do, is direct the customer to a screen - either saying "order processed, here is details" (details returned from [sTEP1], but not save it to the database that the order is complete (validateOrder)

 

Then when the IPN listener receives postdata, THIS should be the script that should invoke validateOrder, and actually saves to the database.

 

 

 

 

Is there a way of marking an order as "being processed", so that I can show the default order confirmation page, but only validateOrder from the IPN ?

 

 

 

Thanks,

Glenn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More