Use PHP API to send consent to process data and receive communications with CURL

Hi to all. I have a problem that I would like to share with you to try to get help to solve it.

I am currently developing the new website for the company I work for and I have made a custom form that works like a “two step” form. To make this customization I connected to the Hubspot API to get the forms data and I store them in a JSON file and make my custom HTML. I am using this method in PHP (CURL), to send the form to my Hubspot portal and I get all the data without any problem except the checkboxes for the privacy consent to process data and the subscription to receive communications. The documentation about the method I used does not explain how to send this fields.

Before writing this post I searched in this forum for information and I found this post where a user shows an approach to achieve this but with C# instead of PHP. I adapted the array structures showed in his example and added with hs_legal_basis to the encoded string I was sending to the endpoint.

The problem is that the field arrives to the endpoint but if I look in the submission received the field appears with a warning sign with this text:

"This value wasn't passed to the contact record. {} isn't one of the the allowed options."

Into the brackets there is the code sended but the field has not been assigned correctly to the contact. I have seen that the method with AJAX support includes this consent fields in the documentation but I would prefer to not change my code to be able to make it work because I have dedicated a lot of time with this PHP method.
I have not found much information about this and this is why I am asking for help. Maybe this method does not support the sending of this type of data?

Thank in you in advance.

Welcome, @morera_enfoca.

Apologies for the delayed response.

You are correct — the v2 Forms API endpoint does not accept GDPR consent and subscription information. Per the note in the documentation:

Looking … for support for our new GDPR functionality? Try the new v3 endpoint documented here.

I’m sorry that you’ve already spent a considerable amount of time troubleshooting this. I can tell you my team hopes to provide PHP and other code examples for all endpoints, including the v3 Forms API, in the future, however we don’t have a concrete timeframe.

Please let me know if you run into issues making calls to the v3 endpoint.

Hi @IsaacTakushi.
Thank you for your response. I will change the v3 then.
Best regards.