resolveCheckoutBaseUrl function

String resolveCheckoutBaseUrl({
  1. required String apiKey,
})

Resolves the Crossmint hosted-page base URL from the apiKey.

The environment is derived from the API key prefix (e.g. ck_staging_... → staging).

Implementation

String resolveCheckoutBaseUrl({required String apiKey}) {
  final env = crossmintEnvironmentFromApiKey(apiKey);
  return switch (env) {
    CrossmintEnvironment.staging ||
    CrossmintEnvironment.development => 'https://staging.crossmint.com',
    CrossmintEnvironment.production => 'https://www.crossmint.com',
  };
}