Skip to content

Web integration

Install the Web SDK:

Terminal window
npm install "@zwipe/web@https://api.zwipe.co/docs/examples/zwipe-web-0.1.0.tgz"

Create a container with a height, then mount the card:

<div id="card" style="height:850px;max-height:100dvh"></div>
<script src="https://api.zwipe.co/docs/examples/web-sdk/zwipe.js"></script>
<script>
const { mountZwipeCard, DEMO_PUBLISHABLE_KEY } = window.Zwipe;
const card = mountZwipeCard(document.querySelector('#card'), {
publishableKey: DEMO_PUBLISHABLE_KEY,
customer: { email: 'alex@example.com', first_name: 'Alex', last_name: 'Morgan', phone: '+12025550147' },
branding: { restaurantName: 'Your restaurant' },
});
</script>

Call card.destroy() when removing the view. card.open('signup'), card.open('addFunds') and card.open('home') select a starting screen.

'use client';
import { ZwipeCard } from '@zwipe/web/react';
export default function Card({ customer, publishableKey }) {
return <ZwipeCard customer={customer} publishableKey={publishableKey}
branding={{ restaurantName: 'Your restaurant' }} />;
}

Try Italian Deli or download the Next.js example. The example includes its dependencies and run instructions; run npm install and npm run dev, then open http://localhost:8093.

Use view="entry" for a home-screen offer. Before a card exists it shows Get started; after funding it shows the balance and Add funds. Handle onNavigate to expand the container when the card flow opens and onClose to restore its compact size. See the runnable Next.js example.

onStateChange exposes card status, balance and Wallet confirmation. onProfileChange returns updated profile fields. Neither event includes a bearer token or card details.

The hosted web flow uses Stripe Payment Element; Zwipe verifies payment completion on its server. Native saved-card PaymentSheet is part of the React Native SDK. Apple Pay and Google Pay checkout require separate program and domain configuration.

On iPhone or iPad, the Wallet action opens the issuer handoff. Android uses manual Google Wallet setup; desktop users add the card on their phone. Wallet confirmation records the customer’s confirmation.

Real sessions are scoped to the browser tab and embedding website. Restricted browser storage can require another sign-in after the view closes. The demo key uses local storage and code 123456; it sends no messages and moves no money. See test environments.