How Can I Fix the JSON Error and Date Format Mismatch when Automating Invoicing between Stripe and Zoho Books?

This topic was automatically generated from Slack. You can find the original thread here.

Hi Pipedream !
I am in the process of setting up a workflow. The objective is that when an invoice comes in Stripe I want to automatically create a corresponding invoice in Zoho books. I intend to replicate a similar process for payments.
Both Stripe and Zoho keys are configured correctly. However, when I attempt to test my workflow, I encounter the following error:
Error - Request failed with status code 400
{“code”:1038,“message”:“JSON is not well formed”}
Could you assist me in addressing this issue?
Additionally, I encountered another challenge regarding the date format. Stripe sends the date in a UNIX timestamp format, but Zoho Books requires the date in the “yyyy-mm-dd” format. Do you have any recommendations on how I can effectively convert and transmit this data?
Thank you for your assistance.
Best regards,
Anatole

Hi Pipedream !
I am in the process of setting up a workflow. The objective is that when an invoice comes in Stripe I want to automatically create a corresponding invoice in Zoho books. I intend to replicate a similar process for payments.
Both Stripe and Zoho keys are configured correctly. However, when I attempt to test my workflow, I encounter the following error:
Error - Request failed with status code 400
{“code”:1038,“message”:“JSON is not well formed”}
Could you assist me in addressing this issue?
Additionally, I encountered another challenge regarding the date format. Stripe sends the date in a UNIX timestamp format, but Zoho Books requires the date in the “yyyy-mm-dd” format. Do you have any recommendations on how I can effectively convert and transmit this data?
Thank you for your assistance.
Best regards,
Anatole

Hi Anatole, First, let’s address the JSON error. It seems like the JSON payload you’re sending to Zoho Books might be malformed. Please double-check the structure of the JSON payload you’re sending to ensure it matches the format expected by Zoho Books API. Regarding the date format conversion, you can convert the UNIX timestamp to the “yyyy-mm-dd” format using the following code snippet in a Pipedream code step: const unixTimestamp = steps.trigger.event.date; // Replace with the actual timestamp from Stripe const date = new Date(unixTimestamp * 1000); const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`; Now you can use the formattedDate variable in your payload when sending data to Zoho Books. If you’re still encountering issues, please provide more information about your workflow, such as the code you’re using to send data to Zoho Books, so I can better assist you. Best regards, Pipedream Support Bot

Now it giving
SyntaxError
Unexpected identifier

the json is the Json that pipedream generate …

Can you share more details about the step and the error? Screenshot would be helpful too.
Thanks

sure

https://tinyurl.com/yrk4bk63

https://www.awesomescreenshot.com/image/42923028?key=d5086c3f4c6fdf7137841dcf0e6c884c

https://www.awesomescreenshot.com/image/42923024?key=6faef90539ac6564690f85fc3f763e80

due to missing required field maybe ?

but in this case whats the required fiedls ?

Can you open config.response or config.error or something like that in this screenshot? Usually there’s more info there

Here are some details on the Zoho Books API: Invoices | Zoho Books | API Documentation

that config on result : Awesome Screenshot ?