Refactoring a little; introduce error handling

Refactor to move logic into base
Add an exception and throw it on API error
Support Pin.JS and a publishable key for payment forms