React payment widget with Phantom wallet integration for seamless Solana payments
Install the Aurion Client SDK via npm or yarn:
npm install @aurion/client-sdk
# or
yarn add @aurion/client-sdkinitialize.Get up and running with Aurion payments in just a few lines of code:
import { Aurion } from '@aurion/client-sdk';
// Initialize with your public key
Aurion.initialize({
publicKey: 'your-public-key-here'
});// 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);
}
});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>
);
}Initialize the Aurion SDK with your configuration.
| Parameter | Type | Required | Description |
|---|---|---|---|
publicKey | string | Required | Your Aurion public API key |
containerId | string | Optional | Custom container ID for the SDK (default: "aurion:root") |
production | boolean | Optional | Use the production API and Solana mainnet (default: true). false uses the dev API and devnet. |
onError | (error: AurionError) => void | Optional | Called for every SDK error, including ones the user can retry in the widget. |
debug | boolean | Optional | Log full error details to the console (default: false). |
rpcEndpoints | string[] | Optional | Solana RPC endpoints in order of preference; the SDK fails over to the next when one is down. Pass a dedicated provider in production. |
injectStyles | boolean | Optional | Inject the SDK stylesheet automatically (default: true). |
styleNonce | string | Optional | CSP nonce for the injected <style> tag. |
Open the payment checkout interface.
| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId | string | Required | Transaction ID from payment initialization |
theme | 'light' | 'dark' | Optional | Accepted for compatibility; currently has no effect (the widget uses its dark theme). |
isModal | boolean | Optional | Display as a modal overlay, or a drawer on mobile (default: false, renders inline). |
enablePayViaLink | boolean | Optional | Enable pay via link option (default: false) |
onSuccess | () => void | Optional | Callback when payment succeeds |
onError | (code: string, details?: AurionError) => void | Optional | Called when the checkout ends on an error screen. code is the screen code (e.g. 'TransactionNotFound'); details is the underlying error. |
onClose | () => void | Optional | Callback when checkout is closed |
locale | 'en' | 'de' | 'es' | 'fr' | 'pt' | 'ar' | Optional | Widget language (default: 'en'). |
onConnected | (wallet: ConnectedWallet) => void | Optional | Callback when wallet is connected |
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.
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.
Built-in Phantom wallet integration with automatic detection and one-click connect.
Light and dark themes with customizable styling via CSS variables.
Works seamlessly on desktop, tablet, and mobile devices.
Generate shareable payment links for users without wallets.
Automatic QR code generation for mobile wallet payments.
Live transaction status updates and confirmations.