Need help with integration api between Memberpress and Pipedrive (create new contact)

Hello, I try to import contact information from memberpress register to my CRM pipedrive contact with the API but when someone register on Memberpress nothing is going on Pipedrive . Thanks for your help ^^.

my code :

<?php

/*
Template Name: CRM Member
*/

//get_header();
$current_user_id = get_current_user_id();
$phone = get_user_meta($current_user_id,‘mepr_telephone’,true);
$nom = get_user_meta($current_user_id, ‘last_name’, true);
$prenom = get_user_meta($current_user_id, ‘first_name’, true);
$age = get_user_meta($current_user_id, ‘mepr_age’, true);
$id_partenaire = get_user_meta($current_user_id, ‘mepr_id_chez_notre_partenaire’, true);

global $current_user;
get_currentuserinfo();
$email = $current_user->user_email;
$username = $current_user->display_name;

error_log(‘User Infos’);
error_log($nom);
error_log($prenom);

// Content of create_deal.php
// Pipedrive API token
$api_token = ‘xxxxxxxxxxxxxxxxxxxxxxxx’;
$person = array(
‘name’ => $nom,
‘phone’ => $phone,
‘email’ => $email,
‘org_id’ => “1”,
‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ => $prenom, //Prenom
‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ => $age, //Age
‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ => $id_partenaire, //Etoro
‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ => $username, //UserWP
);

error_log(‘Person Infos’);
error_log(print_r($person, true));

// Person’s ID

// URL for updating a Person
$url = ‘https://xxxxxxxxxxxxxx.pipedrive.com/v1/persons?api_token=’ . $api_token;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $person);

//echo ‘Sending request…’ . PHP_EOL;

$output = curl_exec($ch);
curl_close($ch);

// Create an array from the data that is sent back from the API
// As the original content from server is in JSON format, you need to convert it to PHP array
error_log(‘Result API’);
error_log(print_r($output, true));

$result = json_decode($output, true);

error_log(‘Result API JSON DECODE’);
error_log(print_r($result, true));

// Deal title and Organization ID

// Check if an ID came back, if did print it out
if (!empty($result[‘data’][‘id’])) {
update_user_meta($current_user_id, ‘mepr_pipe_id’, $result[‘data’][‘id’]);
}

wp_redirect( ‘/espace-premium’ );
exit;
?>

Hi,
You might find the following wiki useful

https://devcommunity.pipedrive.com/t/importing-and-exporting-data/4963/2

Feel free to create a new topic if you still face challenges.