Skip to main content

What is the Prava SDK?

The Prava SDK provides a simple, secure interface for AI agents and applications to handle payments on behalf of users. It abstracts the complexity of card tokenization, intent management, FIDO authentication, and checkout execution.

Key Features

  • Zero PCI Scope: Card data never touches your servers
  • Intent-Based Permissions: Users authorize specific purchases via Passkey
  • Network-Level Security: Merchant-specific, amount-scoped credentials
  • Browser Automation Ready: Built-in checkout execution helpers

Installation

npm install @prava/sdk-core

Quick Start

1

Initialize the SDK

Import and configure the SDK with your publishable key:
import { PravaSDK } from '@prava/sdk-core';

const prava = new PravaSDK({
  publishableKey: 'pk_sandbox_your_key_here',
  environment: 'sandbox' // or 'production'
});
2

Create a session on your backend

Sessions are created server-side with your secret key:
// Your backend
const response = await fetch('https://api.prava.space/v1/sessions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_sandbox_your_secret_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    user_id: 'user_123',
    user_email: 'user@example.com',
    flow_type: 'onboarding'
  })
});

const { session_token } = await response.json();
3

Collect card details

Use the SDK to securely collect and tokenize card data:
const result = await prava.collectPAN({
  sessionToken: session_token,
  container: '#card-form',
  onSuccess: (data) => {
    console.log('Card enrolled:', data.last4);
  },
  onError: (error) => {
    console.error('Enrollment failed:', error);
  }
});

SDK Architecture

Authentication

The SDK uses a dual-key system:
Key TypeUsageLocation
Publishable Key (pk_*)Initialize SDK, client-side operationsFrontend
Secret Key (sk_*)Create sessions, server operationsBackend only
Never expose your secret key in client-side code or version control.

Next Steps

Support