Client SDK

React payment widget with Phantom wallet integration for seamless Solana payments

Installation

Install the Aurion Client SDK via npm or yarn:

npm install @aurion/client-sdk
# or
yarn add @aurion/client-sdk
Note: The SDK requires React 19.2.0 or higher as a peer dependency. No CSS import is needed: the SDK adds its (scoped) stylesheet on initialize.

Quick Start

Get up and running with Aurion payments in just a few lines of code:

1. Initialize the SDK

import { Aurion } from '@aurion/client-sdk';

// Initialize with your public key
Aurion.initialize({
  publicKey: 'your-public-key-here'
});

2. Open the Checkout

// Trigger the payment checkout
Aurion.instantCheckout({
  transactionId: 'your-transaction-id',
  onSuccess: () => {
    console.log('Payment successful!');
  },
  onError: (code, details) => {
    console.error('Payment failed:', code, details?.message);
  }
});

Complete Example

import React, { useEffect } from 'react';
import { Aurion } from '@aurion/client-sdk';

function App() {
  useEffect(() => {
    Aurion.initialize({
      publicKey: 'pk_your-public-key'
    });
  }, []);

  const handlePayment = () => {
    Aurion.instantCheckout({
      transactionId: 'txn_123456',
      isModal: true,
      enablePayViaLink: true,
      onSuccess: () => alert('Payment successful!'),
      onError: (code, details) => alert('Payment failed: ' + (details?.message ?? code)),
      onClose: () => console.log('Checkout closed'),
      onConnected: (wallet) => console.log('Wallet connected:', wallet)
    });
  };

  return (
    <button onClick={handlePayment}>
      Pay with Crypto
    </button>
  );
}

API Reference

Aurion.initialize(config)

Initialize the Aurion SDK with your configuration.

Parameters

ParameterTypeRequiredDescription
publicKeystringRequiredYour Aurion public API key
containerIdstringOptionalCustom container ID for the SDK (default: "aurion:root")
productionbooleanOptionalUse the production API and Solana mainnet (default: true). false uses the dev API and devnet.
onError(error: AurionError) => voidOptionalCalled for every SDK error, including ones the user can retry in the widget.
debugbooleanOptionalLog full error details to the console (default: false).
rpcEndpointsstring[]OptionalSolana RPC endpoints in order of preference; the SDK fails over to the next when one is down. Pass a dedicated provider in production.
injectStylesbooleanOptionalInject the SDK stylesheet automatically (default: true).
styleNoncestringOptionalCSP nonce for the injected <style> tag.

Aurion.instantCheckout(options)

Open the payment checkout interface.

Parameters

ParameterTypeRequiredDescription
transactionIdstringRequiredTransaction ID from payment initialization
theme'light' | 'dark'OptionalAccepted for compatibility; currently has no effect (the widget uses its dark theme).
isModalbooleanOptionalDisplay as a modal overlay, or a drawer on mobile (default: false, renders inline).
enablePayViaLinkbooleanOptionalEnable pay via link option (default: false)
onSuccess() => voidOptionalCallback when payment succeeds
onError(code: string, details?: AurionError) => voidOptionalCalled when the checkout ends on an error screen. code is the screen code (e.g. 'TransactionNotFound'); details is the underlying error.
onClose() => voidOptionalCallback when checkout is closed
locale'en' | 'de' | 'es' | 'fr' | 'pt' | 'ar'OptionalWidget language (default: 'en').
onConnected(wallet: ConnectedWallet) => voidOptionalCallback when wallet is connected

Error Handling

Every SDK error is an AurionError with a code, a user-facing message, and retryable. Temporary failures (network, timeouts, 5xx) are retried automatically, and error screens offer Try again when it can help.

import { Aurion, isAurionError } from '@aurion/client-sdk';

Aurion.initialize({
  publicKey: 'pk_your-public-key',
  debug: process.env.NODE_ENV !== 'production',
  onError: (error) => {
    // e.g. NETWORK_ERROR, WALLET_REJECTED, PAYMENT_EXPIRED
    analytics.track('aurion_error', { code: error.code, retryable: error.retryable });
  },
});

Codes: INVALID_CONFIG, NOT_INITIALIZED, NETWORK_ERROR, TIMEOUT, UNAUTHORIZED, ACCESS_DENIED, NOT_FOUND, RATE_LIMITED, SERVER_ERROR, API_ERROR, INVALID_RESPONSE, PAYMENT_NOT_PENDING, PAYMENT_NOT_CONFIRMED, PAYMENT_EXPIRED, PAYMENT_FAILED, WALLET_NOT_CONNECTED, WALLET_REJECTED, WALLET_ERROR, INSUFFICIENT_FUNDS, TOKEN_ACCOUNT_NOT_FOUND, BLOCKHASH_EXPIRED, TRANSACTION_FAILED, ALREADY_PROCESSED, RPC_UNAVAILABLE, REQUEST_CANCELLED, UNKNOWN.

Styling

The SDK injects its stylesheet once on initialize. It is scoped to the widget, so your page's styles are not changed. To load it yourself (for example under a strict CSP without a nonce), import @aurion/client-sdk/style.css and pass injectStyles: false.

Features

🦊 Phantom Wallet

Built-in Phantom wallet integration with automatic detection and one-click connect.

🎨 Theme Support

Light and dark themes with customizable styling via CSS variables.

📱 Responsive Design

Works seamlessly on desktop, tablet, and mobile devices.

🔗 Pay via Link

Generate shareable payment links for users without wallets.

📊 QR Codes

Automatic QR code generation for mobile wallet payments.

âš¡ Real-time Status

Live transaction status updates and confirmations.

Next Steps