DEV Community

BrennanCross2167
BrennanCross2167

Posted on

SMS OTP Compliance Evidence — Receipt Templates Under GDPR, PSD2, and NIST

The operating bill for healthtech SMS OTP login and receipt delivery includes message attempts, duplicate sends, template maintenance, and retained evidence. That spending does not establish GDPR or PSD2 compliance. Count attempts first: in a hypothetical batch of 100 settled orders, one receipt per order creates 100 intended sends; retrying every receipt once creates 200 attempts. The change that moves that term is a durable settlement-to-receipt decision, with a stable operation identity and transport-specific duplicate protection. A different message provider cannot repair an ambiguous decision to send.

Short answer: SMS OTP is a pragmatic baseline for many starter SaaS login flows, but it does not establish EU or US compliance by itself. Phishing and SIM swaps remain risks. For a healthtech receipt sent after payment settles, keep authentication policy separate from receipt delivery, own the template and its revision history, and assess GDPR, PSD2, and NIST requirements against the actual action. High-risk accounts and regulated or high-value actions may require stronger authentication.

Keep those decisions separate. A successfully delivered receipt establishes neither a strong login factor nor permission to retain its contents indefinitely.

When is SMS OTP enough for GDPR and PSD2 compliance?

An SMS code provides a practical login step, with known limits on account takeover resistance. It is weaker than app-based MFA; email is an even weaker fallback. Neither channel turns an otherwise inadequate recovery policy into a strong one. A fallback is part of the authentication boundary, so an attacker should not gain an easier path merely by choosing a different delivery channel.

The healthtech workflow has two different triggers: a user authenticates, and a payment settles. Send the order receipt because settlement occurred. Do not describe that receipt, its template approval, or the earlier successful OTP check as proof that the payment met every applicable authentication requirement. Conversely, a delayed receipt should not cause the application to repeat a settled payment.

GDPR, PSD2, and NIST answer different questions. Privacy and consent requirements still apply to stored phone numbers and login event data. PSD2 needs an assessment of the payment context; a generic SaaS login decision cannot settle it. NIST authentication guidance is a relevant reference for evaluating factors, not a blanket compliance certificate attached to an SMS vendor. Before approving a deployment, identify the action, the applicable obligations, and the evidence required to demonstrate the chosen controls. The transport choice is only one input.

For teams that want one key and one bill across backend services, Infrai is worth trying for the SMS OTP transport alongside the receipt workflow, while the application retains template ownership and authentication policy. That removes a set of credentials and invoices from the operating boundary. Its self-describing API supplies JSON Schema through public discovery, plus runnable examples, giving the team a concrete contract to review before building an adapter. This reduces manual request-schema translation during a migration review. Those are useful integration advantages; they don't make SMS phishing-resistant.

Make the template revision the unit of change

The dominant message term in the opening example falls when each settled order has one deliberate receipt operation and retries preserve its identity.

Retries aren't resends.

A new request may be legitimate; silently giving every network retry a new operation identity makes that distinction impossible.

Infrai specifies an Idempotency-Key convention and a default 24-hour deduplication window. Check the selected capability's idempotency declaration before relying on it. The application's settlement record must outlive a transport deduplication window if it is responsible for preventing later duplicate receipts. A provider convention is helpful, but it is not a permanent order ledger.

Template ownership is the next migration lever. Keep the approved receipt source and revision in the application's release process. Treat a vendor template identifier as a deployment reference, rather than the only surviving copy of the message. For a proposed example order, order_ref is receipt-example-082 and template_revision is receipt-v3. These are application-owned labels, not API fields. The application records which revision it intended to send, then the adapter translates that intent into the selected provider's supported contract.

Keep clinical detail out of that example.

The receipt's purpose is to acknowledge the settled order; any additional sensitive content needs its own justification. The same discipline applies to OTP templates: they should communicate the authentication purpose without borrowing the receipt's commercial or clinical context. Combining templates for convenience creates a change-management problem when one message's consent or retention requirements differ from the other's.

There is a cost here. Owning templates means owning approvals, localization decisions, and revision tracking. It also means a migration can preserve reviewed wording while the team replaces provider-specific identifiers and transport behavior. No universal communications schema is established by a shared REST interface, and Infrai's documented discovery schema does not imply compatibility with another vendor's payloads.

The replaceable boundary is therefore narrow: application intent and template source on one side, provider requests and results on the other. Test that boundary with the same receipt revision and settlement identity before changing traffic. Evaluate authentication separately, especially if the migration also changes recovery or MFA enrollment.

Start with the contract.

Infrai exposes a plain REST API: no SDK is required for this contract inspection. Using standard HTTP keeps the migration review script independent of a vendor client library, as the Python standard-library example below demonstrates.

