Adding contact to Zoho Invoice from deluge not working!

Adding contact to Zoho Invoice from deluge not working!

Hey everyone,

I've been trying to develop this super simple application that will let clients signup using a form I made in Creator. After submitting, they will be prompted to pay and when payment is successful, I want to send them an invoice using Zoho Invoice. All automatically.

I started writing a deluge script to add contacts to Zoho Invoice when the form is submitted, but the only value that's actually getting saved is the "contact_name"... I've tried every single suggestion found on this community and in any guides but nothing works...

  1. void createContact(string FirstName, string LastName, string Email, string Phone)
  2. {
  3.  values = Map();
  4.  values.put("contact_name",FirstName + " " + LastName);
  5.  
  6.  contactPerson = Map();
  7.  contactPerson.put("first_name",FirstName);
  8.  contactPerson.put("last_name",LastName);
  9.  contactPerson.put("email",Email);
  10.  contactPerson.put("phone",Phone);
  11.  contactPerson.put("is_primary_contact",true);
  12.  values.put("contact_persons",contactPerson);
  13.  response = zoho.invoice.create("Contacts","XXXXXXXXX",values);
  14. }
The code above, which should be the right way to do it, gives me the response: {"code":1038,"message":"JSON is not well formed"}
  1. void createContact(string FirstName, string LastName, string Email, string Phone)
    {
     values = Map();
     values.put("contact_name",FirstName + " " + LastName);
     values.put("email",Email);
     
     response = zoho.invoice.create("Contacts","693184158",values);
    }

The code above succeeds to run, but all I get is a contact with no email.

I even tried adding every single value a contact can have and I get the same result. A contact with a name and nothing else.

Can someone please explain what's wrong right now??