# UPIDrop — AI Integration Prompts & Tool Guide

Master prompts and implementation recipes for **Claude Code**, **Cursor**, **Google Antigravity**, **OpenAI Codex**, **Windsurf**, and **GitHub Copilot**.

---

## Overview

You can integrate UPIDrop into any web, mobile, or backend application in minutes simply by feeding these pre-engineered master prompts to your favorite AI coding assistant.

Each prompt is designed to supply the AI with complete context: endpoints, authentication headers, payment flows, SmartTrack auto-reconciliation, and webhook security standards.

---

## 1. Master Prompt: Universal Website (HTML / Vanilla JS)

> **Use with:** Cursor Composer, Claude Code, Antigravity, Windsurf

```text
Integrate UPIDrop Zero-Fee UPI Payment Gateway into this website.

Configuration:
- Public Key: YOUR_PUBLIC_KEY
- Checkout SDK: https://upidrop.roori.in/sdk/upidrop.js
- API Base: https://upidrop-pg.upidrop-payment-gateway.workers.dev
- Hosted Checkout URL: https://upidrop.roori.in/pay.html

Implementation Steps:
1. Include the SDK script in <head> or right before </body>:
   <script src="https://upidrop.roori.in/sdk/upidrop.js"></script>

2. Initialize UPIDrop:
   UPIDrop.init({ publicKey: 'YOUR_PUBLIC_KEY' });

3. Connect the checkout trigger to the buy button:
   UPIDrop.checkout({
     amount: 499.00,
     description: 'Product Name',
     customerName: 'Customer Name',
     customerEmail: 'customer@example.com',
     onSuccess: function(data) {
       console.log('Payment successful:', data);
       // Handle UI success or redirect
     },
     onCancel: function() {
       console.log('Payment was cancelled by user');
     }
   });

4. Ensure that modal styling and responsive viewports work cleanly across desktop and mobile screens.
```

---

## 2. Master Prompt: Next.js (App Router / React)

> **Use with:** Cursor, Claude Code, v0 by Vercel

```text
Build a full UPI checkout integration using UPIDrop for this Next.js project.

API Details:
- API Base: https://upidrop-pg.upidrop-payment-gateway.workers.dev
- Header: X-API-Key: process.env.UPIDROP_PUBLIC_KEY
- Webhook Secret: process.env.UPIDROP_WEBHOOK_SECRET

Requirements:
1. Server Action / Route Handler `app/api/checkout/route.ts`:
   - Accepts { amount, description, customerName, customerEmail }
   - Sends POST to https://upidrop-pg.upidrop-payment-gateway.workers.dev/api/v1/orders with header X-API-Key
   - Receives { orderId, token, upiDeepLink, amount, paisaOffset }
   - Returns order metadata to client.

2. Client Component `components/UPICheckout.tsx`:
   - If user is on Mobile: Show 1-click payment buttons for GPay, PhonePe, and Paytm using the upiDeepLink.
   - If user is on Desktop: Render a QR Code of the upiDeepLink with amount display.
   - Provide a 12-digit UTR input field calling POST /api/v1/orders/:id/utr with { utr, token }.
   - Poll /api/v1/orders/:id/public every 3 seconds until status === 'paid'.

3. Webhook Route `app/api/webhooks/upidrop/route.ts`:
   - Verify HMAC-SHA256 signature from header X-UPIDrop-Signature using process.env.UPIDROP_WEBHOOK_SECRET.
   - On 'order.paid' event, update database and mark order as fulfilled.
```

---

## 3. Master Prompt: Node.js (Express / Fastify)

> **Use with:** Claude Code, GitHub Copilot, Codex

```text
Implement a complete backend payment and webhook service for UPIDrop in Express.js.

Base URL: https://upidrop-pg.upidrop-payment-gateway.workers.dev
Headers: X-API-Key: process.env.UPIDROP_PUBLIC_KEY

Tasks:
1. Endpoint `POST /api/create-payment`:
   - Validate order body { amount, customerName, email, phone }.
   - Send POST to `${BASE_URL}/api/v1/orders` with header X-API-Key.
   - Return orderId, token, upiDeepLink, and checkoutUrl: `https://upidrop.roori.in/pay.html?orderId=${orderId}&token=${token}`.

