The website builder SaaS application has a feature that lets customers connect their Stripe accounts to their website and receive money. Each user (website owner) of this SaaS application has a Stripe account.
During the development phase of the application, we were just storing Stripe public/private keys of each customer in the internal database in an encrypted way. But even if it's encrypted, this is not the way to go in a Production environment for us.
What would be the proper approach to store sensitive Stripe configuration for each account in the database securely?
Use Stripe's restricted API keys
Stripe has restricted API keys that allow Stripe's customers to give a subset of the permissions to a key that it can then share with a 3rd party service.
From Stripe's documentation https://stripe.com/docs/keys#limit-access
STORE RESTRICTED API KEYS / ENCOURAGE KEY ROTATION
These restricted keys are much less of a security risk than a full API key which is akin to "root" access. Encrypted storage of these restricted keys could meet your security needs. Also educating your customers of best practices including API key rotation would help reduce and share risk with your customers.