How can users buy nodes they can create?
There's already a Commerce subproject called Commerce Node Checkout that does node publish purchasing with the option for expiration. 


  Integrate with Commerce in order to allow you to charge users to
  create nodes. It is possible to have multiple different product
  offerings for each node type, so the user can pick the product they
  want to purchase when creating the node. An example use-case would be
  a classifieds site that charges people to post listings.


It's purchase process is on demand, rather than purchasing a credit quota, so you might have to look at something different to base your project on depending on how important the quota functionality is.

An alternative role-based approach would be the Commerce License Roles submodule and something like the Node Limit module to setup your quota-per-role requirement. You'd also have to find a node expiration solution (e.g. Node Expire) as well.