How to realize freight calculation for international express delivery

there are freight quotation materials for UPS DHL FedEx express delivery. The freight needs to be calculated according to the number of goods settled by the user and the country and region chosen by the user. How to achieve this function is better?

    Is
  1. configured in js, then calculated directly in js and displayed?
  2. is written in the background interface, and the js access interface gets the calculation result?

in addition, is there a direct interface to the express delivery company to provide query function?

Nov.19,2021

I wonder if our business is the same as yours.

my understanding is that it is best to write to the back end. Most of the time, the data is real-time. For example, if a courier company modifies the freight calculation formula, they will notify your back end so that you can reconcile the account. Otherwise, if the front-end calculation, what about this part of the error


first of all, no matter whether the frontend is freight or not, the freight must be calculated in the backend API, because for the backend, the data transmitted by the frontend is "untrusted" (the frontend cannot prevent tampering), so even if the frontend calculates the freight and transmits it to the backend, the backend still needs to adjust the API to calculate the freight.
so back-end computing is recommended.

Menu