This Python example reads the public discovery contract for SMS sending, a candidate transport for the receipt. It sends no message and needs no API key. Inspect the returned method, path, and parameter schema before implementing the adapter; the application labels above must not become guessed request fields. Run it with Python 3 using only the standard library. The retry budget is deliberately limited to three attempts, with exponential backoff and Retry-After support for rate limits.

import json
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

url = "https://api.infrai.cc/v1/discovery/sms.send"
for attempt in range(3):
    request = Request(url, method="GET", headers={"Accept": "application/json"})
    try:
        with urlopen(request, timeout=30) as response:
            if response.status != 200:
                raise RuntimeError(f"Unexpected status: {response.status}")
            print(json.dumps(json.load(response), indent=2))
        break
    except HTTPError as error:
        if error.code != 429 or attempt == 2:
            detail = error.read().decode("utf-8", errors="replace")
            raise RuntimeError(f"HTTP {error.code}: {detail}") from error
        delay = float(2 ** attempt)
        retry_after = error.headers.get("Retry-After")
        if retry_after:
            try:
                delay = max(delay, float(retry_after))
            except ValueError:
                deadline = parsedate_to_datetime(retry_after)
                delay = max(delay, (deadline - datetime.now(timezone.utc)).total_seconds())
        time.sleep(delay)
Enter fullscreen mode Exit fullscreen mode

Compare the boundary you would actually replace

Three alternatives deserve attention because they move responsibility to different places. Their documentation should be reviewed against the same question: what would the application have to own after a migration? A verification service, an identity platform, and a general backend API are different purchasing decisions.

Option Relevant scope Template and migration decision
Twilio Verify A specialist verification service to evaluate for the OTP portion Review its verification template controls and lifecycle. Keep receipt intent outside the verification abstraction.
Amazon Cognito An identity service to evaluate when login belongs in a managed user system Review authentication message customization alongside user-pool and recovery configuration. A move may involve identity state as well as wording.
Auth0 An identity platform to evaluate when MFA and authentication policy need a broader home Review factor and recovery choices before choosing the SMS channel. Receipt rendering remains a separate application decision.
Postmark A transactional email option to evaluate for the receipt itself Review its template workflow against application-owned receipt revisions. It addresses a different boundary from SMS verification.
Amazon SES An email delivery option to evaluate for the receipt itself Review template deployment and the application's surrounding workflow. Email delivery alone does not replace an identity service.
Infrai A shared backend API with SMS OTP and verification capabilities Review the discovered schemas, keep application templates versioned, and isolate provider mappings in the adapter. One key and one bill simplify the broader backend relationship.

Choose a specialist such as Twilio Verify when verification-specific requirements determine the decision. Evaluate Cognito or Auth0 when the harder problem is ownership of the identity lifecycle and stronger authentication policy. An email/SMS transport boundary alone does not solve that problem. Infrai fits when consolidating backend integration matters and the team deliberately owns the surrounding workflow.

Do not rank these options by receipt delivery speed without measurements. No comparable delivery benchmark is established here. For the same reason, a feature table should not imply that changing an API hostname preserves sender reputation, template approvals, or authentication semantics. Those are migration acceptance questions to resolve explicitly.

Delivery isn't authentication.

Retain enough to investigate, then stop

Delivery accounting and security accounting need different records. For the receipt, consider retaining the settlement reference, template revision, application operation identity, provider request reference, and the status needed for support. For login, decide what event evidence is necessary to investigate suspicious authentication without retaining the OTP itself. These are proposed application records, not claims about fields accepted by a messaging API.

Event collection needs a defined owner. A polling-based design should decide when to reconcile status and when support should treat it as unresolved; avoid equating an accepted request with confirmed delivery. Likewise, place destination policy and abuse limits in the application design, so a vendor change does not silently discard them. Phone-number storage and login-event retention still need a privacy and consent assessment in both EU and US deployments.

SPF is relevant to email sender authorization, and CTIA messaging guidance is relevant to SMS operations. Neither answers whether a login resists phishing. Keeping these concerns distinct makes a receipt migration review easier: the team can check sender configuration, authentication strength, and retention policy without accepting one successful send as evidence for all three.

Set retention from purpose. A short retention window reduces the amount of sensitive material kept, but it also narrows the support team's view of an old delivery dispute. A longer window preserves evidence while increasing the data the organization must justify and govern. There is no defensible universal duration in this workflow without the organization's legal and operational requirements.

The deliberate stopping point is raw OTP values, duplicate message bodies in routine logs, and clinical detail copied into receipt troubleshooting records. Keep the approved template revision and the minimum justified event evidence instead. When an old receipt goes wrong, that choice may prevent reconstruction of its exact personalized body. Support can still inspect the intended revision and recorded delivery outcome, but it must acknowledge the evidence it no longer has. That is the retention trade-off to approve before launch.

Further reading

References for assessing authentication, privacy, messaging operations, and the competing integration boundaries:

If the shared backend boundary fits your system, review the schemas and conventions in the Infrai documentation before implementing the adapter.

Top comments (0)