getBaseURL static method

String getBaseURL(
  1. PayEngineConfig config
)

Returns the base URL for the PayEngine API based on the provided config. The config parameter is an instance of the PayEngineConfig class.

Implementation

static String getBaseURL(PayEngineConfig config) {
  var baseUrl = config.publicKey.contains("_prod_")
      ? 'https://console.payengine.co'
      : 'https://console.payengine.dev';
  if (config.scriptURL != null) {
    final uri = Uri.parse(config.scriptURL!);
    baseUrl = uri.origin;
  }

  return baseUrl;
}