code: def cancel(self, invoice_id, **kwargs):
          
          Cancel an unpaid Invoice with given ID via API
          It can only be called on an invoice that is not in the paid state.
  
          Args:
              invoice_id : Id for cancel the invoice
          Returns:
              The response for the API will be the invoice entity, similar to create/update API response, with status attribute's value as cancelled
          """
          url = "{}/{}/cancel".format(self.base_url, invoice_id)
          return self.post_url(url, {}, **kwargs)
docs: Cancel an unpaid Invoice with given ID via API
          It can only be called on an invoice that is not in the paid state.
  
          Args:
              invoice_id : Id for cancel the invoice
          Returns:
              The response for the API will be the invoice entity, similar to create/update API response, with status attribute's value as cancelled