paydi-widget
v0.1.2
Published
PayDI embeddable checkout widget for ADI Chain payments
Maintainers
Readme
PayDI Widget
Embeddable React checkout widget for ADI Chain payments.
What this package provides
- A drop-in
PayDIWidgetReact component for wallet connect + checkout - Built-in wallet stack using wagmi + RainbowKit + WalletConnect
- Payment flow states (loading, connect wallet, confirm, pending, success, failed, expired)
Install
bun add paydi-widgetThis package has peer dependencies:
reactreact-domwagmiviem@tanstack/react-query@rainbow-me/rainbowkit
Basic usage (React / Next.js)
"use client";
import { PayDIWidget } from "paydi-widget";
export function Checkout() {
return (
<PayDIWidget
sessionId="0x6f..."
apiUrl="https://api.example.com"
theme="dark"
onSuccess={(txHash) => console.log("Paid", txHash)}
onFailure={(err) => console.error("Payment failed", err)}
/>
);
}Next.js SSR note
For App Router / SSR projects, render the widget on the client only:
"use client";
import dynamic from "next/dynamic";
const PayDIWidget = dynamic(
() => import("paydi-widget").then((m) => m.PayDIWidget),
{ ssr: false }
);API
PayDIWidget props (WidgetOptions):
sessionId: string- payment session id returned byPOST /payments/sessionsapiUrl: string- base URL of your AdiPay API instanceprojectId?: string- optional WalletConnect project idtheme?: "light" | "dark"- visual theme (default:light)onSuccess?: (txHash: string) => void- called when session is confirmedonFailure?: (err: Error) => void- called on transaction/send failures
Exports
PayDIWidget(primary)WidgetOptions(type)
Local development
From the monorepo root:
bun install
bun run build:widget
bun run dev:testsiteThen open http://localhost:3001 to test the widget in the local demo storefront.
