I'm trying to send PayPal POST data to a Mautic form as in this guide.
The only change I made to the code in the example is removing the IP forwarding stuff.
My code seems to be connecting to Mautic and sending the data, as Mautic is creating a new contact in the form submission, but it is only logging the IP address and date of creation - none of the fields are filled in. I tried logging the response from Mautic, and I'm getting a redirect to the form submitted message and an
HTTP code 302
//collect contact details
$payer_email = $_POST['payer_email'];
$given_name = $_POST['first_name'];
$surname = $_POST['last_name'];
$phone = $_POST['contact_phone'];
//build array and forward to mautic
$_REQUEST = array('Given name' => $given_name, 'Surname' => $surname, 'Email' => $payer_email, 'Phone' => $phone);
[Email] => email@example.com
[Given name] => John
[Surname] => Smith
My guess is that you try to send the field labels, but Mautic needs the field aliases. Try something like this:
pushMauticForm( array( 'payer_email' => $_POST['payer_email'], 'given_name' => $_POST['first_name'], 'surname' => $_POST['last_name'], 'phone' => $_POST['contact_phone'], ), 4 );
Double check the real aliases. The best way to do that is probably when you click in the Form detail page the Manual Copy button where you can see the generated HTML of the form. The aliases are there in the
<input name="mauticform[>>alias_is_here<<]"/> tags.