I am trying to Opt in for a user based on email address, but getting error.
global $infusionsoft;
$infusionsoft->refreshAccessToken();
//opt in user
$billing = $order->get_address( $type = 'billing' );
$email = $billing['email'];
error_log('email is '.$email);
$optIn = $infusionsoft->emails('optIn', $email, 'I have Permission box was checked');
Then it’s not api related. Either syntax or server. So place die(); after each line, one at a time, and see how far down you can go before it crashes. Then focus on the structure or function of that specific line. Also, ensure that error_reporting is set to E_ALL
the example code what is displayed in the library did not work for me.
After debugging I found this call was working for me:
$optin = $infusionsoft->APIEmail(‘optIn’, $email, ‘I have Permission box was checked’);
var_dump($optin);
If the email is already opted in then the return value will be false. You will only get a true when an email that is currently unmarketable will return true and then will return false every time there after.
You could submit a request for that doc to be updated. The methods you have indicated you used in the first place, they all work for me. You shouldn’t need to get the status. blindly optin the email. What changes for you if they’re opted out already or already opted in, that you need to know that this particular time the call returned true? The results are still the same…?