This subject, has been explained detailly in the linked document below.

https://kb.sambapos.com/en/4-12-advanced-delivery-service-implementation-v5-2-3/