Go to your account on Shareasale, follow:
API Reporting and set IP of your server, which you use for the site. You can know correct IP of the server from your hosting provider.
Secret Key and save settings
You can find Affiliate ID in the top left corner of your account, near your login name.
I am getting this error message: Error: Invalid Account - Error Code 4002 - xx.xx.xx.xx
This means your IP address isn’t registered under
API Reporting your Shareasale dashboard. Be sure to register the IP you’re sending API requests from.