Check Paypal Purchase is Success or Not in Easy Digital Download Plugin

You should be able to generate discount codes within your callback function by using the edd_add_discount() function. You can learn more about this function here on the EDD Codex to see what specific data you need to pass to the function.

However, edd_complete_purchase might not be the right action to hook to. If you only want specific codes to be generated when specific payment types (PayPal) are successfully charged, you might want to instead hook to edd_before_payment_status_change. This is called in edd_update_payment_status(), which you can also see on the EDD Codex here, and should let you only run edd_add_discount() if the $new_status within edd_update_payment_status() is 'published' (or otherwise for a successful payment, instead of 'failed' or 'pending').