func (s *API) CollectChargeViaBankAccount(id string, request CollectChargeViaBankAccountRequest) (data CollectChargeViaBankAccountResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s/collect", s.ZohoTLD, id),
		Method:       zoho.HTTPPost,
		ResponseData: &CollectChargeViaBankAccountResponse{},
		RequestBody:  request,
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return CollectChargeViaBankAccountResponse{}, fmt.Errorf("Failed to collect charge via bank account (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*CollectChargeViaBankAccountResponse); ok {
		return *v, nil
	}
	return CollectChargeViaBankAccountResponse{}, fmt.Errorf("Data retrieved was not 'CollectChargeViaBankAccountResponse'")
}
CollectChargeViaBankAccount collects charge via bank account
https://www.zoho.com/subscriptions/api/v1/#Invoices_Collect_charge_via_bank_account
package subscriptions
import (
	"fmt"
	"strconv"
	zoho "github.com/schmorrison/Zoho"
)
type InvoiceStatus string
const (
	InvoiceStatusAll           InvoiceStatus = "Status.All"
	InvoiceStatusSent          InvoiceStatus = "Status.Sent"
	InvoiceStatusDraft         InvoiceStatus = "Status.Draft"
	InvoiceStatusOverDue       InvoiceStatus = "Status.OverDue"
	InvoiceStatusPaid          InvoiceStatus = "Status.Paid"
	InvoiceStatusPartiallyPaid InvoiceStatus = "Status.PartiallyPaid"
	InvoiceStatusVoid          InvoiceStatus = "Status.Void"
	InvoiceStatusUnpaid        InvoiceStatus = "Status.Unpaid"
	InvoiceStatusPending       InvoiceStatus = "Status.Pending"  
)
func (s *API) listInvoicesWithParams(status InvoiceStatus, paramName, paramValue string) (data InvoicesResponse, err error) {
	if status == "" {
		status = InvoiceStatusAll
	}
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices", s.ZohoTLD),
		Method:       zoho.HTTPGet,
		ResponseData: &InvoicesResponse{},
		URLParameters: map[string]zoho.Parameter{
			"filter_by": zoho.Parameter(status),
		},
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	if paramName != "" {
		endpoint.URLParameters[paramName] = zoho.Parameter(paramValue)
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return InvoicesResponse{}, fmt.Errorf("Failed to retrieve invoices: %s", err)
	}
	if v, ok := endpoint.ResponseData.(*InvoicesResponse); ok {
		return *v, nil
	}
	return InvoicesResponse{}, fmt.Errorf("Data retrieved was not 'InvoicesResponse'")
}
func (s *API) ListAllInvoices(status InvoiceStatus) (data InvoicesResponse, err error) {
	return s.listInvoicesWithParams(status, "", "")
}
func (s *API) ListInvoicesForSubscription(status InvoiceStatus, subscriptionID string) (data InvoicesResponse, err error) {
	return s.listInvoicesWithParams(status, "subscription_id", subscriptionID)
}
func (s *API) ListInvoicesForCustomer(status InvoiceStatus, customerID string) (data InvoicesResponse, err error) {
	return s.listInvoicesWithParams(status, "customer_id", customerID)
}
func (s *API) GetInvoice(id string) (data InvoiceResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s", s.ZohoTLD, id),
		Method:       zoho.HTTPGet,
		ResponseData: &InvoiceResponse{},
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return InvoiceResponse{}, fmt.Errorf("Failed to retrieve invoice (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*InvoiceResponse); ok {
		return *v, nil
	}
	return InvoiceResponse{}, fmt.Errorf("Data retrieved was not 'InvoiceResponse'")
}
func (s *API) AddAttachment(id, file string, canSendInEmail bool) (data AttachementResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s/attachment", s.ZohoTLD, id),
		Method:       zoho.HTTPPost,
		ResponseData: &AttachementResponse{},
		Attachment:   file,
		BodyFormat:   zoho.FILE,
		URLParameters: map[string]zoho.Parameter{
			"can_send_in_mail": zoho.Parameter(strconv.FormatBool(canSendInEmail)),
		},
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return AttachementResponse{}, fmt.Errorf("Failed to attach file to invoice (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*AttachementResponse); ok {
		return *v, nil
	}
	return AttachementResponse{}, fmt.Errorf("Data retrieved was not 'AttachementResponse'")
}
func (s *API) EmailInvoice(id string, request EmailInvoiceRequest) (data EmailInvoiceResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s/email", s.ZohoTLD, id),
		Method:       zoho.HTTPPost,
		ResponseData: &EmailInvoiceResponse{},
		RequestBody:  request,
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return EmailInvoiceResponse{}, fmt.Errorf("Failed to email invoice (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*EmailInvoiceResponse); ok {
		return *v, nil
	}
	return EmailInvoiceResponse{}, fmt.Errorf("Data retrieved was not 'EmailInvoiceResponse'")
}
func (s *API) AddItems(id string, request AddItemsRequest) (data AddItemsResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s/lineitems", s.ZohoTLD, id),
		Method:       zoho.HTTPPost,
		ResponseData: &AddItemsResponse{},
		RequestBody:  request,
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return AddItemsResponse{}, fmt.Errorf("Failed to add items to invoice (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*AddItemsResponse); ok {
		return *v, nil
	}
	return AddItemsResponse{}, fmt.Errorf("Data retrieved was not 'AddItemsResponse'")
}
func (s *API) CollectChargeViaCreditCard(id string, request CollectChargeViaCreditCardRequest) (data CollectChargeViaCreditCardResponse, err error) {
	endpoint := zoho.Endpoint{
		Name:         "invoices",
		URL:          fmt.Sprintf("https://subscriptions.zoho.%s/api/v1/invoices/%s/collect", s.ZohoTLD, id),
		Method:       zoho.HTTPPost,
		ResponseData: &CollectChargeViaCreditCardResponse{},
		RequestBody:  request,
		Headers: map[string]string{
			ZohoSubscriptionsEndpointHeader: s.OrganizationID,
		},
	}
	err = s.Zoho.HTTPRequest(&endpoint)
	if err != nil {
		return CollectChargeViaCreditCardResponse{}, fmt.Errorf("Failed to collect charge via credit card (%s): %s", id, err)
	}
	if v, ok := endpoint.ResponseData.(*CollectChargeViaCreditCardResponse); ok {
		return *v, nil
	}
	return CollectChargeViaCreditCardResponse{}, fmt.Errorf("Data retrieved was not 'CollectChargeViaCreditCardResponse'")
}