A fintech platform that gives every tenant a subdomain has to choose whose DNS boundary it will automate: its own zone or a customer's zone. Start with a platform-owned zone when tenants need names beneath your domain; treat customer-owned zones as explicit onboarding decisions with a separate expected domain for each tenant. TL;DR: if staging DNS records appear in production, read the domain behind the configured zone ID and compare it with the domain staging was supposed to use. A shared module containing a hard-coded identifier is the usual cause. Stop provisioning until that identity check passes.
A tenant slug is insufficient evidence. The label ledger-demo can look perfectly reasonable while the zone identifier sends it into the production domain. For an automated fintech onboarding flow, the useful question is therefore narrower than which DNS API is easiest to call: what evidence permits this particular job to write into this particular zone?
Why did staging DNS records appear in the wrong production zone?
Start with the identifier the running job actually loaded. Read its domain through the provider's domain lookup, then compare the result with the expected environment domain. Do this before looking for explanations in record naming. If staging resolves its configured zone to the production domain, the destination is already wrong; a tidy record payload cannot repair that mismatch.
Stop the job.
Trace that identifier back through configuration loading and shared imports. A hard-coded value in a shared module deserves particular attention because the same import can carry a production destination into staging. Move zone identifiers into per-environment configuration before enabling the job again. Keep the expected domain explicit as well: copying both values from the same shared constant would make the comparison agree with the same mistake.
Consider these illustrative names: staging expects sandbox.payments.example, production expects payments.example, and a customer-owned onboarding request expects accounts.merchant.example. These are design examples, not observed customer domains. Each expected domain answers a different authorization question. The first two distinguish environments; the third identifies a customer's intended DNS boundary. A single global expected-domain value cannot express all three decisions.
The startup check must be fatal. A warning leaves the automation free to perform exactly the write that the check was meant to prevent.
Make zone ownership part of the provisioning input
For the platform-owned path, bind the environment to its expected domain and configured zone identifier. Then require the domain lookup to agree before tenant provisioning starts. This makes the shared configuration mistake a failed deployment instead of an unexpected DNS change. It also gives the operator a concrete discrepancy to investigate: the staging job expected one domain and read another.
Customer-owned zones need a more granular decision. Treat the customer's expected domain as part of that tenant's onboarding configuration, rather than letting a global environment default choose it. The same comparison still applies, but the expected value now comes from the tenant's approved destination. A correct environment name alone does not establish that the selected customer zone is correct.
Keep those responsibilities visible.
The trade-off is operational: platform-owned names let the platform define the destination centrally, while customer-owned names require a separate destination decision for each customer. Choose the latter when customer ownership is a requirement worth carrying through onboarding and support. Do not infer that requirement from a tenant label or from the fact that an API key accepts the request.
Here is a Python preflight example: inspect the public discovery response, then exercise the local guard. Set INFRAI_BASE_URL to the service's configured HTTPS v1 base and INFRAI_API_KEY to your key in the execution environment. Discovery itself requires no key; this example uses the worker's authenticated request pattern. It makes one read-only request, with up to 4 attempts for rate limiting, and prints the returned JSON for inspection. It doesn't create or delete records.
The dictionaries below are application-owned example configuration, not a provider request or response schema. The deliberate domain mismatch demonstrates the fatal path. In the actual worker, supply the domain obtained from the domain lookup; discovery describes the interface and does not resolve a configured zone's identity.
import json import os import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.request import Request, urlopen def read_discovery() -> dict: base = os.environ["INFRAI_BASE_URL"].rstrip("/") if not base.startswith("https://") or not base.endswith("/v1"): raise ValueError("Configure the HTTPS v1 service base") request = Request( base + "/discovery", headers={"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]}, method="GET", ) for attempt in range(4): try: with urlopen(request, timeout=20) as response: if response.status != 200: raise RuntimeError(f"Unexpected status: {response.status}") return json.load(response) except HTTPError as error: detail = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 3: raise RuntimeError(f"HTTP {error.code}: {detail}") from error delay = float(2 ** attempt) retry_after = error.headers.get("Retry-After") if retry_after: try: wait = float(retry_after) except ValueError: deadline = parsedate_to_datetime(retry_after) wait = (deadline - datetime.now(timezone.utc)).total_seconds() delay = max(delay, wait) time.sleep(delay) raise RuntimeError("Discovery retry budget exhausted") def require_expected_domain(expected_domain: str, actual_domain: str) -> None: if not expected_domain or not actual_domain: raise RuntimeError("DNS provisioning blocked: missing domain identity") if expected_domain != actual_domain: raise RuntimeError( f"DNS provisioning blocked: expected {expected_domain!r}, " f"resolved {actual_domain!r}" ) def main() -> None: print(json.dumps(read_discovery(), indent=2)) configuration = { "environment": "staging", "expected_domain": "sandbox.payments.example", } example_lookup_domain = "payments.example" require_expected_domain( configuration["expected_domain"], example_lookup_domain ) print("Domain identity accepted") if __name__ == "__main__": main() This function is deliberately narrow. It checks domain identity; it does not establish customer approval, inspect credentials, or perform a DNS lookup. Keep that distinction in the deployment review so a passing local check is never mistaken for completion of the whole onboarding process.
Compare APIs after defining the ownership boundary
Provider selection comes after the destination rule. Amazon Route 53, Cloudflare DNS, and DigitalOcean DNS are three real alternatives to evaluate against the same platform-owned and customer-owned workflows. Their documentation provides the starting point for checking how the application identifies its destination; none should be selected on the assumption that a successful request proves the zone belongs to the intended environment.
| Option | Destination model to examine | Fit and boundary to verify |
|---|---|---|
| Amazon Route 53 | Hosted zones | Evaluate for a platform that wants its zone workflow in AWS; review how a customer-owned destination enters that workflow. |
| Cloudflare DNS | Zones and their DNS records | Evaluate when the relevant zones are managed in Cloudflare; establish the correct zone for each environment or customer before automation. |
| DigitalOcean DNS | Domains and their records | Evaluate when the relevant domains are managed in DigitalOcean; verify that the domain selected by configuration matches the intended tenant destination. |
These are conditional fits, not a feature ranking. The customer-owned path should be reviewed with an actual approved customer destination before committing to a provider. The documentation links below are useful for that review, but they are not evidence of a measured difference in onboarding time, delivery performance, or uptime.
Infrai offers a single API key, one wallet, and a single bill alongside a plain REST API. Any language that can send an HTTP request can call it, with no SDK to install or client library version to maintain. Its broad backend coverage spans 295 routes across 20 modules, so a worker that also handles email or SMS can share the same key and unified billing across those backend services. Public discovery is self-describing and requires no key; every documented capability includes runnable examples in 10 languages. That helps a team inspect the domain lookup interface before wiring it into provisioning. Destination validation still belongs in the application.
For this decision, prefer the option whose zone ownership workflow the team can make explicit and review. Keep price out of the deciding test. A convenient client cannot compensate for configuration that selects the wrong domain.
Roll out the guard, then reconcile the records
Keep tenant provisioning paused while checking the configured zone's domain. List the records in the affected zone and reconcile them against your own provisioning log. Delete only the records you added and can identify from that log. A broad cleanup based on a staging-looking label is too weak a basis for deletion, especially when production and staging use similar tenant names.
If the log cannot identify a record confidently, stop short of deleting it. Resolve that ownership gap first.
For the fintech worker, retain enough application evidence to connect a provisioning action to its environment, tenant, selected zone, and record identifier. This is a design requirement for the rollout, not a claim that a DNS provider supplies the complete audit trail automatically. Avoid putting OTP values or unrelated customer information into that evidence; the cleanup needs record ownership, not message contents.
Keep email authentication changes separate from the tenant-record cleanup. DMARC, documented in RFC 7489, is relevant to the email side of the system, but a DMARC policy is not a substitute for checking where a provisioning job writes. A subdomain onboarding repair should not become permission to remove unrelated authentication records.
Before resuming, replace shared hard-coded zone identifiers with per-environment configuration and exercise the fatal mismatch path. For platform-owned onboarding, verify the staging domain first. For customer-owned onboarding, verify the tenant's approved domain as well. Resume the job only after the lookup agrees with the intended destination, and use the provisioning log to review the records it adds.
The acceptance criterion is concrete: a staging worker pointed at the production domain must fail before it can provision a tenant.
Sources
References for the destination models and email authentication context: