Hi, i can make this code for you, to work with ajax, for a more smooth user experience.
This will involve, a small management system build up or integrated in to your website admin to manage, generate, validate the discount codes.
I have worked before with paypall apis, and i am well versed with php/mysql, javascript/ajax, and i can handle this in ~2days.