Thanks for the info. We can move forward.
I think there’s another piece of code in your file that needs to populate these properties.
You should first check if these properties exist in Hubspot. To do this, go to Settings > Properties > Contacts properties > and search for each of the properties sent in the old form (lead_source, lead_type, gclid, signup_source, etc.). Let me know if they exist here.
Next, I need to know where the data is coming from: I think the data being sent isn’t coming from an online form, but from a payment return via another application. Can you confirm this? You receive a payment confirmation and send it to Hubspot, is that correct?
If not, you need to explain the PHP workflow in which this data submission to Hubspot is inserted (where in which workflow is the submission located?).
If so, I’ll have to wait for your response regarding the properties before answering you.
Next, I need to know if your PHP script is located on a domain name that is registered in Hubspot. Go to Settings > Tools > Content > Domains & URLs > Domains, and check if the domain your PHP script for sending data is running on is in the list. Tell me the answer here.
Finally, I also need you to check whether your tracking code is installed on the site where your scripts are running. To do this, you must have answered yes to the previous question (the domain where your script is running is listed in the domains declared to HubSpot). In this case, go to Settings > Tracking Code or Settings > Tracking & Analytics > Tracking Code, copy the value of the src attribute of the “script” tag, and check if you can find this value in the source code of your pages.
This source code retrieves all your forms that are on your pages (but obviously the form in question here is not a form filled out on a page…) and manages your cookies and the Hubspot banner on your site (for example this allows you to retrieve, in the cookies deposited by Hubspot, an identifier which allows you, in Hubspot, to link all the actions of the same contact together, and this will remove the warning that you have on your collected data: “The cookie needed to link form submissions…”).
Sorry for the delay in responding and the number of questions I’m asking you, but this problem is not trivial. I assume that there is, on your side, another piece of code that adds data to the form submission (you would have to try to capture the complete request that is sent to Hubspot to see the difference between the two submissions). It is also possible that the form ID is used in your code to send other additional information that was kept throughout the purchasing process (if your script fits well into a purchasing process). In this case, this would explain why, when the form id changes, the process is broken.
But these are just assumptions that you need to check.
In my opinion and based on the information I see (if you send a contact’s trace - where they come from, from which campaign, etc. once they have paid), the best thing would be to create these properties in Hubspot and fill them in directly once the payment is validated. Going through the form API is only useful in cases where you have a form that is not accessible by the tracking codes (an app or another site that is not on a domain declared in Hubspot) and you still want to capture submissions. If you just want to keep information, you have to go through the object APIs (here contacts) once you have created these properties in Hubspot, and you can then fill in information throughout your purchasing process. You can then use these properties in workflows, reports, etc.