Introduction
The SquareSpace docs are not particularly comprehensive, but usually there is an HTTP trigger (sometimes known as a callback) that gets called at certain event points (e.g. product purchase). This is hinted at here:
Using the data we provide access to through our API, you can:
- Connect to a third-party fulfillment or shipping application
You will need to look in your SquareSpace control panel to see if any such thing exists. If it does, you can get SquareSpace to notify you when purchase events occur. Services like PayPal do this.
Design suggestions
If it does not, you could instead operate your code on a scheduler, and periodically check for new orders, using the Orders API. Essentially you need to sync the information in the SquareSpace database with a local database, so you can then push that to MailChimp. Since it is not important to get the information into MailChimp quickly, you could do this every 15 minutes or so.
For customer privacy, I suggest you only sync the bare minimum information, such as order number, product code, first name and email address. If you are not familiar with API programming, and suffer a security breach as a result, then your customers will rightly not be happy with you - so be careful, and get your work security-checked if you can. I would also suggest that you delete your sync information when it is successfully pushed to MailChimp.
To sync, the only information you need to permanently store is the "last updated time". When you then do the next sync, you can ignore any orders older than that, since you will already have pushed them.
You will need to check for MailChimp push failures though, e.g. data validation problems. That data will still need to be stored in your intermediate server so you can manually repair the data, which should sync on the next push.
API calls
To make an API call, you can use PHP's curl module. There is an example here and many more here. I recommend trying this on your development machine to see if you can make a successful orders request to SquareSpace.