Discussing APIs and development related to customers, discounts, and order management.
Suppose a customer placed an order as follows:
The total payment with taxes was $120.
Later, the customer requested to cancel and refund 1 unit of Product B, which would normally result in a $25 + tax refund. However, I’m applying a 30% restocking fee, so the actual refund amount should be $17.5 + tax.
When using the API to calculate the refund, I can only define the line item and quantity. After that, I directly create the refund based on the calculation. How can I specify that the refund should be $17.5 instead of the full $25?
A Cancel can happen in 2 ways 1) Store oversold the item hence left with no other option but to cancel 2) Customer called for a cancel. Typically restocking fee is applied during returns and if you have any returns integration like RETURNLY or LOOP RETURNS etc you can set the fee over there and achieve your requirement.
However if you want to do it yourself you may probably need to do via some backend Job (Java or something else) which can store in DB too. Because taking your case only If there are 2 items returned in same package you can charge restocking fee by lookup in DB (if its 1st time or not)