## Including and initializing Affirm.js

Include the `Affirm.js` script to the head of your global page template.

In order to create an instance of Affirm, you will need to pass your public API key and the environment you are pointing too. The Affirm object is your entry point to the rest of the Affirm.js SDK.

Your Affirm public API key is required when calling this function, as it identifies your website to Affirm.

When you’re ready to accept live transactions, replace the sandbox key with your live key in production as well as the environment URL.

Learn more about how API keys work in sandbox mode and production mode.

**Method arguments**

Column Title
Column Title
Column Title
**public_api_key** <span style="color:red">required</span>_string_Your public API key.
**script** <span style="color:red">required</span>_string_Sandbox: <https://cdn1-sandbox.affirm.com/js/v2/affirm.js> Production: <https://cdn1.affirm.com/js/v2/affirm.js>