Accumulus Settings

> Allow automatic creation and updating of users in wordpress via Accumulus webhooks. NOTE: You also need to configure webhooks in Accumulus for customer create and update events.
" />
" />
" />
" />
" />
" />
$environment_prefix, "clientId" => $client_id, "clientSecret" => $client_secret, "redirectUri" => admin_url("options-general.php?page=accumulus"), ]); // start the OAuth workflow if (!isset($_GET["code"]) && $_SERVER["REQUEST_METHOD"] === "POST") { // If we don't have an authorization code, then get one $authUrl = $provider->getAuthorizationUrl(); $_SESSION["oauth2state"] = $provider->getState(); $_SESSION["oauth2environmentprefix"] = $environment_prefix; header("Location: ".$authUrl); exit; } } } // handle the response from the identity server function accumulus_handle_oauth_response() { if ($_GET["page"] === "accumulus" && !empty($_GET["state"]) && ($_GET["state"] === $_SESSION["oauth2state"])) { // Get an access token (using the authorization code grant) $environment_prefix = $_SESSION["oauth2environmentprefix"]; $client_id = get_option('accumulus_'.$environment_prefix.'client_id'); $client_secret = get_option('accumulus_'.$environment_prefix.'client_secret'); if ($client_id && $client_secret) { $provider = new League\OAuth2\Client\Provider\Accumulus([ "environmentPrefix" => $environment_prefix, "clientId" => $client_id, "clientSecret" => $client_secret, "redirectUri" => admin_url("options-general.php?page=accumulus") ]); } $token = $provider->getAccessToken("authorization_code", [ "code" => $_GET["code"] ]); // Save the token for future use update_option('accumulus_'.$environment_prefix.'token', $token, TRUE ); exit(wp_redirect(admin_url('options-general.php?page=accumulus'))); } } ?>