Auto Apply Retainer via Zoho Books

Difficulty: Advanced
Estimated reading time: 30 mins
Estimated implementation time:
1 hour 30 mins

Zoho Books Auto Apply Retainer

For this custom function to work, you will need the following:

  1. A connection to the Zoho Books API named “zoho_books”.
  2. At least one Retainer Invoice.
  3. An Invoice to apply it to.

Zoho Books Connection

Create API Credentials: Gives you a Client ID and Client Secret to use in the next step.

  1. Go to the Zoho API Console
  2. Click Add Client and select Server-based Applications
  3. Fill in the following fields:
    • Client Name -> Zoho Books API
    • Homepage URL ->
    • Authorized Redirect URIs ->
  4. Click Update
  5. Notice the Client ID and Client Secret here. You will need these in the next step, so keep this tab open.

Want to learn even more? Sign up for one of our Zoho courses!

Create Custom Connection

  1. Go to Zoho Books
  2. Click Settings, select the Automation tab, then choose Custom Functions.
  3. Select + New Custom Function and give it a random name and module. We will only use this function for a simple test.
  4. Choose Connections on the right hand side, then Go To Connections.
  5. Click Add Connection. Choose Custom Service.
  6. Fill in the following fields (This has to be very exact):
    • Service Name -> Zoho Books
    • Service LinkName -> zoho_books
    • Authentication Type -> oAuth2
    • Param Type -> Header
    • Grant Type -> Authorization Code
    • Client ID -> [YOUR_CLIENT_ID]
    • Client Secret -> [YOUR_CLIENT_SECRET]
    • Authorize URL ->
    • Access Token URL ->
    • Refresh Token URL ->
    • Connection Name -> Zoho Books
    • Connection LinkName -> zoho_books
    • Scope -> ZohoBooks.fullaccess.all (Note: Be sure to click the ‘+’ for the scope)
    • Use credentials of login user -> UNCHECKED
  7. Click Create and Connect. If asked to authenticate, enter your login details.

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page.

More Free Resources

Deluge Tips – Null Check

When scripting, ask yourself this question – will this value ever be null? If it’s a yes, that’s a place for a null check! Here are 3 tips and best practices to help you kickstart the habit.

Read More »