Add discount to order in web payment sdk using php

Please the discount code is it compulsory that should be created in my square dashboard? If it’s compulsory how do I go about applying a discount code created for a particular product outside square to an order in square… Thanks :pray: for your kind response…