In-App monthly subscription with promo code?

I was wondering, is it possible (has anyone done it) to have a promo codes for monthly subscriptions? For example, adding “PROMO15” code, which will discount 15% of the first month?

I managed to do it like this: I added “Standart plan” and “Promo plan” with fixed prices as an in-app products in App Store and Google Play. In the app, I made it with if/else.