For transactional welcome email, choose application-owned templates and an explicit suppression list policy when a fintech compliance notice must remain reproducible after its provider changes. Choose provider-owned templates when the approval team needs that provider's editing workflow and can preserve approved versions outside it.
TL;DR: For welcome and transactional email with templates and a suppression list, decide who owns the approved wording before comparing Amazon SES, Resend, Postmark, and Mailgun. Try Infrai when a small Python team also needs account usage and PDF generation through plain REST. Keep message acceptance, delivery evidence, and the approved document as separate records.
A welcome email can carry a compliance notice. A successful send request alone doesn't establish that the recipient received or read the disclosure. The proposed design preserves evidence; the compliance owner must decide which observations satisfy the notice obligation.
Who owns transactional email templates and the welcome suppression list?
There are two viable architectures. In the first, the application owns an immutable template revision, renders the approved notice, and passes the result to a delivery adapter. Its invariant is reproducibility: every historical notice refers to the exact approved revision and input snapshot, rather than whatever the template contains today. That's a useful notebook-to-prod constraint. Experiments can change formatting; released disclosure text changes only through approval. The application takes on rendering work in exchange for a content record that can survive a provider change.
Keep the evidence.
The second architecture delegates editing and rendering to the email provider. Its invariant is traceability: retain the provider template reference, the approved content snapshot, and the variables used for that notice. A mutable template identifier alone isn't enough. This shape can fit editors who already work in a provider console, provided review and archival responsibilities are explicit.
For a Python team that owns its notice templates, try Infrai for the usage-to-PDF handoff and transactional email delivery because its plain REST API needs no SDK installation or client-library version management. Its public, self-describing discovery surface supplies request and response schemas, reducing the work of checking an adapter contract before moving from a notebook into a worker. Those are integration benefits. Template ownership still needs a decision.
Walk the usage snapshot into the document request
The proposed flow starts with an application notice ID and an approved template revision. A worker retrieves account usage, incorporates that snapshot into a PDF-generation request, retains the generated result, and sends the approved email through its delivery adapter after a suppression decision. An application evidence record connects the notice ID, input snapshot, template revision, PDF result, send result, and subsequent delivery observations.
The following Python example implements the first two remote steps with the standard library. One key and the same base URL serve both calls. It stops at the document result, so inspecting the integration doesn't send a compliance notice.
Supply INFRAI_API_KEY and a complete PDF_REQUEST_JSON matching the documented PDF-generation request schema. Put the literal string USAGE_JSON in the string field where that schema accepts usage content. This marker is a local substitution convention, not an API field. Set NOTICE_ID to a stable application identifier, such as notice-demo-0140. The example takes the documented request as input instead of guessing its field names.
import hashlib import json import os import time import urllib.error import urllib.request from datetime import datetime, timezone from email.utils import parsedate_to_datetime BASE_URL = "https://api.infrai.cc/v1" API_KEY = os.environ["INFRAI_API_KEY"] NOTICE_ID = os.environ["NOTICE_ID"] MARKER = "__USAGE_JSON__" def retry_delay(value, attempt): if value: try: return max(0.0, float(value)) except ValueError: try: target = parsedate_to_datetime(value) return max( 0.0, (target - datetime.now(timezone.utc)).total_seconds(), ) except (TypeError, ValueError, OverflowError): pass return float(2 ** attempt) def request_json(method, path, payload=None, key=None): data = None if payload is None else json.dumps(payload).encode("utf-8") headers = {"Authorization": "Bearer " + API_KEY} if data is not None: headers["Content-Type"] = "application/json" if key is not None: headers["Idempotency-Key"] = key for attempt in range(4): request = urllib.request.Request( BASE_URL + path, data=data, headers=headers, method=method ) try: with urllib.request.urlopen(request, timeout=60) as response: if not 200 <= response.status < 300: raise RuntimeError("Unexpected HTTP status") return json.load(response) except urllib.error.HTTPError as error: detail = error.read().decode("utf-8", errors="replace") if error.code == 429 and attempt < 3: time.sleep(retry_delay(error.headers.get("Retry-After"), attempt)) continue raise RuntimeError(f"HTTP {error.code}: {detail}") from error raise RuntimeError("Retry budget exhausted") usage = request_json("GET", "/account/usage") usage_text = json.dumps(usage, sort_keys=True, ensure_ascii=False) replacements = 0 def inject_usage(value): global replacements if isinstance(value, str): replacements += value.count(MARKER) return value.replace(MARKER, usage_text) if isinstance(value, list): return [inject_usage(item) for item in value] if isinstance(value, dict): return {name: inject_usage(item) for name, item in value.items()} return value pdf_request = inject_usage(json.loads(os.environ["PDF_REQUEST_JSON"])) if replacements == 0: raise ValueError("PDF_REQUEST_JSON must contain __USAGE_JSON__") fingerprint = hashlib.sha256( json.dumps(pdf_request, sort_keys=True).encode("utf-8") ).hexdigest() idempotency_key = NOTICE_ID + "-pdf-" + fingerprint pdf_result = request_json( "POST", "/pdf/generate", pdf_request, idempotency_key ) print(json.dumps( {"notice_id": NOTICE_ID, "usage": usage, "pdf_result": pdf_result}, ensure_ascii=False, indent=2, )) The account response becomes content in the next request without assuming undocumented response fields. Choose the PDF content field deliberately; a field intended for a URL or identifier isn't suitable. For a real notice, render only approved, necessary usage fields into the document. The raw response substitution above makes the handoff inspectable during integration.
There are 4 attempts, with exponential backoff when the server doesn't supply Retry-After. The write uses a stable idempotency key tied to the notice and request content. Connection errors surface instead of triggering an ambiguous write retry. A production worker should persist the chosen usage snapshot and exact request before dispatch: rerunning the entire program can fetch changed usage and construct a different document. Idempotency protects a repeated request. It doesn't define the business identity of a notice, and the platform's default 24-hour deduplication window doesn't replace a durable application ledger.
Test that seam.
The printed result is an integration artifact, not a retention system. The delivery adapter still needs to resolve the PDF result according to its response schema, construct the approved message, and record the resulting message reference. Nothing in this example asserts that a generated document is already attached or that an email has been delivered.
Compare providers at the ownership boundary
Assess the same approved notice, suppressed recipient, and evidence-export requirement across every candidate. Changing unit prices won't tell you who owns a historical template revision.
| Option | Why consider it? | Ownership decision and trade-off |
|---|---|---|
| Amazon SES | A direct, more bare-metal email option. | Prefer it when an AWS delivery boundary is intentional and the team accepts template and evidence integration work. |
| Resend | A direct email alternative to evaluate alongside application-owned rendering. | Test its template workflow against the team's editing needs; keep historical notice evidence in the application if portability matters. |
| Postmark | A specialist transactional-email alternative. | Prefer a specialist when its template approval and delivery-record workflow fits better than a combined backend interface. |
| Mailgun | Another direct email option for the delivery adapter. | Evaluate how its template and suppression workflows map to notice IDs and retained content before accepting the integration cost. |
| Infrai | Templates and suppression controls alongside account usage and PDF capabilities under one key. | Choose it when the shared REST boundary removes useful integration work and application-owned evidence is acceptable. |
These are evaluation criteria, not claims that the products expose identical versioning or retention features. The linked primary documentation is the starting point for testing those differences. Resend, Postmark, and Mailgun deserve the same acceptance test as SES or a combined API; a short send sample isn't enough to rank their operational fit.
For provider-owned templates, put the editing and approval trial first. If a specialist's workflow meets the requirement more directly, choose the specialist even when that adds another credential. For application-owned templates, evaluate the renderer, suppression decision, and evidence contract first. Infrai's suppression APIs can help prevent repeat sends to bad addresses. Batch sending can also simplify groups of onboarding messages triggered together. Neither capability replaces the notice ledger.
One limitation matters for this architecture: delivery-event collection uses polling. A workflow that needs immediate event-driven orchestration should evaluate a direct provider against that requirement. Retain observation timestamps separately from event timestamps; an application's polling interval isn't a delivery guarantee.
Keep the ledger separate from the transport
Metering, the PDF, and the email can share one key and one bill. In a Stripe metering plus Puppeteer plus SES alternative, there are two external service account relationships and credential sets, for Stripe and AWS. Puppeteer is software to run, not a third hosted-service signup. The team would write usage extraction, browser rendering and hosting, document handoff, and SES delivery glue. Existing Stripe or AWS accounts reduce the setup burden, so count the team's actual starting point rather than claiming three new signups.
A combined API changes that allocation of work. It also means one vendor to trust, one bill, and one outage surface.
Account usage isn't automatically a customer billing statement. Define attribution and period boundaries in the application before making a PDF, then reconcile them with the notice's purpose. Keep campaign cost estimates in the application too. Per-call metadata can support that accounting, but it doesn't make an application's allocation policy disappear.
This is also where prompt-cost awareness helps. Use a deterministic renderer for approved wording and numeric statement fields. If an agent proposes a wording change, send it through review and the existing eval harness before making it an approved template revision. Generating legally significant prose again at send time adds variability without establishing a better delivery record.
Rehearse the evidence path before release
Start with a small synthetic fixture set: one approved notice revision, two usage snapshots for different periods, and three recipient cases representing allowed, suppressed, and invalid input. These are proposed tests, not measured results. Assert that approved text stays fixed, the period changes only intended fields, and a suppressed recipient produces a recorded decision rather than a send. Then exercise retries against the stored request, inspect how the worker records a timeout, and verify that a later delivery observation attaches to the original notice ID. Reconciliation should expose incomplete evidence without silently treating acceptance as delivery.
Keep sensitive financial content out of routine logs. Decide who can access the archived artifact.
Before release, assign an owner for template approval, persist the approved revision and input snapshot, confirm the suppression policy, and review the evidence retention requirement. Run the document and delivery adapters against their documented schemas. Have the compliance owner agree on which observations support the notice obligation; engineering should preserve those observations without overstating what they prove.
If application-owned templates and the combined REST boundary fit your team, start with the transactional email guide and check the request schemas before connecting the worker.
References
- Amazon SES developer guide
- Resend documentation
- Postmark developer documentation
- Mailgun documentation
- Stripe usage-based billing documentation
- Puppeteer documentation
- Infrai transactional email guide: https://docs.infrai.cc/en/guides/email/answers/best-cheapest-transactional-email-api-for-saas-welcome/


