Exposing api for /pay and /invoices.
 * rendering json for views if you append /api