New API discount functions

See #2473, #2457