consturl = buildAuthorizeUrl({ clientId:process.env.SQUARE_APP_ID!, environment:'production', scopes: ['ORDERS_READ', 'MERCHANT_PROFILE_READ'], state:csrfToken, // random per attempt; store it server side to check in the callback }); // redirect the seller to `url`
Build the URL that sends a seller to Square to authorize your application (OAuth code flow). Pure function — no network call.