@quantaroute/checkout 1.8.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +107 -1002
- package/dist/embed/quantaroute-checkout.js +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/quantaroute-checkout.es.js +35 -33
- package/dist/lib/quantaroute-checkout.umd.js +13 -11
- package/package.json +3 -9
- package/src/components/CheckoutWidget.native.tsx +7 -1
- package/src/components/CheckoutWidget.tsx +8 -5
- package/src/components/MapPinSelector.native.tsx +8 -3
- package/src/components/SavedAddressStep.tsx +39 -5
- package/src/core/map-runtime.ts +4 -0
- package/src/core/types.ts +2 -1
- package/src/embed/handoff.ts +0 -1
- package/src/embed/index.tsx +6 -6
- package/src/embed/handoff.test.ts +0 -86
package/README.md
CHANGED
|
@@ -1,1080 +1,185 @@
|
|
|
1
1
|
# @quantaroute/checkout
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> Two-step: Map pin → Auto-filled form.
|
|
5
|
-
> One package. Three platforms: **React web · iOS · Android.**
|
|
3
|
+
A verified-address checkout step for Indian e-commerce. Shoppers sign in, drop a pin on the map, and get an auto-filled address with a [DigiPin](https://www.indiapost.gov.in). The step runs before your own payment page, and you keep your existing payment gateway.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[License](./LICENSE)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## What it does
|
|
15
|
-
|
|
16
|
-
Replaces broken Indian address forms with a precise two-step pin-drop flow:
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
Step 1 – Map Pin Step 2 – Auto-fill + Details
|
|
20
|
-
┌──────────────────────────┐ ┌──────────────────────────┐
|
|
21
|
-
│ [DigiPin: 39J-438-TJC7] │ │ 📍 Auto-detected │
|
|
22
|
-
│ │ │ State: Delhi │
|
|
23
|
-
│ 🗺 OSM vector map │ ──► │ District: New Delhi │
|
|
24
|
-
│ 📍 ← drag │ │ Pincode: 110011 │
|
|
25
|
-
│ │ │ ✓ Deliverable │
|
|
26
|
-
│ [⊕ Locate Me] │ │ 🏠 Add details │
|
|
27
|
-
│ [Confirm Location →] │ │ Flat No: [_________] │
|
|
28
|
-
└──────────────────────────┘ │ [← Adjust] [Save ✓] │
|
|
29
|
-
└──────────────────────────┘
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Key features:**
|
|
33
|
-
|
|
34
|
-
- DigiPin shown **offline** in real-time as the user drags the pin (~4 m × 4 m precision)
|
|
35
|
-
- **No Google Maps.** Free Carto Positron vector basemap
|
|
36
|
-
- Auto-fills State, District, Locality, Pincode, Delivery status from QuantaRoute API
|
|
37
|
-
- Manual fields: Flat no., Floor, Building (OSM pre-filled), Street/Area (OSM pre-filled)
|
|
38
|
-
- Mobile-first (full-screen on phones, card on desktop/tablet)
|
|
39
|
-
- Dark mode, reduced-motion, keyboard navigation, ARIA labels
|
|
40
|
-
- TypeScript — zero runtime deps beyond peer dependencies
|
|
41
|
-
|
|
42
|
-
---
|
|
5
|
+
- **Hosted for you.** You need a merchant ID and a public key. There's no backend to deploy.
|
|
6
|
+
- **Not a payment gateway.** The widget never takes payment. It hands you a verified address and a session ID.
|
|
7
|
+
- **Funnel tracking.** Every step emits an event, so you can see where shoppers drop off.
|
|
43
8
|
|
|
44
9
|
## Platform support
|
|
45
10
|
|
|
11
|
+
| Platform | Install | Shopper sign-in and sessions | Map, DigiPin, address form |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| Any website (script tag) | One `<script>` tag | Yes | Yes |
|
|
14
|
+
| React, Next.js, Vite | `npm i @quantaroute/checkout maplibre-gl` | Yes | Yes |
|
|
15
|
+
| iOS and Android (Expo) | `npm i @quantaroute/checkout expo-osm-sdk expo-location` | No (address capture only) | Yes |
|
|
46
16
|
|
|
47
|
-
|
|
48
|
-
| ----------------------------- | -------------- | --------------------------------- | ---------------------------- |
|
|
49
|
-
| React / Next.js / Vite / Nuxt | Webpack / Vite | MapLibre GL JS | `maplibre-gl` |
|
|
50
|
-
| iOS (Expo / React Native) | Metro | expo-osm-sdk (MapLibre GL Native) | `expo-osm-sdk expo-location` |
|
|
51
|
-
| Android (Expo / React Native) | Metro | expo-osm-sdk (MapLibre GL Native) | `expo-osm-sdk expo-location` |
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
> **Same import on all platforms.**
|
|
55
|
-
> Metro automatically resolves `.native.tsx` files on mobile; Vite/Webpack use the web `.tsx` files.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Quick start
|
|
60
|
-
|
|
61
|
-
### 0 · Get an API key
|
|
62
|
-
|
|
63
|
-
1. Sign up at **[developers.quantaroute.com](https://developers.quantaroute.com)**
|
|
64
|
-
2. Create a project → copy your **API key**
|
|
65
|
-
|
|
66
|
-
> **Never hard-code or commit API keys to git.**
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Web (React / Next.js / Vite / Nuxt)
|
|
71
|
-
|
|
72
|
-
### Install
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm install @quantaroute/checkout maplibre-gl
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Import CSS
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
// In your app entry file (main.tsx / _app.tsx / layout.tsx / nuxt.config.ts)
|
|
82
|
-
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
83
|
-
import '@quantaroute/checkout/style.css';
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Use
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
import { CheckoutWidget } from '@quantaroute/checkout';
|
|
90
|
-
|
|
91
|
-
export default function CheckoutPage() {
|
|
92
|
-
return (
|
|
93
|
-
<CheckoutWidget
|
|
94
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
95
|
-
mapsKey={process.env.NEXT_PUBLIC_QUANTAROUTE_MAPS_KEY}
|
|
96
|
-
onComplete={(address) => {
|
|
97
|
-
console.log(address.digipin); // "39J-438-TJC7"
|
|
98
|
-
console.log(address.pincode); // "110011"
|
|
99
|
-
console.log(address.formattedAddress); // "Flat 4B, Floor 3rd, ..."
|
|
100
|
-
// → send to your backend / payment gateway
|
|
101
|
-
}}
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Third-party hosts must pass `mapsKey` (a public `dp_` key with the maps scope). First-party QuantaRoute sites can omit it.
|
|
108
|
-
|
|
109
|
-
### Next.js (App Router)
|
|
110
|
-
|
|
111
|
-
```tsx
|
|
112
|
-
// app/checkout/page.tsx
|
|
113
|
-
'use client';
|
|
114
|
-
|
|
115
|
-
import dynamic from 'next/dynamic';
|
|
116
|
-
|
|
117
|
-
const CheckoutWidget = dynamic(
|
|
118
|
-
() => import('@quantaroute/checkout').then((m) => m.CheckoutWidget),
|
|
119
|
-
{ ssr: false }
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
export default function CheckoutPage() {
|
|
123
|
-
return (
|
|
124
|
-
<main className="max-w-lg mx-auto p-4">
|
|
125
|
-
<CheckoutWidget
|
|
126
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
127
|
-
onComplete={(addr) => console.log(addr)}
|
|
128
|
-
/>
|
|
129
|
-
</main>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
CSS in `app/layout.tsx`:
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
138
|
-
import '@quantaroute/checkout/style.css';
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Next.js (Pages Router)
|
|
17
|
+
Shopify stores don't need this package. Install the **QuantaRoute Checkout** app from the Shopify App Store instead.
|
|
142
18
|
|
|
143
|
-
|
|
144
|
-
import dynamic from 'next/dynamic';
|
|
145
|
-
const CheckoutWidget = dynamic(() => import('@quantaroute/checkout'), { ssr: false });
|
|
146
|
-
|
|
147
|
-
export default function CheckoutPage() {
|
|
148
|
-
return (
|
|
149
|
-
<CheckoutWidget
|
|
150
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
151
|
-
onComplete={(a) => console.log(a)}
|
|
152
|
-
/>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Nuxt 3
|
|
158
|
-
|
|
159
|
-
```ts
|
|
160
|
-
// nuxt.config.ts
|
|
161
|
-
export default defineNuxtConfig({
|
|
162
|
-
css: ['maplibre-gl/dist/maplibre-gl.css', '@quantaroute/checkout/style.css'],
|
|
163
|
-
});
|
|
164
|
-
```
|
|
19
|
+
## 1. Get your keys
|
|
165
20
|
|
|
166
|
-
|
|
167
|
-
<!-- components/AddressWidget.client.vue (.client = browser-only) -->
|
|
168
|
-
<script setup lang="ts">
|
|
169
|
-
import { CheckoutWidget } from '@quantaroute/checkout';
|
|
170
|
-
const { public: { qrApiKey } } = useRuntimeConfig();
|
|
171
|
-
</script>
|
|
172
|
-
<template>
|
|
173
|
-
<CheckoutWidget :api-key="qrApiKey" map-height="360px" @complete="console.log" />
|
|
174
|
-
</template>
|
|
175
|
-
```
|
|
21
|
+
Sign up at [developers.quantaroute.com](https://developers.quantaroute.com). Onboarding gives you three things:
|
|
176
22
|
|
|
177
|
-
|
|
23
|
+
| Credential | Looks like | Where it goes |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| Merchant ID | UUID | Browser or app (public) |
|
|
26
|
+
| Public key | `dp_…` | Browser or app (public). Covers geocoding and maps. |
|
|
27
|
+
| Admin key | `qca_…` | **Your server only.** Shown once. |
|
|
178
28
|
|
|
179
|
-
|
|
180
|
-
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
181
|
-
import '@quantaroute/checkout/style.css';
|
|
182
|
-
import { CheckoutWidget } from '@quantaroute/checkout';
|
|
29
|
+
Then add every domain the checkout runs on under **Dashboard → Checkout → Widget settings**. That includes `www.`, any staging domain, and wildcards like `*.example.com`. Sign-in requests from any other domain are refused.
|
|
183
30
|
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<CheckoutWidget
|
|
187
|
-
apiKey={import.meta.env.VITE_QR_API_KEY}
|
|
188
|
-
onComplete={(addr) => console.log('Saved:', addr)}
|
|
189
|
-
/>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
31
|
+
## 2. Add it to your site
|
|
193
32
|
|
|
194
|
-
### Any website
|
|
33
|
+
### Any website: script tag
|
|
195
34
|
|
|
196
|
-
|
|
35
|
+
Paste this before `</body>`. Set `data-trigger` to the CSS selector of your own Checkout button.
|
|
197
36
|
|
|
198
37
|
```html
|
|
199
38
|
<script
|
|
200
39
|
src="https://cdn.jsdelivr.net/npm/@quantaroute/checkout@1/dist/embed/quantaroute-checkout.js"
|
|
201
40
|
data-merchant-id="YOUR_MERCHANT_ID"
|
|
202
41
|
data-api-key="dp_YOUR_PUBLIC_KEY"
|
|
203
|
-
data-
|
|
204
|
-
data-functions-url="https://YOUR_PROJECT.supabase.co/functions/v1"
|
|
205
|
-
data-trigger="#checkout-button, .cart__checkout"
|
|
42
|
+
data-trigger="#checkout-button"
|
|
206
43
|
data-redirect-url="https://yourshop.com/pay?session={sessionId}">
|
|
207
44
|
</script>
|
|
208
45
|
```
|
|
209
46
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
**What happens.** A click on anything matching `data-trigger` is intercepted before your own handlers run, so your normal "go to payment" navigation does not fire. When the shopper finishes, the embed redirects to `data-redirect-url` (placeholders `{sessionId}`, `{digipin}`, `{pincode}`, `{state}`, `{district}`, `{locality}`, `{lat}`, `{lng}`, `{formattedAddress}`, `{addressId}`, URL-encoded) or calls your `onComplete`.
|
|
213
|
-
|
|
214
|
-
**JavaScript API** (when you want more control than data attributes):
|
|
215
|
-
|
|
216
|
-
```html
|
|
217
|
-
<script src=".../quantaroute-checkout.js"></script>
|
|
218
|
-
<script>
|
|
219
|
-
const checkout = QuantaRouteCheckout.init({
|
|
220
|
-
merchantId: 'YOUR_MERCHANT_ID',
|
|
221
|
-
apiKey: 'dp_YOUR_PUBLIC_KEY',
|
|
222
|
-
mapsKey: 'dp_YOUR_PUBLIC_KEY',
|
|
223
|
-
functionsUrl: 'https://YOUR_PROJECT.supabase.co/functions/v1',
|
|
224
|
-
triggers: '#checkout-button',
|
|
225
|
-
authMode: 'email', // 'email' (default) | 'phone' | 'none'
|
|
226
|
-
onComplete(address) {
|
|
227
|
-
// address.sessionId, digipin, lat, lng, pincode, state, district, locality,
|
|
228
|
-
// flatNumber, floorNumber, buildingName, streetName, formattedAddress, addressId
|
|
229
|
-
sendToYourPaymentPage(address);
|
|
230
|
-
},
|
|
231
|
-
onClose() { /* shopper closed it without finishing */ },
|
|
232
|
-
});
|
|
233
|
-
// checkout.open(), checkout.close(), checkout.destroy(), checkout.getSessionId()
|
|
234
|
-
</script>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Options: `merchantId`, `apiKey`, `functionsUrl` (required); `mapsKey`, `triggers`, `redirectUrl`, `onComplete`, `onClose`, `onError`, `onEvent`, `brandColor`, `logoUrl`, `theme`, `title`, `authMode`, `keepOpen`. The same events are also dispatched on `window` as `quantaroute:open`, `quantaroute:close`, `quantaroute:complete` and `quantaroute:event` (`event.detail` carries the payload).
|
|
238
|
-
|
|
239
|
-
**Do not trust the browser.** Query-string or callback values can be edited by the shopper. On your server, read the session back with your **secret admin key** (`qca_…`, never in browser code) before you trust the address or ship the order:
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
curl "https://YOUR_PROJECT.supabase.co/functions/v1/checkout-admin?action=session&session_id=SESSION_ID" \
|
|
243
|
-
-H "x-api-key: qca_YOUR_ADMIN_KEY"
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
The response has the session status, the buyer's email or phone, and the verified address. `sessionId` is set once the shopper has signed in with email or phone (`authMode: 'none'` has no session, so there is nothing to verify server-side; use it only where that is acceptable).
|
|
247
|
-
|
|
248
|
-
Local test: build with `npm run build:embed` and open `demo-embed/index.html?m=<merchantId>&k=<dp_key>&f=<functions url>` from a static server rooted at the repo.
|
|
249
|
-
|
|
250
|
-
### Vanilla JS with React from a CDN (UMD)
|
|
251
|
-
|
|
252
|
-
```html
|
|
253
|
-
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" />
|
|
254
|
-
<link rel="stylesheet" href="https://unpkg.com/@quantaroute/checkout/dist/style.css" />
|
|
255
|
-
|
|
256
|
-
<div id="checkout-root"></div>
|
|
257
|
-
|
|
258
|
-
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
259
|
-
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
260
|
-
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
|
261
|
-
<script src="https://unpkg.com/@quantaroute/checkout/dist/lib/quantaroute-checkout.umd.js"></script>
|
|
262
|
-
<script>
|
|
263
|
-
ReactDOM.createRoot(document.getElementById('checkout-root')).render(
|
|
264
|
-
React.createElement(QuantaRouteCheckout.CheckoutWidget, {
|
|
265
|
-
apiKey: 'YOUR_KEY',
|
|
266
|
-
onComplete: (addr) => console.log('Done:', addr),
|
|
267
|
-
})
|
|
268
|
-
);
|
|
269
|
-
</script>
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Native (Expo / React Native — iOS & Android)
|
|
47
|
+
When a shopper clicks the button, the checkout opens in a modal and your own click handler doesn't run. When they finish, the page goes to `data-redirect-url`.
|
|
275
48
|
|
|
276
|
-
|
|
277
|
-
|
|
49
|
+
- **Redirect placeholders:** `{sessionId}`, `{digipin}`, `{pincode}`, `{state}`, `{district}`, `{locality}`, `{lat}`, `{lng}`, `{formattedAddress}` and `{addressId}`. Each one is URL-encoded.
|
|
50
|
+
- **Optional attributes:** `data-brand-color`, `data-logo-url`, `data-theme` (`light` or `dark`), `data-title`, and `data-auth` (`email`, `phone` or `none`).
|
|
278
51
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
npm install @quantaroute/checkout expo-osm-sdk expo-location
|
|
283
|
-
```
|
|
52
|
+
If you'd rather handle the result in JavaScript, call `init` yourself:
|
|
284
53
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
}
|
|
54
|
+
```js
|
|
55
|
+
const checkout = QuantaRouteCheckout.init({
|
|
56
|
+
merchantId: 'YOUR_MERCHANT_ID',
|
|
57
|
+
apiKey: 'dp_YOUR_PUBLIC_KEY',
|
|
58
|
+
triggers: '#checkout-button',
|
|
59
|
+
onComplete(address) { goToPayment(address.sessionId); },
|
|
60
|
+
onClose() {},
|
|
61
|
+
onEvent(event) {},
|
|
62
|
+
});
|
|
63
|
+
// checkout.open() · close() · destroy() · getSessionId()
|
|
297
64
|
```
|
|
298
65
|
|
|
299
|
-
|
|
66
|
+
The embed also fires these as `window` events: `quantaroute:open`, `quantaroute:close`, `quantaroute:complete` and `quantaroute:event`.
|
|
300
67
|
|
|
301
|
-
|
|
302
|
-
| What | iOS | Android |
|
|
303
|
-
| ------------------- | ------------------------------------- | ---------------------- |
|
|
304
|
-
| MapLibre native SDK | `expo-osm-sdk/plugin` | `expo-osm-sdk/plugin` |
|
|
305
|
-
| Location permission | `NSLocationWhenInUseUsageDescription` | `ACCESS_FINE_LOCATION` |
|
|
306
|
-
| Internet permission | – | `INTERNET` |
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
### 3 · Rebuild your dev client
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
npx expo run:ios
|
|
313
|
-
# or
|
|
314
|
-
npx expo run:android
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
### 4 · Use — identical import as web
|
|
68
|
+
### React, Next.js, Vite
|
|
318
69
|
|
|
319
70
|
```tsx
|
|
320
71
|
import { CheckoutWidget } from '@quantaroute/checkout';
|
|
321
|
-
|
|
72
|
+
import '@quantaroute/checkout/style.css';
|
|
73
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
322
74
|
|
|
323
|
-
export
|
|
75
|
+
export function AddressStep() {
|
|
324
76
|
return (
|
|
325
77
|
<CheckoutWidget
|
|
326
|
-
apiKey=
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}}
|
|
78
|
+
apiKey="dp_YOUR_PUBLIC_KEY"
|
|
79
|
+
merchantId="YOUR_MERCHANT_ID"
|
|
80
|
+
enableEmailAuth
|
|
81
|
+
onCheckoutEvent={(e) => analytics.track(e.type, e)}
|
|
82
|
+
onComplete={(address) => goToPayment(address)}
|
|
332
83
|
/>
|
|
333
84
|
);
|
|
334
85
|
}
|
|
335
86
|
```
|
|
336
87
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
A working Expo demo is in `demo-native/`:
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
cd demo-native
|
|
343
|
-
npm install
|
|
344
|
-
# Set your API key in .env: EXPO_PUBLIC_QUANTAROUTE_API_KEY=your_key
|
|
345
|
-
npx expo run:ios
|
|
346
|
-
npx expo run:android
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## Props
|
|
352
|
-
|
|
353
|
-
### Core props
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
| Prop | Type | Default | Platform |
|
|
357
|
-
| ------------------ | -------------------------------------- | ----------------------------- | -------- |
|
|
358
|
-
| `apiKey` | `string` | **required** | all |
|
|
359
|
-
| `onComplete` | `(addr: CompleteAddress) => void` | **required** | all |
|
|
360
|
-
| `apiBaseUrl` | `string` | `https://api.quantaroute.com` | all |
|
|
361
|
-
| `onError` | `(err: Error) => void` | – | all |
|
|
362
|
-
| `defaultLat` | `number` | India center | all |
|
|
363
|
-
| `defaultLng` | `number` | India center | all |
|
|
364
|
-
| `theme` | `'light' | 'dark'` | `'light'` | all |
|
|
365
|
-
| `mapHeight` | `string | number` | `'380px'` / `380` | all |
|
|
366
|
-
| `title` | `string` | `'Add Delivery Address'` | all |
|
|
367
|
-
| `className` | `string` | – | web only |
|
|
368
|
-
| `style` | `CSSProperties | StyleProp<ViewStyle>` | – | all |
|
|
369
|
-
| `indiaBoundaryUrl` | `string` | – | web only |
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
### Search bar
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
| Prop | Type | Default | Platform |
|
|
376
|
-
| -------------- | --------- | ------- | -------- |
|
|
377
|
-
| `enableSearch` | `boolean` | `true` | all |
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
When `enableSearch` is true, a unified search bar appears above the map. It handles two modes automatically:
|
|
381
|
-
|
|
382
|
-
- **Address search** — calls `/v1/digipin/autocomplete` (debounced 400 ms, location-biased)
|
|
383
|
-
- **DigiPin input** — decoded **100 % offline**, zero API cost, instant map flyTo
|
|
384
|
-
|
|
385
|
-
As India Post promotes DigiPin nationally, buyers can paste their 10-character code and land on their exact ±4 m location.
|
|
386
|
-
|
|
387
|
-
### Phone OTP + saved addresses (D2C checkout)
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
| Prop | Type | Default | Platform |
|
|
391
|
-
| ------------------------- | --------- | ------- | -------- |
|
|
392
|
-
| `enablePhoneAuth` | `boolean` | `false` | all |
|
|
393
|
-
| `merchantId` | `string` | – | all |
|
|
394
|
-
| `supabaseFunctionBaseUrl` | `string` | – | all |
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
When `enablePhoneAuth` is true the widget starts with a phone-entry step. Returning buyers can pick a previously saved address from any brand in the network instead of dropping the pin again.
|
|
398
|
-
|
|
399
|
-
On the address details step, buyers choose a **Home / Work / Other** label before saving. The label is stored in the checkout-addresses API and returned on `CompleteAddress.label`.
|
|
400
|
-
|
|
401
|
-
**Requires:**
|
|
402
|
-
|
|
403
|
-
1. A merchant account — sign up at [developers.quantaroute.com/onboarding](https://developers.quantaroute.com/onboarding/merchant) to get your `merchantId` and `supabaseFunctionBaseUrl`.
|
|
404
|
-
2. The `checkout-otp` and `checkout-addresses` Edge Functions deployed (see [Supabase setup](#supabase-setup)).
|
|
405
|
-
|
|
406
|
-
```tsx
|
|
407
|
-
<CheckoutWidget
|
|
408
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
409
|
-
merchantId="your-merchant-uuid"
|
|
410
|
-
supabaseFunctionBaseUrl="https://<project>.supabase.co/functions/v1"
|
|
411
|
-
enablePhoneAuth={true}
|
|
412
|
-
enableSearch={true}
|
|
413
|
-
onComplete={(addr) => console.log(addr)}
|
|
414
|
-
/>
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Email OTP auth (`enableEmailAuth`)
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
| Prop | Type | Default | Platform |
|
|
421
|
-
| ------------------------- | --------- | ------- | -------- |
|
|
422
|
-
| `enableEmailAuth` | `boolean` | `false` | all |
|
|
423
|
-
| `merchantId` | `string` | – | all |
|
|
424
|
-
| `supabaseFunctionBaseUrl` | `string` | – | all |
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
When `enableEmailAuth` is true the widget starts with an email-entry step. The buyer receives a 6-digit OTP via **Resend**. On success a checkout session is created and saved addresses are shown if available.
|
|
428
|
-
|
|
429
|
-
> If both `enablePhoneAuth` and `enableEmailAuth` are set, phone OTP takes precedence.
|
|
430
|
-
|
|
431
|
-
```tsx
|
|
432
|
-
<CheckoutWidget
|
|
433
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
434
|
-
merchantId="your-merchant-uuid"
|
|
435
|
-
supabaseFunctionBaseUrl="https://<project>.supabase.co/functions/v1"
|
|
436
|
-
enableEmailAuth={true}
|
|
437
|
-
onComplete={(addr) => console.log(addr)}
|
|
438
|
-
onCheckoutEvent={(event) => {
|
|
439
|
-
// email-specific events: email_step_viewed | email_otp_sent | email_verified
|
|
440
|
-
console.log('[checkout]', event.type, event);
|
|
441
|
-
}}
|
|
442
|
-
/>
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
**Client-side events emitted during email auth:**
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
| Event type | When |
|
|
449
|
-
| ------------------- | ----------------------------- |
|
|
450
|
-
| `email_step_viewed` | Email input screen rendered |
|
|
451
|
-
| `email_otp_sent` | OTP dispatched via Resend |
|
|
452
|
-
| `email_verified` | OTP correct → session created |
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
---
|
|
456
|
-
|
|
457
|
-
### Merchant courier serviceability
|
|
458
|
-
|
|
459
|
-
QuantaRoute still validates that a pincode exists in the India Post database, but India Post "Non Delivery" is treated as **reference data**, not the final merchant delivery decision. Most D2C stores ship through Shiprocket, Delhivery, ClickPost, or direct courier contracts, so the buyer-facing serviceability check should come from the merchant.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
| Prop | Type | Default | Platform |
|
|
463
|
-
| ------------------------------ | --------- | ---------------- | -------- |
|
|
464
|
-
| `enableServiceabilityCheck` | `boolean` | `false` | all |
|
|
465
|
-
| `showIndiaPostDeliveryWarning` | `boolean` | `false` | all |
|
|
466
|
-
| `serviceabilityBlockCheckout` | `boolean` | merchant setting | all |
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
When `enableServiceabilityCheck` is true and the buyer has a checkout session, the widget calls `checkout-addresses` with `action: "serviceability_check"`. The Edge Function calls the merchant's configured courier endpoint server-side and fails open if that endpoint is unavailable.
|
|
470
|
-
|
|
471
|
-
```tsx
|
|
472
|
-
<CheckoutWidget
|
|
473
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
474
|
-
merchantId={process.env.NEXT_PUBLIC_MERCHANT_ID!}
|
|
475
|
-
supabaseFunctionBaseUrl={process.env.NEXT_PUBLIC_SUPABASE_FUNCTION_URL!}
|
|
476
|
-
enableEmailAuth={true}
|
|
477
|
-
enableServiceabilityCheck={true}
|
|
478
|
-
onComplete={(addr) => console.log(addr)}
|
|
479
|
-
/>
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
Merchant configuration lives on `checkout.merchants`:
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
| Column | Meaning |
|
|
486
|
-
| ---------------------------------- | ------------------------------------------------- |
|
|
487
|
-
| `serviceability_enabled` | Enables the merchant courier check |
|
|
488
|
-
| `serviceability_webhook_url` | Merchant endpoint called by QuantaRoute |
|
|
489
|
-
| `serviceability_webhook_secret` | Shared HMAC secret for outbound calls |
|
|
490
|
-
| `serviceability_block_checkout` | If true, `serviceable: false` blocks address save |
|
|
491
|
-
| `show_india_post_delivery_warning` | Optional soft India Post info banner fallback |
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
Merchant endpoint contract:
|
|
495
|
-
|
|
496
|
-
```http
|
|
497
|
-
POST /checkout/serviceability
|
|
498
|
-
Content-Type: application/json
|
|
499
|
-
X-QuantaRoute-Timestamp: 1782000000000
|
|
500
|
-
X-QuantaRoute-Signature: v1=<hmac_sha256(timestamp + "." + body)>
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
```json
|
|
504
|
-
{
|
|
505
|
-
"merchant_id": "merchant-uuid",
|
|
506
|
-
"pincode": "110011",
|
|
507
|
-
"lat": 28.6139,
|
|
508
|
-
"lng": 77.209,
|
|
509
|
-
"requested_at": "2026-06-21T00:00:00.000Z"
|
|
510
|
-
}
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
Expected response:
|
|
88
|
+
In the Next.js App Router, put the widget in a `'use client'` component. MapLibre needs the browser.
|
|
514
89
|
|
|
515
|
-
|
|
516
|
-
{ "serviceable": true, "message": "Delivery available in 3-5 days" }
|
|
517
|
-
```
|
|
90
|
+
### iOS and Android: Expo
|
|
518
91
|
|
|
519
|
-
|
|
92
|
+
This needs an [Expo development build](https://docs.expo.dev/develop/development-builds/introduction/). It doesn't run in Expo Go.
|
|
520
93
|
|
|
521
94
|
```json
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
---
|
|
528
|
-
|
|
529
|
-
#### Setting up Resend (required for `enableEmailAuth`)
|
|
530
|
-
|
|
531
|
-
> **Hosted merchants (recommended):** If you onboarded at [developers.quantaroute.com](https://developers.quantaroute.com), QuantaRoute already runs Resend on shared infrastructure. Skip steps 1–5 below — just set `enableEmailAuth={true}` and register your domain in the portal. The steps below apply only when **self-hosting** the `checkout-email-otp` Edge Function in your own Supabase project.
|
|
532
|
-
|
|
533
|
-
1. **Create a Resend account** at [resend.com](https://resend.com) — free tier covers ~3 000 emails / month.
|
|
534
|
-
2. **Verify your sending domain** (e.g. `checkout.yourbrand.com` or `yourbrand.com`):
|
|
535
|
-
- Go to **Resend → Domains → Add domain**
|
|
536
|
-
- Add the DNS records shown (SPF, DKIM, DMARC) to your DNS provider
|
|
537
|
-
- Wait for "Verified" status (usually under 5 minutes with Cloudflare; up to 48 h with others)
|
|
538
|
-
3. **Get an API key** — Resend → API Keys → Create. Restrict it to **Send access** only.
|
|
539
|
-
4. **Set secrets on the `checkout-email-otp` Edge Function:**
|
|
540
|
-
In [Supabase Dashboard](https://supabase.com/dashboard) → your project → Edge Functions → Secrets:
|
|
541
|
-
|
|
542
|
-
| Secret | Value |
|
|
543
|
-
| ------------------- | -------------------------------------------------------- |
|
|
544
|
-
| `RESEND_API_KEY` | `re_...` from Resend |
|
|
545
|
-
| `RESEND_FROM_EMAIL` | A verified sender address, e.g. `checkout@yourbrand.com` |
|
|
546
|
-
|
|
547
|
-
5. **Deploy the Edge Function** (if not already done):
|
|
548
|
-
```bash
|
|
549
|
-
supabase functions deploy checkout-email-otp --project-ref <your-project-ref> --no-verify-jwt
|
|
550
|
-
```
|
|
551
|
-
|
|
552
|
-
**Required env vars (frontend):**
|
|
553
|
-
|
|
554
|
-
```env
|
|
555
|
-
NEXT_PUBLIC_QUANTAROUTE_KEY=dp_...
|
|
556
|
-
NEXT_PUBLIC_MERCHANT_ID=your-uuid-from-developer-portal
|
|
557
|
-
NEXT_PUBLIC_SUPABASE_FUNCTION_URL=https://<project-ref>.supabase.co/functions/v1
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
---
|
|
561
|
-
|
|
562
|
-
#### Per-merchant email template customisation
|
|
563
|
-
|
|
564
|
-
Set these columns directly on your `checkout.merchants` row (SQL or Supabase Table Editor). All are optional — omitting any falls back to the QuantaRoute default.
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
| Column | Type | Default | Effect |
|
|
568
|
-
| ------------------------ | ------ | ---------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
569
|
-
| `email_from_name` | `text` | `"{brand} Checkout"` | "From" display name in the inbox, e.g. `"Fabindia"` |
|
|
570
|
-
| `email_logo_url` | `text` | *(text brand name)* | HTTPS URL of your logo (PNG/SVG, 180 × 48 px recommended) shown at the top of every OTP email |
|
|
571
|
-
| `email_subject_template` | `text` | `"{code} is your {brand} checkout code"` | Subject line; supports `{code}` and `{brand}` placeholders |
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
**Example SQL:**
|
|
575
|
-
|
|
576
|
-
```sql
|
|
577
|
-
UPDATE checkout.merchants
|
|
578
|
-
SET
|
|
579
|
-
email_from_name = 'Fabindia',
|
|
580
|
-
email_logo_url = 'https://cdn.fabindia.com/logo-email.png',
|
|
581
|
-
email_subject_template = '{code} — verify your Fabindia order'
|
|
582
|
-
WHERE id = 'your-merchant-uuid';
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
---
|
|
586
|
-
|
|
587
|
-
### Branding
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
| Prop | Type | Default | Platform |
|
|
591
|
-
| -------------- | -------------- | --------- | -------- |
|
|
592
|
-
| `brandColor` | `string` (hex) | `#0ea5e9` | all |
|
|
593
|
-
| `logoUrl` | `string` (URL) | – | all |
|
|
594
|
-
| `headerBanner` | `ReactNode` | – | web only |
|
|
595
|
-
| `mobilePresentation` | `'auto' \| 'sheet' \| 'card'` | `'auto'` | web |
|
|
596
|
-
| `mobileStepLabels` | `{ auth?: string; address?: string; payment?: string }` | Mobile/Address/Pay | web |
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
```tsx
|
|
600
|
-
<CheckoutWidget
|
|
601
|
-
apiKey="..."
|
|
602
|
-
brandColor="#7c3aed"
|
|
603
|
-
logoUrl="https://yourbrand.com/logo.png"
|
|
604
|
-
headerBanner={<p>🚚 Free shipping on orders over ₹499</p>}
|
|
605
|
-
mobilePresentation="sheet"
|
|
606
|
-
mobileStepLabels={{ auth: 'Mobile', address: 'Address', payment: 'Pay' }}
|
|
607
|
-
onComplete={...}
|
|
608
|
-
/>
|
|
609
|
-
```
|
|
610
|
-
|
|
611
|
-
### Mobile-first storefront shells
|
|
612
|
-
|
|
613
|
-
Use `mobilePresentation="sheet"` when the widget is mounted inside a mobile drawer or storefront modal. It keeps the package focused on auth, saved addresses, DigiPin verification, and optional payment while your host app owns cart-specific UI.
|
|
614
|
-
|
|
615
|
-
```tsx
|
|
616
|
-
<CheckoutWidget
|
|
617
|
-
apiKey={geocodingKey}
|
|
618
|
-
merchantId={merchantId}
|
|
619
|
-
supabaseFunctionBaseUrl={functionsUrl}
|
|
620
|
-
enablePhoneAuth
|
|
621
|
-
enablePayment={merchantPaymentMode === 'byo_razorpay'}
|
|
622
|
-
paymentAmountPaise={cartTotalPaiseAfterDiscounts}
|
|
623
|
-
codCartTotalPaise={cartTotalPaiseAfterDiscounts}
|
|
624
|
-
mobilePresentation="sheet"
|
|
625
|
-
mobileStepLabels={{ auth: 'Mobile', address: 'Address', payment: 'Pay' }}
|
|
626
|
-
onCheckoutEvent={(event) => syncHostShellStep(event.step)}
|
|
627
|
-
onComplete={(address) => saveDeliveryAddress(address)}
|
|
628
|
-
onPaymentComplete={(result) => completeOrder(result)}
|
|
629
|
-
/>
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
The host app should keep order summary, product lines, coupons, cart state, platform APIs, and checkout-button interception outside this package. Pass only the final totals and callbacks into the widget.
|
|
633
|
-
|
|
634
|
-
### Analytics (client-side)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
| Prop | Type | Default | Platform |
|
|
638
|
-
| ----------------- | -------------------------------- | ------- | -------- |
|
|
639
|
-
| `onCheckoutEvent` | `(event: CheckoutEvent) => void` | – | all |
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
Called on every step transition. Use it to forward events to MoEngage, Clevertap, GTM, or your own backend — no server-side integration required.
|
|
643
|
-
|
|
644
|
-
```tsx
|
|
645
|
-
<CheckoutWidget
|
|
646
|
-
apiKey="..."
|
|
647
|
-
onCheckoutEvent={(event) => {
|
|
648
|
-
// event.type — e.g. 'phone_verified', 'location_confirmed', 'address_completed'
|
|
649
|
-
// event.step — widget step the user moved INTO
|
|
650
|
-
// event.buyerId — internal buyer UUID (after phone verification)
|
|
651
|
-
// event.digipin — DigiPin of the confirmed location
|
|
652
|
-
// event.timestamp — ISO 8601 timestamp
|
|
653
|
-
|
|
654
|
-
// MoEngage example:
|
|
655
|
-
Moengage.track_event(event.type, {
|
|
656
|
-
step: event.step,
|
|
657
|
-
buyerId: event.buyerId,
|
|
658
|
-
digipin: event.digipin,
|
|
659
|
-
});
|
|
660
|
-
|
|
661
|
-
// GTM example:
|
|
662
|
-
window.dataLayer?.push({ event: event.type, ...event });
|
|
663
|
-
}}
|
|
664
|
-
onComplete={...}
|
|
665
|
-
/>
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
**All event types:**
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
| Event | When fired | Auth channel |
|
|
672
|
-
| ------------------------ | --------------------------------------- | ------------ |
|
|
673
|
-
| `phone_step_viewed` | Phone entry screen rendered | Phone |
|
|
674
|
-
| `otp_sent` | OTP dispatched via MSG91 | Phone |
|
|
675
|
-
| `phone_verified` | SMS OTP correct; session created | Phone |
|
|
676
|
-
| `email_step_viewed` | Email input screen rendered | Email |
|
|
677
|
-
| `email_otp_sent` | OTP dispatched via Resend | Email |
|
|
678
|
-
| `email_verified` | Email OTP correct; session created | Email |
|
|
679
|
-
| `auth_skipped` | Buyer tapped "Skip" | Both |
|
|
680
|
-
| `saved_addresses_viewed` | Saved address list rendered | – |
|
|
681
|
-
| `saved_address_selected` | Buyer chose a saved address (skips map) | – |
|
|
682
|
-
| `map_step_viewed` | Map pin step rendered | – |
|
|
683
|
-
| `location_confirmed` | Buyer tapped "Confirm location" | – |
|
|
684
|
-
| `form_step_viewed` | Address detail form rendered | – |
|
|
685
|
-
| `address_completed` | Full address submitted | – |
|
|
686
|
-
| `widget_reset` | Buyer tapped "Change address" | – |
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
---
|
|
690
|
-
|
|
691
|
-
## `CompleteAddress` output
|
|
692
|
-
|
|
693
|
-
```ts
|
|
694
|
-
interface CompleteAddress {
|
|
695
|
-
digipin: string; // "39J-438-TJC7"
|
|
696
|
-
lat: number; // 28.61390
|
|
697
|
-
lng: number; // 77.20900
|
|
698
|
-
|
|
699
|
-
// Auto-filled from QuantaRoute API
|
|
700
|
-
state: string; // "Delhi"
|
|
701
|
-
district: string; // "New Delhi"
|
|
702
|
-
division: string; // "New Delhi Central"
|
|
703
|
-
locality: string; // "Nirman Bhawan SO"
|
|
704
|
-
pincode: string; // "110011"
|
|
705
|
-
delivery: string; // "Delivery" | "Non Delivery"
|
|
706
|
-
country: string; // "India"
|
|
707
|
-
|
|
708
|
-
// Manual entry by user
|
|
709
|
-
flatNumber: string; // "4B"
|
|
710
|
-
floorNumber: string; // "3rd"
|
|
711
|
-
buildingName: string; // "Sunshine Apartments" (OSM pre-filled)
|
|
712
|
-
streetName: string; // "MG Road, Action Area" (OSM pre-filled)
|
|
713
|
-
|
|
714
|
-
formattedAddress: string; // "4B, 3rd Floor, Sunshine Apartments, MG Road, ..."
|
|
715
|
-
label?: 'home' | 'work' | 'other'; // chosen on address form; defaults to home
|
|
716
|
-
}
|
|
717
|
-
```
|
|
718
|
-
|
|
719
|
-
When `enablePhoneAuth` or `enableEmailAuth` is on, the widget persists the address via `createAddress()` using this label.
|
|
720
|
-
|
|
721
|
-
```ts
|
|
722
|
-
type AddressLabel = 'home' | 'work' | 'other';
|
|
95
|
+
// app.json
|
|
96
|
+
{ "expo": { "plugins": [["@quantaroute/checkout/plugin", {
|
|
97
|
+
"locationPermissionText": "Allow location access to place your delivery pin."
|
|
98
|
+
}]] } }
|
|
723
99
|
```
|
|
724
100
|
|
|
725
|
-
---
|
|
726
|
-
|
|
727
|
-
## Advanced usage
|
|
728
|
-
|
|
729
|
-
### Use sub-components individually (web + native)
|
|
730
|
-
|
|
731
101
|
```tsx
|
|
732
|
-
import {
|
|
733
|
-
|
|
734
|
-
// Offline DigiPin — no API call, ~0.1 ms
|
|
735
|
-
const dp = getDigiPin(28.6139, 77.2090); // "39J-438-TJC7"
|
|
736
|
-
const ok = isWithinIndia(28.6139, 77.2090); // true
|
|
737
|
-
|
|
738
|
-
// Custom two-step flow
|
|
739
|
-
function MyCheckout() {
|
|
740
|
-
const [loc, setLoc] = useState<{ lat: number; lng: number; digipin: string } | null>(null);
|
|
741
|
-
|
|
742
|
-
return loc == null
|
|
743
|
-
? <MapPinSelector onLocationConfirm={(lat, lng, digipin) => setLoc({ lat, lng, digipin })} />
|
|
744
|
-
: <AddressForm
|
|
745
|
-
lat={loc.lat}
|
|
746
|
-
lng={loc.lng}
|
|
747
|
-
digipin={loc.digipin}
|
|
748
|
-
apiKey="..."
|
|
749
|
-
onAddressComplete={(addr) => console.log(addr)}
|
|
750
|
-
onBack={() => setLoc(null)}
|
|
751
|
-
/>;
|
|
752
|
-
}
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
### Dark mode (web)
|
|
756
|
-
|
|
757
|
-
```tsx
|
|
758
|
-
<CheckoutWidget apiKey="..." theme="dark" onComplete={...} />
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
### Custom web theme via CSS variables
|
|
762
|
-
|
|
763
|
-
```css
|
|
764
|
-
.qr-checkout {
|
|
765
|
-
--qr-primary: #6366f1;
|
|
766
|
-
--qr-primary-dark: #4f46e5;
|
|
767
|
-
--qr-radius: 8px;
|
|
768
|
-
--qr-font: 'Poppins', sans-serif;
|
|
769
|
-
}
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
### India boundary overlay (web only)
|
|
102
|
+
import { CheckoutWidget } from '@quantaroute/checkout'; // same import as on web, and no CSS
|
|
773
103
|
|
|
774
|
-
```tsx
|
|
775
104
|
<CheckoutWidget
|
|
776
|
-
apiKey=
|
|
777
|
-
|
|
778
|
-
onComplete={...}
|
|
105
|
+
apiKey={process.env.EXPO_PUBLIC_QUANTAROUTE_KEY!}
|
|
106
|
+
onComplete={(address) => save(address)}
|
|
779
107
|
/>
|
|
780
108
|
```
|
|
781
109
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
## Supabase setup
|
|
785
|
-
|
|
786
|
-
> Only needed when using `**enablePhoneAuth**`. Skip this section for the basic map-only widget.
|
|
110
|
+
Run `npx expo run:ios` or `npx expo run:android` after you add the plugin.
|
|
787
111
|
|
|
788
|
-
|
|
112
|
+
The native widget does the map, DigiPin, search, address form and COD check. Shopper sign-in, saved addresses and server-verifiable sessions are **web only**. In an app, use your own login and send the address to your backend.
|
|
789
113
|
|
|
790
|
-
|
|
114
|
+
## 3. Verify on your server
|
|
791
115
|
|
|
792
|
-
|
|
793
|
-
- Geocoding API key (for address search and reverse-geocoding)
|
|
794
|
-
- Integration snippet with all values filled in
|
|
795
|
-
|
|
796
|
-
### 2 · Deploy Edge Functions
|
|
797
|
-
|
|
798
|
-
The Edge Functions live in `supabase/functions/` inside this repo. Deploy all of them:
|
|
116
|
+
Anything the browser sends you can be edited by the shopper. Before you ship an order, read the session back with your **admin key**:
|
|
799
117
|
|
|
800
118
|
```bash
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
# Email OTP auth (Resend — no TRAI dependency, ship now)
|
|
805
|
-
supabase functions deploy checkout-email-otp --project-ref <your-project-ref> --no-verify-jwt
|
|
806
|
-
|
|
807
|
-
# Phone OTP auth (MSG91 + TRAI DLT — deploy now, enable when DLT is ready)
|
|
808
|
-
supabase functions deploy checkout-otp --project-ref <your-project-ref> --no-verify-jwt
|
|
809
|
-
|
|
810
|
-
# Session expiry — fires session.expired webhooks; runs every 10 min via pg_cron
|
|
811
|
-
supabase functions deploy checkout-session-expiry --project-ref <your-project-ref> --no-verify-jwt
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
### 3 · Set Edge Function secrets
|
|
815
|
-
|
|
816
|
-
In the [Supabase Dashboard](https://supabase.com/dashboard) → your project → Edge Functions → Secrets:
|
|
817
|
-
|
|
818
|
-
`**checkout-email-otp` (required for email auth):**
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
| Secret | Value |
|
|
822
|
-
| ------------------- | ------------------------------------------------------ |
|
|
823
|
-
| `RESEND_API_KEY` | `re_...` — from [resend.com](https://resend.com) |
|
|
824
|
-
| `RESEND_FROM_EMAIL` | Verified sender address, e.g. `checkout@yourbrand.com` |
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
`**checkout-otp` (required for phone/SMS auth — set when TRAI DLT is approved):**
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
| Secret | Value |
|
|
831
|
-
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
832
|
-
| `MSG91_AUTHKEY` | Your MSG91 AuthKey ([setup guide](./docs/MSG91_INDIA_OTP_SETUP.md)) — must match the Edge Function env var name exactly |
|
|
833
|
-
| `MSG91_TEMPLATE_ID` | Your approved DLT OTP template ID |
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
### 4 · Add your domain to the allowed list
|
|
837
|
-
|
|
838
|
-
In the developer portal at **[developers.quantaroute.com/dashboard/checkout](https://developers.quantaroute.com/dashboard/checkout)**, add your storefront's domain (e.g. `yourbrand.com`). The `checkout-email-otp` and `checkout-otp` Edge Functions enforce this list — requests from unlisted origins receive `403 Origin not allowed`.
|
|
839
|
-
|
|
840
|
-
### Minimal Next.js integration
|
|
841
|
-
|
|
842
|
-
#### Email OTP (available now — no TRAI paperwork)
|
|
843
|
-
|
|
844
|
-
```tsx
|
|
845
|
-
// app/checkout/page.tsx
|
|
846
|
-
'use client';
|
|
847
|
-
import dynamic from 'next/dynamic';
|
|
848
|
-
|
|
849
|
-
const CheckoutWidget = dynamic(
|
|
850
|
-
() => import('@quantaroute/checkout').then((m) => m.CheckoutWidget),
|
|
851
|
-
{ ssr: false }
|
|
852
|
-
);
|
|
853
|
-
|
|
854
|
-
export default function CheckoutPage() {
|
|
855
|
-
return (
|
|
856
|
-
<CheckoutWidget
|
|
857
|
-
apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
|
|
858
|
-
merchantId={process.env.NEXT_PUBLIC_MERCHANT_ID!}
|
|
859
|
-
supabaseFunctionBaseUrl={process.env.NEXT_PUBLIC_SUPABASE_FUNCTION_URL!}
|
|
860
|
-
enableEmailAuth={true} {/* ← email OTP via Resend */}
|
|
861
|
-
enableSearch={true}
|
|
862
|
-
brandColor="#your-brand-hex"
|
|
863
|
-
logoUrl="https://yourbrand.com/logo.png"
|
|
864
|
-
onComplete={(address) => {
|
|
865
|
-
// address.digipin, address.formattedAddress, address.pincode, ...
|
|
866
|
-
// → pass to your backend / payment gateway
|
|
867
|
-
}}
|
|
868
|
-
onCheckoutEvent={(event) => {
|
|
869
|
-
// email_step_viewed | email_otp_sent | email_verified | address_completed | ...
|
|
870
|
-
console.log('[checkout]', event.type, event);
|
|
871
|
-
}}
|
|
872
|
-
/>
|
|
873
|
-
);
|
|
874
|
-
}
|
|
875
|
-
```
|
|
876
|
-
|
|
877
|
-
#### Phone OTP (enable when TRAI DLT is approved — same widget, one prop swap)
|
|
878
|
-
|
|
879
|
-
```tsx
|
|
880
|
-
<CheckoutWidget
|
|
881
|
-
...
|
|
882
|
-
enablePhoneAuth={true} {/* swap enableEmailAuth → enablePhoneAuth when SMS is ready */}
|
|
883
|
-
enableEmailAuth={false}
|
|
884
|
-
/>
|
|
119
|
+
curl "https://ikfiewesidedxozotmrl.supabase.co/functions/v1/checkout-admin?action=session&session_id=SESSION_ID" \
|
|
120
|
+
-H "x-api-key: qca_YOUR_ADMIN_KEY"
|
|
885
121
|
```
|
|
886
122
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
```env
|
|
890
|
-
NEXT_PUBLIC_QUANTAROUTE_KEY=dp_...
|
|
891
|
-
NEXT_PUBLIC_MERCHANT_ID=your-uuid-from-developer-portal
|
|
892
|
-
NEXT_PUBLIC_SUPABASE_FUNCTION_URL=https://<project-ref>.supabase.co/functions/v1
|
|
893
|
-
```
|
|
123
|
+
The response has the session status, the buyer's email or phone, and the verified address. Compare it with the order before you fulfil.
|
|
894
124
|
|
|
895
|
-
|
|
125
|
+
## Main props (React and native)
|
|
896
126
|
|
|
897
|
-
|
|
127
|
+
| Prop | Default | Notes |
|
|
128
|
+
| --- | --- | --- |
|
|
129
|
+
| `apiKey` | required | Public `dp_` key |
|
|
130
|
+
| `onComplete(address)` | required | Gets a `CompleteAddress` (see below) |
|
|
131
|
+
| `merchantId` | – | Turns on sessions, saved addresses, COD and funnel events |
|
|
132
|
+
| `enableEmailAuth` / `enablePhoneAuth` | `false` | Shopper sign-in (web) |
|
|
133
|
+
| `onCheckoutEvent(event)` | – | One event per funnel step |
|
|
134
|
+
| `enableCod`, `codCartTotalPaise` | `false` | Cash-on-delivery eligibility by pincode |
|
|
135
|
+
| `enableServiceabilityCheck` | `false` | Calls your courier serviceability webhook |
|
|
136
|
+
| `brandColor`, `logoUrl`, `title`, `theme` | – | Branding: `light` or `dark` |
|
|
137
|
+
| `mapTheme` | `pro` | `pro`, `light` or `dark` QuantaRoute basemap (web) |
|
|
138
|
+
| `defaultLat`, `defaultLng`, `mapHeight` | India | Initial map view |
|
|
139
|
+
| `mobilePresentation` | `auto` | `sheet` inside a drawer or modal (web) |
|
|
898
140
|
|
|
899
|
-
|
|
900
|
-
@quantaroute/checkout/
|
|
901
|
-
├── src/
|
|
902
|
-
│ ├── components/
|
|
903
|
-
│ │ ├── CheckoutWidget.tsx ← web (MapLibre GL JS)
|
|
904
|
-
│ │ ├── CheckoutWidget.native.tsx ← native (SafeAreaView)
|
|
905
|
-
│ │ ├── MapPinSelector.tsx ← web (MapLibre marker)
|
|
906
|
-
│ │ ├── MapPinSelector.native.tsx ← native (expo-osm-sdk OSMView)
|
|
907
|
-
│ │ ├── AddressForm.tsx ← web (HTML form)
|
|
908
|
-
│ │ └── AddressForm.native.tsx ← native (TextInput / Modal)
|
|
909
|
-
│ ├── core/
|
|
910
|
-
│ │ ├── digipin.ts ← offline DigiPin algorithm (shared, no DOM)
|
|
911
|
-
│ │ ├── api.ts ← QuantaRoute API client (shared, fetch)
|
|
912
|
-
│ │ └── types.ts ← TypeScript types (shared)
|
|
913
|
-
│ ├── hooks/
|
|
914
|
-
│ │ ├── useGeolocation.ts ← web (navigator.geolocation)
|
|
915
|
-
│ │ ├── useGeolocation.native.ts ← native (expo-location)
|
|
916
|
-
│ │ └── useDigiPin.ts ← shared (pure math)
|
|
917
|
-
│ └── styles/
|
|
918
|
-
│ ├── checkout.css ← web styles
|
|
919
|
-
│ └── checkout.native.ts ← native StyleSheet.create()
|
|
920
|
-
├── expo-plugin.js ← Expo config plugin
|
|
921
|
-
├── babel.config.js ← Metro/Babel config
|
|
922
|
-
└── dist/ ← web build output (Vite)
|
|
923
|
-
```
|
|
141
|
+
All the props are typed. Hover over `CheckoutWidgetProps` in your editor to see them.
|
|
924
142
|
|
|
925
|
-
|
|
143
|
+
## Funnel events
|
|
926
144
|
|
|
927
|
-
|
|
928
|
-
Metro (Expo app) → "react-native" export → src/index.ts
|
|
929
|
-
→ MapPinSelector.native.tsx (expo-osm-sdk)
|
|
930
|
-
→ useGeolocation.native.ts (expo-location)
|
|
145
|
+
`onCheckoutEvent` (or `onEvent` in the embed) receives `{ type, sessionId?, authChannel?, deviceType, platform, timestamp, … }`. The event types are:
|
|
931
146
|
|
|
932
|
-
Vite / Webpack / Next.js → "import" export → dist/lib/quantaroute-checkout.es.js
|
|
933
|
-
→ MapPinSelector.tsx (MapLibre GL JS)
|
|
934
|
-
→ useGeolocation.ts (navigator.geolocation)
|
|
935
147
|
```
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
## Map tile license
|
|
940
|
-
|
|
941
|
-
Uses **Carto Positron** vector tiles (Carto Voyager on native):
|
|
942
|
-
|
|
943
|
-
- Free for commercial use — attribution required
|
|
944
|
-
- Attribution: `© OpenStreetMap contributors © CARTO`
|
|
945
|
-
- No API key required for Carto basemaps
|
|
946
|
-
|
|
947
|
-
---
|
|
948
|
-
|
|
949
|
-
## DigiPin license
|
|
950
|
-
|
|
951
|
-
The offline DigiPin algorithm is the official India Post implementation:
|
|
952
|
-
|
|
953
|
-
- **Source:** [github.com/INDIAPOST-gov/digipin](https://github.com/INDIAPOST-gov/digipin)
|
|
954
|
-
- **Developed by:** India Post, IIT Hyderabad, ISRO NRSC
|
|
955
|
-
- **License:** Apache 2.0
|
|
956
|
-
|
|
957
|
-
---
|
|
958
|
-
|
|
959
|
-
## Documentation
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
| Doc | Description |
|
|
963
|
-
| ---------------------------------------------------------- | ------------------------------------------------ |
|
|
964
|
-
| [Changelog](./CHANGELOG.md) | Version history and release notes |
|
|
965
|
-
| [Checkout roadmap](./docs/CHECKOUT_ROADMAP.md) | Feature phases and implementation status |
|
|
966
|
-
| [Merchant onboarding](./docs/merchant-onboarding.md) | Payment modes A/B/C, Razorpay setup (Mode B) |
|
|
967
|
-
| [BYO payment gateway](./docs/byo-payment-gateway.md) | Mode A — PayU/Cashfree/Paytm/Shopify integration |
|
|
968
|
-
| [Hosted payments roadmap](./docs/hosted-payments-roadmap.md) | Mode C — QuantaRoute Payments (coming soon) |
|
|
969
|
-
| [Razorpay E2E setup](./docs/razorpay-e2e-setup.md) | Test-mode verification checklist (Mode B) |
|
|
970
|
-
| [Customer migration playbook](./docs/customer-migration-playbook.md) | Merchant-facing import + lazy DigiPin story |
|
|
971
|
-
| [Portal payment wizard spec](./docs/portal-payment-wizard-spec.md) | Developer portal — `/checkout/payments` spec |
|
|
972
|
-
| [Portal migration wizard spec](./docs/portal-migration-wizard-spec.md) | Developer portal — `/checkout/migrate` spec |
|
|
973
|
-
| [MSG91 OTP setup](./docs/MSG91_INDIA_OTP_SETUP.md) | India SMS / DLT configuration for phone OTP |
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
---
|
|
977
|
-
|
|
978
|
-
## Security & integration
|
|
979
|
-
|
|
980
|
-
### What ships in the npm package
|
|
981
|
-
|
|
982
|
-
The published tarball contains **no secrets** — only client-side widget code:
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
| Included | Excluded |
|
|
986
|
-
| ------------------------------------------ | ----------------------------------------- |
|
|
987
|
-
| `dist/lib/*.js` (Terser-minified ES + UMD) | `supabase/`, Edge Functions, migrations |
|
|
988
|
-
| `dist/lib/index.d.ts` | `demo/`, `docs/`, `openapi.yaml`, `.env*` |
|
|
989
|
-
| `dist/style.css` | `vite.config.ts`, dev tooling |
|
|
990
|
-
| `src/` (required for React Native / Metro) | `node_modules/` |
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
- **Geocoding `apiKey`** (`dp_…`) is designed for the browser bundle — rate-limited, scoped to your merchant plan.
|
|
994
|
-
- **Admin API key** (`qca_…`) must **never** ship in frontend code. Use it server-side only (`x-api-key` on `checkout-admin`).
|
|
995
|
-
- OTP delivery (Resend) and session minting run on **QuantaRoute-hosted Edge Functions**, not inside the npm bundle.
|
|
996
|
-
- **Consistent email OTP:** the same 6-digit code is stored per `(email, merchant)` and reused for up to **10 successful logins** (not single-use). Repeat send requests skip Resend when the code is still active. This reduces email cost but is weaker than banking-grade OTP — document for your shoppers if required by policy.
|
|
997
|
-
|
|
998
|
-
Verify before every publish:
|
|
999
|
-
|
|
1000
|
-
```bash
|
|
1001
|
-
npm run type-check && npm run build:lib
|
|
1002
|
-
npm pack --dry-run # confirm 36 files, no .env / supabase / demo
|
|
1003
|
-
rg -i 're_|sk_|service.role|password' dist/ # should return no matches
|
|
148
|
+
email_step_viewed email_otp_sent email_verified phone_step_viewed otp_sent phone_verified auth_skipped
|
|
149
|
+
saved_addresses_viewed saved_address_selected map_step_viewed location_confirmed
|
|
150
|
+
form_step_viewed address_completed address_risk_scored widget_reset session_abandoned
|
|
1004
151
|
```
|
|
1005
152
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
Use this when embedding `@quantaroute/checkout` on a **hosted QuantaRoute** storefront (onboarded via [developers.quantaroute.com](https://developers.quantaroute.com)):
|
|
1009
|
-
|
|
1010
|
-
1. **Onboard** — complete [merchant onboarding](https://developers.quantaroute.com/onboarding/merchant); copy `merchantId`, geocoding `apiKey`, and `supabaseFunctionBaseUrl` from the wizard or [Checkout dashboard](https://developers.quantaroute.com/dashboard/checkout).
|
|
1011
|
-
2. **Install** — `npm install @quantaroute/checkout maplibre-gl` (+ CSS imports).
|
|
1012
|
-
3. **Env vars** — expose only public values (`NEXT_PUBLIC_QUANTAROUTE_KEY`, `NEXT_PUBLIC_MERCHANT_ID`, `NEXT_PUBLIC_SUPABASE_FUNCTION_URL`). Never commit `.env` to git.
|
|
1013
|
-
4. **Allowed domains** — in the developer portal, add every origin that will host the widget (e.g. `yourbrand.com`, `www.yourbrand.com`, `*.yourbrand.com` for subdomains). Both `checkout-otp` and `checkout-email-otp` reject requests from unlisted origins.
|
|
1014
|
-
5. **Enable auth** — set `enableEmailAuth={true}` with `merchantId` and `supabaseFunctionBaseUrl`. Auth is **opt-in** and **web-only** today (React Native widget does not include the email OTP steps).
|
|
1015
|
-
6. **Optional branding** — `brandColor`, `logoUrl`; per-merchant email template columns (`email_from_name`, `email_logo_url`, `email_subject_template`) in the portal.
|
|
1016
|
-
7. **Handle completion** — implement `onComplete` to pass the `CompleteAddress` to your cart / payment gateway. Built-in payment (`enablePayment`) and COD (`enableCod`) are separate opt-in props.
|
|
1017
|
-
|
|
1018
|
-
> **Resend is platform-managed for hosted merchants.** QuantaRouHMACte operates the shared `checkout-email-otp` Edge Function and Resend sender (`RESEND_API_KEY`, `RESEND_FROM_EMAIL`). Merchants do **not** need their own Resend account for the hosted MVP. See [Setting up Resend](#setting-up-resend-required-for-enableemailauth) only if you self-host the Edge Functions.
|
|
1019
|
-
|
|
1020
|
-
### Platform responsibilities (QuantaRoute)
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
| Item | Owner |
|
|
1024
|
-
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
|
|
1025
|
-
| Deploy & operate `checkout-email-otp`, `checkout-addresses`, `checkout-session-expiry` | QuantaRoute |
|
|
1026
|
-
| `RESEND_API_KEY`, `RESEND_FROM_EMAIL`, Supabase service role | QuantaRoute (Edge Function secrets) |
|
|
1027
|
-
| `checkout.merchants` provisioning, `allowed_domains`, email template columns | QuantaRoute portal + DB |
|
|
1028
|
-
| Buyer OTP consistent reuse (10 logins per code), fresh-code limit (3 / 24h), verify lockout (5 fails → 15 min) | Edge Function |
|
|
1029
|
-
| Geocoding API key issuance & plan rate limits | QuantaRoute |
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
### Maintainer publish checklist
|
|
1033
|
-
|
|
1034
|
-
When publishing a new version to npm (maintainers only):
|
|
1035
|
-
|
|
1036
|
-
1. Enable **npm 2FA** on the `@quantaroute` org account (publish + modify).
|
|
1037
|
-
2. Run `npm run type-check && npm run build:lib && npm pack --dry-run` — confirm tarball contents.
|
|
1038
|
-
3. Confirm no `.env`, `.pem`, or `supabase/` paths in the pack list.
|
|
1039
|
-
4. Publish from a **clean git tag** with provenance: `npm publish --provenance --access public`.
|
|
1040
|
-
5. Do **not** bump version in the same change unless releasing; current version is `1.4.5`.
|
|
153
|
+
The same funnel appears in your dashboard with no extra code.
|
|
1041
154
|
|
|
1042
|
-
|
|
155
|
+
## `CompleteAddress`
|
|
1043
156
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
# Type checks
|
|
1055
|
-
npm run type-check # web (Vite tsconfig)
|
|
1056
|
-
npm run type-check:native # native (RN tsconfig)
|
|
1057
|
-
|
|
1058
|
-
# Build
|
|
1059
|
-
npm run build:lib # library → dist/lib/
|
|
1060
|
-
npm run build # library + demo
|
|
157
|
+
```ts
|
|
158
|
+
{
|
|
159
|
+
digipin: '39J-438-TJC7', lat: 28.6139, lng: 77.209,
|
|
160
|
+
state: 'Delhi', district: 'New Delhi', locality: 'Nirman Bhawan SO', pincode: '110011',
|
|
161
|
+
delivery: 'Delivery', country: 'India',
|
|
162
|
+
flatNumber: '4B', floorNumber: '3rd', buildingName: 'Sunshine Apartments', streetName: 'MG Road',
|
|
163
|
+
formattedAddress: '4B, 3rd Floor, Sunshine Apartments, MG Road, …',
|
|
164
|
+
label: 'home', // 'home' | 'work' | 'other'
|
|
165
|
+
// The embed also returns sessionId and addressId.
|
|
166
|
+
}
|
|
1061
167
|
```
|
|
1062
168
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
```bash
|
|
1066
|
-
cd demo-native
|
|
1067
|
-
npm install
|
|
1068
|
-
npx expo run:ios # requires Xcode
|
|
1069
|
-
npx expo run:android # requires Android Studio
|
|
1070
|
-
```
|
|
169
|
+
## Security
|
|
1071
170
|
|
|
1072
|
-
|
|
171
|
+
- Only public values go in the browser or app: the merchant ID and the `dp_` key. The `qca_` admin key belongs on your server only.
|
|
172
|
+
- Sign-in only works from domains on your allowed list.
|
|
173
|
+
- Verify the session on your server before you trust an address. See [step 3](#3-verify-on-your-server).
|
|
174
|
+
- The npm package has no secrets and no server code.
|
|
1073
175
|
|
|
1074
|
-
##
|
|
176
|
+
## Maps
|
|
1075
177
|
|
|
1076
|
-
|
|
178
|
+
Maps use the QuantaRoute India basemap at `maps.quantaroute.com`, with your `dp_` key. Keep the "© OpenStreetMap contributors" attribution visible. In the native widget, when no key is given, the map falls back to Carto Positron.
|
|
1077
179
|
|
|
1078
|
-
|
|
180
|
+
## Links
|
|
1079
181
|
|
|
1080
|
-
|
|
182
|
+
- [Developer portal and docs](https://developers.quantaroute.com)
|
|
183
|
+
- [Changelog](./CHANGELOG.md)
|
|
184
|
+
- The DigiPin algorithm is [India Post's](https://github.com/INDIAPOST-gov/digipin) (Apache 2.0)
|
|
185
|
+
- License: MIT
|