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 publishable SDK client ID for frontend/mobile initialization (for example
cp_client_test_...) - A secret server API key (starts with
cp_test_) for REST calls - Node.js 18+ (for Web/React) or Xcode 15+ (for iOS)
1Install
bash
npm install @coverpay/sdk2Initialize
Create a CoverPay instance with your client ID and environment.
JavaScript
import { CoverPay } from '@coverpay/sdk';
const coverpay = CoverPay.create({
clientId: 'cp_client_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); // "cp_tok_..."
}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
// Client: send token to YOUR server
const response = await fetch('/api/checkout/confirm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
paymentToken: result.paymentToken,
orderId: 'order_123',
}),
});
// Your server then calls:
// POST https://api.coverpayme.com/v1/checkout/confirmi
Sandbox Mode
Use sandbox credentials in test mode: publishable
cp_client_test_... IDs for SDK init and secret cp_test_... keys for server API calls. No real charges are made. Providers return simulated approvals. See the Sandbox guide for test credentials and simulated scenarios.