2. Endpoint `POST /api/webhook/upidrop`:
   - Read raw request body buffer.
   - Compute HMAC-SHA256 of raw body using process.env.UPIDROP_WEBHOOK_SECRET.
   - Compare with request header 'x-upidrop-signature' using crypto.timingSafeEqual.
   - If valid and payload.event === 'order.paid', update order status to PAID in database.
   - Return 200 { received: true }.
```

---

## 4. Master Prompt: Python (FastAPI / Django / Flask)

> **Use with:** Cursor, Claude Code, Antigravity

```text
Create a UPIDrop payment integration in Python FastAPI.

Credentials:
- Base API: https://upidrop-pg.upidrop-payment-gateway.workers.dev
- UPIDROP_PUBLIC_KEY (Environment variable)
- UPIDROP_WEBHOOK_SECRET (Environment variable)

Requirements:
1. Function `create_upi_order(amount: float, description: str, customer_name: str)`:
   - Uses `httpx` to POST to https://upidrop-pg.upidrop-payment-gateway.workers.dev/api/v1/orders.
   - Passes header {"X-API-Key": UPIDROP_PUBLIC_KEY}.
   - Returns order response dictionary.

2. Webhook route `@app.post("/api/webhooks/upidrop")`:
   - Reads raw body bytes and header `x-upidrop-signature`.
   - Validates HMAC-SHA256 signature using `hmac.compare_digest(hmac.new(SECRET.encode(), raw_body, hashlib.sha256).hexdigest(), signature)`.
   - On signature match, parses JSON and handles 'order.paid'.
   - Returns {"status": "ok"}.
```

---

## 5. Master Prompt: React Native / Expo (Mobile Apps)

> **Use with:** Cursor, Claude Code, Windsurf

```text
Create a seamless UPI Payment screen for React Native Expo using UPIDrop.

Architecture:
- Base URL: https://upidrop-pg.upidrop-payment-gateway.workers.dev
- Merchant Key: YOUR_PUBLIC_KEY

Features:
1. Call UPIDrop POST /api/v1/orders to get orderId, token, and upiDeepLink.
2. Check installed UPI apps or launch via `Linking.openURL(upiDeepLink)`.
3. Provide dedicated app buttons for Google Pay, PhonePe, and Paytm deep links.
4. When app returns to foreground (using AppState), show a sleek 12-digit UTR confirmation input.
5. Submit UTR to POST /api/v1/orders/{orderId}/utr and poll GET /api/v1/orders/{orderId}/public until status is 'paid'.
6. Show a celebration animation (e.g. Lottie) upon confirmation.
```

---

## 6. Master Prompt: Flutter (Android & iOS)

> **Use with:** Cursor, Antigravity, Claude Code

```text
Create a Flutter payment screen integrating UPIDrop Zero-Fee UPI.

Specs:
- Base API: https://upidrop-pg.upidrop-payment-gateway.workers.dev
- Public Key: YOUR_PUBLIC_KEY

Tasks:
1. Create order with `http.post` to `/api/v1/orders` passing `X-API-Key`.
2. Parse response to extract `upiDeepLink` and `orderId`.
3. Launch UPI intent using package `url_launcher`:
   `await launchUrl(Uri.parse(upiDeepLink), mode: LaunchMode.externalApplication);`
4. Provide a 12-digit UTR input field with automated formatting and validation.
5. Post UTR to `/api/v1/orders/$orderId/utr`.
6. Poll `/api/v1/orders/$orderId/public` every 2.5 seconds to detect SmartTrack auto-verification.
```

---

## Tips for Prompting AI Models with UPIDrop

1. **Supply your actual Public Key**: Replace `YOUR_PUBLIC_KEY` with your real key (`pk_live_...`) before pasting into the prompt.
2. **Mention Zero-Fee Direct UPI**: Make sure the prompt notes that UPIDrop does not deduct a 2-3% payment aggregator fee and settles directly to your UPI ID.
3. **SmartTrack Auto-Confirmation**: Remind the AI that UPIDrop uses SmartTrack (with dynamic paisa offsets) to auto-verify payments even if the user forgets to enter their UTR.
4. **Secure Webhook Verification**: Always request constant-time HMAC verification (`crypto.timingSafeEqual` in Node, `hmac.compare_digest` in Python) to prevent timing attacks.

---

## Developer Support

- **Dashboard**: [https://upidrop.roori.in](https://upidrop.roori.in)
- **Interactive Playground**: [https://upidrop.roori.in/pay.html](https://upidrop.roori.in/pay.html)
- **Developer Help**: [rohitmore3192@gmail.com](mailto:rohitmore3192@gmail.com)
