--- title: "Step 2: Initialize Flex Pay Agent Connect" slug: "step-2-initialize-uplift-agent-connect" updated: 2025-04-28T19:43:47Z published: 2025-04-28T19:43:47Z canonical: "developer.upgrade.com/step-2-initialize-uplift-agent-connect" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.upgrade.com/llms.txt > Use this file to discover all available pages before exploring further. # Step 2: Initialize Flex Pay Agent Connect ### Integration Details #### A) Configuring Flex Pay Agent Initialization Initializing **Flex Pay Agent** allows you to define the locale (geography and language), currency, security and functional configurations using `window.Uplift.Agent.init(initConfig)`. This method takes one parameter in the form of key-value pairs. Define an `initAgentPayMonthly` method as shown below, substituting they keys listed in the **REPLACE** comment as per requirements. ``` function initAgentPayMonthly() { window.Uplift.Agent.init({ /* REPLACE: id , agencyId, email, firstName, familyName and phoneNumber values should be replaced */ agent: { id: "identifier", agencyId: "agency-identifier", email: "arthur@uplift.com", firstName: "Arthur", familyName: "Davis", phoneNumber: "0000000000" }, // REPLACE: locale and currency values should be replaced locale: "en-US", // "en-CA", "fr-CA" currency: "USD", // "CAD" onChange: myOnChangeCallback, payMonthlyContainer: "#up-agent-pay-monthly-container", checkout: true }); } ``` 📘 Detailed information about the key configurations can be found [here](https://docs.uplift.com/docs/uplift-initialization-key-configurations#uplift-agent-connect). #### B) Execute Integration Logic The Flex Pay library will automatically execute the integration logic defined within the method `window.upReady` when the Agent Library (up.js) is loaded in the browser. This is where we will include a call to our `initAgentPayMonthly` method defined above. Note you only have to define the `window.upReady` function but **never** execute (call) it yourself. ``` window.upReady = function() { initAgentPayMonthly(); //Initialize Uplift.Agent } ``` ⚠️ Note that we will add more elements to this function in the following steps and additional components to enable this integration (and if you test at this point, it may result in an error due to missing components mentioned in following steps).