Quickstart

Get a working BNPL checkout running in under 5 minutes. This guide walks you through installation, initialization, and opening your first checkout.

Prerequisites

  • A CoverPay account — sign up here
  • A test API key (starts with cp_test_)
  • Node.js 18+ (for Web/React) or Xcode 15+ (for iOS)

1Install

bash
npm install @coverpay/sdk

2Initialize

Create a CoverPay instance with your client ID and environment.

JavaScript
import { CoverPay } from '@coverpay/sdk';

const coverpay = CoverPay.create({
  clientId: 'cp_test_your_client_id',
  environment: 'sandbox',
});

3Open Checkout

Open the CoverPay Link modal and handle the result.

JavaScript
const result = await coverpay.open({
  amount: 9999,        // Amount in cents ($99.99)
  merchantName: 'Your Store',
  customerEmail: 'user@example.com',
});

if (result.success) {
  console.log('Provider:', result.provider);    // "klarna"
  console.log('Token:', result.paymentToken);   // "pt_..."
}

4Complete the Order

Send the payment token to your server to finalize the order. The token is a one-time-use credential that represents the customer's BNPL authorization.

JavaScript
// On your server — verify the payment token
const response = await fetch('https://api.yourstore.com/orders', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    paymentToken: result.paymentToken,
    provider: result.provider,
    orderId: 'order_123',
  }),
});
i
Sandbox Mode
All cp_test_ keys use the sandbox environment. No real charges are made. Providers return simulated approvals. See the Sandbox guide for test credentials and simulated scenarios.

Next Steps