Before we talk about how to repair this, you may want to ask yourself an important question: Do you want this relationship? If you do, then explain to your boyfriend that you didn’t realize how upsetting this would be for him, apologize, and make a commitment to being more transparent with him in the future.
However, the fact that you made this decision and most likely had some inkling that he would not be pleased if he found out might mean you may have some issues about the viability of your relationship with him. This is, of course, speculation on my part, but I find that in instances of this type of oversight is often linked to the stability of the relationship. If this is the case, it may be time for the two of you to have a deeper discussion about the future of the relationship.