Jump to content

How to modifi order total


martinmolero

Recommended Posts

I'm just arrived to prestashop development and I need some help.

 

I'm working whit a bank payment module and I need to modify the total amount of the order before sendding the payment to the bank platform (make a discount for this payment method).

 

My module is working (the bank is charging the disared amount) but this amount dont match with the order total cause I dont Know how to modify it from the module.

 

So, when the bank api response is sent to the shop I see an error payment cause the order total is 86.50 €, for example, and the paid amount is said to be 84,34 €.

 

Some one can help me, please?

Link to comment
Share on other sites

a workaround would be to recalculate the value after the api response, or use a unregistered variable to send the regular price

Suppose the discount is 1%, and the order is 100eur

-send 99eur total to the api

-when you get the response, add the 1% (actually 1/99) back and compare that to the cart total

 

or b.

use a dummy variable in your request, most apis support that

api.php?token=xxxx&orderId=12&price=99&actualPrice=100

and in the response compare the actualPrice variable instead of the price one

Link to comment
Share on other sites

a workaround would be to recalculate the value after the api response, or use a unregistered variable to send the regular price

Suppose the discount is 1%, and the order is 100eur

-send 99eur total to the api

 

This was what I made

 

-when you get the response, add the 1% (actually 1/99) back and compare that to the cart total

 

How to make this one?

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...