PollarPollar
Getting Started

Example App

The Pollar demo is a Next.js app that exercises the SDK feature by feature, each page next to the code that drives it. Use it to see a feature working before you build it, and to copy the patterns into your own app.

Repository: https://github.com/pollar-xyz/demo

Live: demo.pollar.xyz


What it shows

The sidebar groups the pages in sections:

SectionPages
ProductsAuthentication (login, logout, sessions), Wallet (send, receive, balance, chains, assets, history, distribution, signer rotation), Transactions (build and sign, sign an XDR)
IntegrationsKYC, ramps, swap, earn and cards, each with an overview and its implementation
Wallet adaptersStellar Wallets Kit and other wallets plugged in as login providers
AdaptersThird-party protocols wired in with createPollarAdapterHook (Trustless Work escrows, among others)
Built with PollarApps built on Pollar alongside another technology

Pages marked Soon are not live yet. A few groups still in testing open only with a passcode.


Live demo

The live demo runs with Pollar's own demo keys on testnet and mainnet. To try it against your own app, pass your publishable key in the URL:

https://demo.pollar.xyz/?apiKey=pub_testnet_xxxxxxxxxxxxxxxxxxxx

The network follows the key's prefix (pub_testnet_ or pub_mainnet_). Your app must list the demo's origin under Build > Domains, or the SDK refuses the requests.


Run locally

git clone https://github.com/pollar-xyz/demo
cd demo
pnpm install
cp .env.example .env.local
pnpm dev

Open http://localhost:3080.

The Pollar pages need no variables: they use the demo keys, or the key you pass with ?apiKey=. When you use your own key, add http://localhost:3080 to your app's domains. .env.example documents the rest:

VariableUsed by
NEXT_PUBLIC_POLLAR_BASE_URLPoints the SDK at another sdk-api (a local or self-hosted one). Empty uses https://sdk.api.pollar.xyz
NEXT_PUBLIC_TW_API_KEYThe Trustless Work escrow page
ABROAD_API_KEYThe Abroad ramp page (server-side only)
*_PASSCODEUnlocks the groups that are still in testing

Provider setup

Every page of the demo runs inside one <PollarProvider>. In your own app the same setup reads the key from an environment variable:

import { PollarProvider } from '@pollar/react';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <PollarProvider client={{ apiKey: process.env.NEXT_PUBLIC_POLLAR_PUBLISHABLE_KEY! }}>
          {children}
        </PollarProvider>
      </body>
    </html>
  );
}

See @pollar/react for the provider's props and the modals it mounts.


Funding modes

The demo has no backend of its own, so it shows the Immediate flow: the wallet is set up at login. For Deferred, where your backend opens each account after a business event (KYC approved, first deposit), see the Deferred Flow Guide, which has the API route and the frontend gate.


Templates

Starting points for a whole app, each built on the SDK:

TemplateWhat it is
pollar-neobank-templateA consumer banking app: account home, receive with a QR, send, history
pollar-commerce-templateA shop that charges in USDC, with the commerce core apart from the storefront
pollar-telegram-shop-templateThe commerce template as a Telegram Mini App
pollar-crowdfunding-templateMilestone crowdfunding on Trustless Work escrows

pollar-apps lists the apps open for contributors to build on these templates.

On this page

Was this helpful?