setIPAddress in eTapestry

Using setIPAddress method for IP fraud check with eTapestry.

Code |

January 16, 2020

For any of the poor souls experiencing lack of documentation with using setIPAddress, there's few things that you should consider:

  1. Need to use error catching function if you want to check if there is an error.
  2. Need to use array("IP Address") as a parameter.

The code is as follows:

$nsc->call("setIPAddress", array($_SERVER['REMOTE_ADDR']));

if($nsc->fault || $nsc->getError())
{
    $resp_obj['accountRef'] = $accountReference;
    $resp_obj['error'] = checkStatus($nsc);
    stopEtapestrySession($nsc);
    return $this->asJson($resp_obj);
}

$transResponse = $nsc->call("processTransaction", array($transactionRequest));

The $_SERVER['REMOTE_ADDR'] gives client's IP address. Also, right after the setIPAddress and error handling code, we run the transaction code.

Copyright © 2020 Will Kim

Invely's