This is not mandatory. If you have a digital meter, you will be reimbursed for the electricity you will inject into the grid.
So be sure to check if your energy supplier will reimburse you for this and, if necessary, sign a contract to be reimbursed for the injected power.
You can easily find the best supplier through the V-test. 🤝