Create Payment Automation Script

Create Payment Automation Script

Hi there, I am trying to automate some routine tasks.
I have integration with Shopify, all paid orders from Shopify automatically create Invoices in Zoho Books.
To track the payment inside Zoho usually you need to manually track the Payment by clicking on this action –  https://www.dropbox.com/s/cfkrngbsxkqc4sk/2017-12-16_18-14-45.png?dl=0

I want to automate this process for Invoices that created from Shopify.

To do so I have created automation script which will be performed via Workflow Rules.

Here the script:

  1. organizationID = organization.get("organization_id");
  2. customerID = invoice.get("contact_id");
  3. invoiceID = invoice.get("invoice_id");
  4. invoiceTotal = invoice.get("total");
  5. invoiceDate = invoice.get("date").toDate();
  6. zoho.books.createRecord("Customerpayments",organizationID,{"customer_id":customerID,"payment_mode":"cash","amount":invoiceTotal,"date":invoiceDate,"invoices":{{"invoice_id":invoiceID,"amount_applied":invoiceTotal}}});
For some reason it not working, could somebody help with this script.

Thanks