for_ai_assistants

Integrate SkyPay with your AI IDE

Paste a single prompt into Cursor, Copilot, Windsurf, or any AI coding tool. It includes checkout, verification, and security rules — you only need to bring your API key.

  1. 01

    Get your API key

    Sign up or log in → Developers → API Keys

  2. 02

    Enter it below

    Injects into the copyable prompt

  3. 03

    Copy the prompt

    One click — full integration context

  4. 04

    Paste in your AI IDE

    Agent implements checkout + verify

Required. The prompt uses your key for checkout and verification examples.

Enter your API key before copying — placeholder text won't work in production.

Quick reference

checkout
https://app.skypay.dev/checkout
verify
GET https://app.skypay.dev/api/v1/checkout/payments-verify/{code}
fulfill when
data.status === "complete"

Human-readable guide: Integration, Verification

integration_prompt.txt
Integrate SkyPay payments into this project.

SkyPay is Nepal's developer-first payment aggregator — one checkout for eSewa, Khalti, and bank transfers, with a single server-side verification API.

## Credential
- API Key: YOUR_API_KEY
  - Verify API: HTTP header `Key: YOUR_API_KEY` (or `X-API-Key`)
  - Checkout links: use a signed short-lived `ck` token from the merchant dashboard (Generate payment link / API). Do NOT put the raw API key in the URL.
- If the merchant does not have a key yet: sign up at https://app.skypay.dev/signup (or log in at https://app.skypay.dev/signin) → Developers → API Keys

## URLs
- App / dashboard: https://app.skypay.dev
- Checkout (redirect customer here): https://app.skypay.dev/checkout
- Verify API (backend only): https://app.skypay.dev/api/v1/checkout/payments-verify/{code}

## Flow
1. Generate a unique `code` per payment (order/invoice ID).
2. Create a checkout URL from the dashboard or API (includes signed `ck` token), e.g.:
   `https://app.skypay.dev/checkout?ck={CHECKOUT_TOKEN}&amount={NPR}&code={code}&success_url={url}&failure_url={url}`
3. Customer pays on SkyPay (provider depends on merchant dashboard config).
4. Customer may return to success_url or failure_url (browser only — not guaranteed for Manual Mode).
   - success_url may include query params — do NOT fulfill from this alone.
   - For Manual Mode, confirm is often delayed; fulfill from payment.completed webhook + verify.
     See: https://skypay.dev/guides/manual-mode
5. Before fulfillment, verify server-side:
   `GET https://app.skypay.dev/api/v1/checkout/payments-verify/{code}`
   Header: `Key: YOUR_API_KEY`
6. Fulfill only when `response.data.status === "complete"`.

## Status values
| status | meaning |
|--------|---------|
| complete | Paid — safe to fulfill |
| pending | Session open, payment not finished |
| waiting | Manual transfer marked paid, awaiting review |
| cancelled | User cancelled or session expired |
| failed | Provider validation failed |
| invalid | Technical error or data mismatch |

## Example verify (JavaScript)
```js
const res = await fetch(
  `https://app.skypay.dev/api/v1/checkout/payments-verify/${orderCode}`,
  { headers: { Key: 'YOUR_API_KEY' } }
);
const { data } = await res.json();
if (data?.status === 'complete') {
  // fulfill order
}
```

## Rules
- Keep the API key server-side (env var). Never commit it or put it in checkout URLs.
- Always verify from the backend before delivering goods, access, or order confirmation.
- Checkout sessions expire after a short window.
- Use HTTPS redirect URLs in production.

## Task
Implement SkyPay checkout redirect + server-side verification in this codebase. Match the project's existing stack, patterns, and file structure. Use an environment variable for the API key in production.