We have a fairly straightforward piece of code to add deals to Pipedrive. Deals are added, but for some reason they do not end up in the correct stage/pipeline.
$deal = array(
'title' => $firstName.' '.$lastName.' API import',
'value' => $value,
'person_id' => $personId,
'status' => 'won',
'pipeline_id' => 5,
'stage_id' => 30
);
$url = 'https://' . $company_domain . '.pipedrive.com/api/v1/deals?api_token=' . $api_token;
$dealCurl = curl_init();
curl_setopt($dealCurl, CURLOPT_URL, $url);
curl_setopt($dealCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($dealCurl, CURLOPT_POST, true);
curl_setopt($dealCurl, CURLOPT_POSTFIELDS, $deal);
$output = curl_exec($dealCurl);
curl_close($dealCurl);
$result = json_decode($output, true);
$dealId = $result['data']['id'];
I have no idea why this is going south.