Several WordPress plugins can help you do just that!
WooCommerce Store Credit integrates with the popular WooCommerce e-commerce plugin to allow users to purchase store credits that can be used for future purchases. It supports various credit types and redemption rules, including features such as automatic credit expiration and partial credit usage.
MyCred is another excellent option. It is a full-featured point and rewards system that can be used for various applications, including credit-based systems. It supports multiple point types, including credits, and a wide range of customization options for point values, earning and spending rules, and more.
Finally, GamiPress is a points and rewards system that can be used to create credit-based systems. It allows you to create and manage multiple types of points, including credits and includes a range of features for controlling how points are earned and spent.
These are just a few of the many credit-based plugins available for WordPress. Depending on your specific needs, one of these plugins may be the perfect fit for your project.