Allow several bean pods to ripen and dry on the plant. Do not let them get wet after they have started to dry (don’t water and make sure it doesn’t rain on them!).
Peas can be saved using the same method as beans. Just let them dry on the plants, and do not let them get wet.