KuvarPay API
Home
Home
  1. Home
  • Overview
  • SDK Integration Guide
  • Webhooks Integration Guide
  • Subscriptions Guide
  • Transactions
    • Calculate Payment Amount
      POST
    • Create Transaction
      POST
    • Get Transactions Details
      GET
    • Get Transactions
      GET
  • Checkout Sessions
    • Create Checkout Session
      POST
    • Get Checkout Session
      GET
  • Transfer Fees
    • /api/v1/optimal-transfer-fee
      GET
  • Sandbox Simulator
    • Force Simulator Scenario
      POST
    • Force Transaction Status
      POST
  • Invoices
    • Create a new invoice
      POST
    • Send invoice email to customer
      POST
  • Payment Links
    • Create a new payment link
      POST
  • Server-Sent Events (SSE)
    • Get Transaction Details
      GET
    • Get Session Details
      GET
  • Subscriptions
    • Create Plans
      POST
    • Get Plans
      GET
    • Get Plans Details
      GET
    • Update Plans Details
      PATCH
    • Create Prices
      POST
    • Get Prices
      GET
    • Update Prices Details
      PATCH
    • Create Checkout Sessions
      POST
    • Get Checkout Sessions Details
      GET
    • Confirm Subscription Checkout
      POST
    • Create Subscriptions
      POST
    • Get Subscriptions
      GET
    • Get Subscriptions Details
      GET
    • Update Subscriptions Details
      PATCH
    • Delete Subscriptions Details
      DELETE
    • Renew Subscription
      POST
    • Confirm Subscription Cancellation
      POST
    • Create Subscription Invoices
      POST
    • Upgrade Subscription
      POST
    • Get Subscription Invoices
      GET
    • Downgrade Subscription
      POST
    • Renew Subscription Authorization
      POST
    • Create Metered Invoices
      POST
    • Get Subscription Invoices Details
      GET
    • Get Charge Attempts
      GET
    • Create Authorizations
      POST
    • Revoke Relay Authorization
      POST
    • Get Relay Authorization Status
      GET
  • Currencies
    • Get Subscription Currencies
    • Get Supported Currencies
    • Get networks supported for subscription payments
    • Get Currencies
    • Get all supported networks
  • Schemas
    • ErrorResponse
    • CreateInvoiceRequest
    • CreatePaymentLinkRequest
    • InvoiceResponse
    • PaymentLinkResponse
    • CreateInvoiceResponse
    • CreatePaymentLinkResponse
    • SendInvoiceEmailRequest
    • SendInvoiceEmailResponse
    • SubscriptionInvoice
Home
Home
  1. Home

SDK Integration Guide

KuvarPay Web SDK Integration Guide#

This guide shows how to embed KuvarPay’s checkout modal on your website using the Web SDK. It lets your customers pay in crypto while you receive fiat payouts.

Overview#

One line to include the SDK script
Initialize once with your publishable API key and business ID
Call KuvarPay.openPayment(...) to launch the modal
Handle onSuccess, onCancel, and onError callbacks
Built-in idempotency for safe retries

1) Include the SDK Script#

2) Initialize the SDK#

Call KuvarPay.init as early as possible (e.g., on page load):
Notes:
Use your client API key intended for client-side usage.
baseUrl is REQUIRED. Set it to KuvarPay Pay frontend host.
Production: https://pay.kuvarpay.com
Local testing (recommended): still use https://pay.kuvarpay.com

3) Open the Payment Modal#

Trigger the modal when the customer clicks a button or when your flow requires payment.
Attach startCheckout() to your checkout button:

4) How It Works Under the Hood#

The SDK creates a Checkout Session by calling your KuvarPay payment server (/api/checkout/create-session).
It sets and manages an idempotency key so repeated clicks or retries won’t create duplicate sessions.
It embeds the secure checkout in a modal (iframe) and communicates using postMessage for success/cancel events.

5) Options and Callbacks#

options.theme: 'light' | 'dark' (default 'light').
callbacks.onSuccess(sessionId): invoked when the payment session completes successfully.
callbacks.onCancel(): invoked when the user closes/cancels the modal.
callbacks.onError(error): invoked on network/validation failures.

6) Security Notes#

Use only your publishable (client) API key on the frontend.
Keep secret keys on your server. Never embed secret keys in client code.

7) Troubleshooting#

If the modal doesn’t open, ensure KuvarPay.init ran without errors (check console if debug: true).
Verify your amount and currency are valid and within min/max limits configured on your KuvarPay account.
For local testing, ensure the payment server is reachable from the browser (CORS, correct host/port).
Modified at 2025-09-15 18:10:57
Previous
Overview
Next
Webhooks Integration Guide
Built with