YOUR PDF OR ILLUSTRATOR FILE must have five layers. Here is an article which explains how to do this.
It is critical that your foil layer is overprinted before you export to PDF. Here is an article on how to do this.
The digital foil is on ONE SIDE ONLY.