Jump to content

third party credit card payment module response url. Which?


aptivus

Recommended Posts

Hi everyone,

I have recently set up an ecommerce built on Prestashop. I've tried to customize it as much as I could with my short knowledge of how Prestashop works and this is the result:

www.clorofillabioshop.it.

I have made a payment module for my client bank credit card gateway, called BNL Positivity.

I know that someone is selling it as payed module, but I wanted to make my own.

As you could probably test, the shop takes the buyer to the payment page and lands on the POS page as well.

You can try making a fake payment, if you mind. It is still in test-mode.

 

The payment gateway needs 2 parameters to manage the OK and the KO events.

What are the supposed links to pass to the payment module?

 

Is there any page, controller or whatsoever that could be called in case of success, so that the order can be positively stored in the database?

 

As for now, I get the payment and let the gateway point to shopurl/success.php (that dosn't exist), but I must be able to store the order in case of OK event and present an error page (or the order summary page and a GET paramenter that, if present, could open an error message) in case of KO event.

 

Any help would be highly appreciated.

Thank you all.

Link to comment
Share on other sites

Most payment modules like this would have a validation.php, or return.php, or even a combination of success.php and fail.php pages

 

The point being that the module should provide a return page where the payment gateway would send the customer to after payment is made.  That page would be responsible for interpreting the response code from the payment gateway, create the order or display an failure message.

Link to comment
Share on other sites

Thanks Bellini,

here is what I was trying to do...

this is my validation.php file that gets called as success/fail event from the payment gateway (just a test):

include(dirname(__FILE__).'/../../config/config.inc.php');

        if (($_POST['status'] == 'APPROVED') || ($_POST['status'] == 'APPROVATO') || ($_POST['status'] == 'GENEHMIGT'))
        {
        Db::getInstance()->Execute('UPDATE demo_tb SET counter = (counter+1) WHERE id = 1');
        
        validateOrder((int)$id_cart,14, (float)$_POST['chargetotal'], 'Positivity BNL', $orderMessage, array(), NULL, false, $cart->secure_key);
        }

As you can see, I make a check incrementing a counter i case of success.

It works.

What doesn't work is the validateOrder call (supposing I have to call it to store an order in the db and than pesent the thank you page)

That's so confusing to me.

Any suggestion?

Link to comment
Share on other sites

You cannot just call validateOrder function, since it does not exist in your php file.  The function is included as part of the PaymentModule class, so you would have to include your main payment module file, and then call it

 

You should copy the bankwire validation.php file and use that as a guide.  Then just add your custom status logic

Link to comment
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
×
×
  • Create New...