CBSubs has no official functionality for that so it's quite complicated to get working. Below is a tutorial on how to do this using CBSubs SQL Actions and directly generating coupons in the database.
www.joomlapolis.com/documentation/283-cb-paid-subscriptions/tutorials/18407-purchasing-discount-coupons
CB Auto Actions can also generate coupons now using its CB Paid Subscriptions action so you maybe able to combine it with the below trigger usage to generate coupons for users when they purchase a plan.
Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A
Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A