Project Type: Tools

Webhook

Overview Handles incoming webhooks for provisioning (Sweatpants) and Stripe events via the stripe-integration plugin. Routes POST /spawn/v1/webhook/provisioner Processes Sweatpants callbacks. Headers: X-Spawn-Internal-Key (string) Authorization: Bearer <token> (Sweatpants token) register_rest_route( 'spawn/v1',...

Google OAuth

Overview Implements Google OAuth login and account creation for Spawn customers. Constants GOOGLE_AUTH_URL GOOGLE_TOKEN_URL GOOGLE_USERINFO_URL Configuration spawn_google_client_id spawn_google_client_secret Methods is_configured(): bool returns whether credentials are set. get_auth_url(): string builds the...

Name.com

Overview Wraps Name.com API operations for domain availability, renewal, and pricing. Configuration spawn_namecom_username spawn_namecom_token spawn_namecom_test_mode (boolean) Methods check_availability(string $domain): array|WP_Error search(string $keyword, array $tlds = [ 'com', 'net', 'org' ]):...

Payment Helpers

Overview Provides Spawn-specific wrappers around Stripe Integration for credits, auto-refill, and subscription upgrades. Methods create_credit_checkout_session( array $params ): array|WP_Error handle_credit_purchase( array $session ): bool|WP_Error get_default_payment_method( string $customer_id ): string|WP_Error charge_for_auto_refill(...

Provisioner

Overview Triggers VPS provisioning jobs in Sweatpants and processes completion callbacks. Configuration spawn_sweatpants_url (default: http://127.0.0.1:8420) spawn_sweatpants_token Methods trigger(array $params): array|WP_Error submits a vps-provisioner job. get_status(string $job_id): array|WP_Error retrieves job status....

REST API

Overview Registers spawn/v1 REST endpoints for checkout, auth, customer accounts, credits, chat, and domain settings. Namespace spawn/v1 Constants NAMESPACE (spawn/v1) EU_COUNTRIES (array of ISO country codes) ANTHROPIC_PRICING (per MTok pricing...

User Role

Overview Defines the spawn_customer role and hides wp-admin for customers. Role spawn_customer with capabilities: read spawn_set_domain_auto_renew Methods init(): void registers filters/actions to hide admin bar and redirect. register_role(): void adds...

Autoload

Overview Registers a PSR-style autoloader for Spawn classes and abilities. Behavior Loads classes in the Spawn namespace. Routes SpawnAbilities* to inc/abilities/class-*.php. Routes other classes to inc/class-*.php. Includes a class map...

Blocks

Overview Registers Spawn Gutenberg blocks from build/blocks or blocks directories. Blocks domain-search tier-select checkout login dashboard account chat Methods init(): void register_blocks(): void Example add_action( 'init', [ SpawnBlocks::class, 'register_blocks' ]...

Cleanup

Overview Deletes VPS and DNS resources after cancellation grace period and sends notification emails. Constants GRACE_PERIOD_DAYS (7) Hooks spawn_process_deletions (hourly) Methods init(): void schedules hourly deletion job. process_pending_deletions(): void deletes...

← Back to Chubes.net