i’m trying to add differents prices currency through API using PHP.
I tried to declare the $data like this
$data = array(
'name' => $row['Nom'],
'code' => $row['Code Produit'],
'prices' => [[
'currency' => 'EUR',
'price' => '99'
But i always got the result error : Prices must be given as array of objects.
Can someone got a working example ?
I need to add EUR,GBP and USD prices directly.
Welcome to the community
Are you using create product endpoint? Here’s a snippet that works for me
$curl = curl_init();
CURLOPT_URL => 'https://<account_name>.pipedrive.com/v1/products?api_token=<api_token>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
$response = curl_exec($curl);
- The request payload has to be constructed with currency string as the key name
- The snippet makes use of API Token to test the payload structure. However, always prefer OAuth instead of API Token (unless it’s for testing purposes).
Hi @Hem , thanks for your code. it’s working now !