Here's the workflow you can implement to get this done - 

  1. Configure webhooks in Chargebee. 
  2. Once this is done, you'll receive "invoice_generated" webhook when an invoice is generated on your site. 
  3. Now collect the invoice payment outside Chargebee
  4. Once the charge is collected, call the record an invoice payment API. This will move the invoice status to PAID.

So in this case, Chargebee and your gateway would function as separate entities, brought to work together using your API integration.