Skip to main content

Tagada Rx with the Headless SDK

Running your storefront on your own hosting (Vercel, Netlify, Shopify headless, an AI-generated site)? The Headless SDK ships a first-class tagada.rx module that mirrors the public storefront endpoints — no API key in the browser, ever.
Auth model: there is no key. isRequiredForProduct is public; the case routes prove ownership with the (orderId, checkoutToken) pair your checkout flow already holds. PHI transits to the clinical network and is never persisted by Tagada.
Hosting rule in affiliate (MoR) mode: you build headless on your own stack, but the resulting storefront must be deployed on your Tagada subdomain (your-brand.tgdcare.com) — LegitScript certification is tied to Tagada-hosted domains. Reserve the subdomain in the CRM storefront wizard, then work with your account manager to wire the deploy of your build onto it. Serving the storefront from your own root domain is a direct-mode capability — coming soon.

The calls

1. Is this an Rx product?

2. Check the patient before payment

The clinical network only accepts US patients: an address in one of the 50 states or DC, a US phone number, a 5 digit ZIP, an adult. Check it before taking the payment, so a card is never held for a patient who cannot be treated:

3. Show the network questionnaire, then submit

Run your normal headless checkout (tagada.checkout + tagada.payment). Once the order is paid, render the questionnaire written by the clinical network as is: it includes the questions the clinician needs on the patient profile (height, weight, allergies, medications, conditions, pregnancy). Two helpers make it plug and play:
  • isQuestionActive(question, answers, { state, sexAtBirth }) tells you which questions to show right now (hidden clinician questions never, “Drug Allergies” only after “Yes”, pregnancy only for women, state rules).
  • toIntakeAnswers(questions, answers, context) builds the intakeAnswers to send.
The server enforces these rules on every submit, whatever the integration. A patient or intake that does not meet them fails with 422 and the list of fields to fix; nothing reaches the clinician and the same order can be resubmitted. validateIntake with intakeAnswers returns the same list before you submit. Never replace the network questionnaire with your own quiz: an empty questions list means the product has none.
Submit synchronously after payment, from the browser. Do not stash patient / intakeAnswers in your own database or queue “for later” — that would make you a PHI processor. If the call fails, keep the data in memory and offer a retry button.

4. Poll status on the thank-you page

Poll every ~10 seconds while the tab is open; the statuses come from the processed clinical webhooks, so they’re authoritative.

Before checkout: are Rx payments ready?

payments is 'ready' once the brand’s Rx payment account is live and its payment flow is bound. It is a status, not a step: the brand has nothing to do while it reads 'setting_up'. An Rx checkout attempted before that is refused server-side with “Payments for this treatment are being set up”. This public call leaves out payout verification and partner contract items; the Node SDK rx.activationStatus() returns them. Available since @tagadapay/headless-sdk 1.16.0.

Full example: React thank-you page


Install the same Funnel v2 (CRM canvas)

A headless build still needs the six-step Funnel v2 so operators see landing, quiz, checkout, offer, thank-you, and portal in the CRM. Create it with the Node SDK (API key, server-side) — the browser SDK only runs the bricks. Working example: rx-storefront/ in tagada-examples. pnpm seed calls tagada.funnels.create with this graph; you can also import funnel.bundle.json from Funnels → Import bundle.
Your router must serve those exact paths. Medical intake stays on /thank-you after payment (getQuestionsForProduct → submitCase → poll). The marketing quiz on /quiz has no medical questions.
Reserve your-brand.tgdcare.com in the CRM, then deploy this build onto that subdomain (LegitScript). Own root domain is coming soon (direct mode).

What the headless module does not cover