CDN Usage
Install @transx402/client via ESM CDN — no build step, for static HTML and CMS pages without a merchant backend.
Overview
The CDN build of @transx402/client adds IDRX payments to any HTML page with a module script — no npm, no bundler. It default-exports a TransX402 namespace (create, paywall).
Use the CDN when:
- You have static HTML or a CMS without a merchant settle endpoint
- You want the fastest sandbox paywall
- You will use direct settlement (browser calls
POST /facilitate)
Use the npm package for bundled apps (Next.js, Vite) where types and tree-shaking matter. Use the WordPress Plugin for WordPress — the plugin bundles @transx402/client and uses server settlement; it is not a wrapper around this CDN script.
Adding the Script
Debug (unminified): https://cdn.transx402.com/v1/transx402.browser.js.
Classic <script src="…/transx402.min.js"> is not the published filename.
Publishable keys
Direct settlement needs a publishable key (ipk_pub_sandbox_ / ipk_pub_live_) and the page origin registered under Dashboard Allowed Origins. Secret keys are rejected when the browser sends Origin.
Also set environment ("camp" sandbox, "base" production) and merchantWallet.
Adding a Paywall
price is whole IDR (5000 = Rp 5,000). This gates #premium-content behind Pay with IDRX (wallet connect, Permit2, signature).
Optional: TransX402.create
Same API as createBrowserClient / createPaywall.
Bundle Size
| Variant | Target |
|---|---|
CDN full bundle (transx402.browser.min.js) | under 60 KB gzipped |
The CDN bundle includes paywall UI and the Path 4 wallet flow.
Next Steps
- JavaScript Library — npm API (
createBrowserClient, agents) - WordPress Plugin — no-code server settlement
- Quickstart — register → pick a stack