A React SDK for integrating cryptocurrency payments on the Solana blockchain.
npm install whisky-pay/whisky-pay-sdk- Easy integration with React applications
- Multiple token support (SOL, USDC, JUP, BONK, USDT)
- Token swaps via Jupiter API
- Session-based payment flow
- Built-in payment modal UI component
- Automatic API URL detection (works across different environments)
import { createSession } from '@whisky-pay/whisky-pay-sdk';
// Create a payment session
const sessionId = await createSession(
"your-merchant-id", // Your merchant/application ID
"customer@example.com", // Customer email
"premium-plan" // Plan identifier
// The API URL is auto-detected from your application
);
// Or specify a custom API URL
const sessionIdWithCustomApi = await createSession(
"your-merchant-id",
"customer@example.com",
"premium-plan",
"https://your-custom-api.com" // Optional custom API URL
);import { PaymentModal } from '@whisky-pay/whisky-pay-sdk';
function CheckoutPage() {
// After creating a session
return (
<PaymentModal
sessionId={sessionId}
RPC_URL="https://api.mainnet-beta.solana.com"
onRedirect={() => {
// Handle payment completion/cancellation
window.location.href = '/thank-you';
}}
/>
);
}import { verifyPayment } from '@whisky-pay/whisky-pay-sdk';
// Verify a transaction (API URL is auto-detected)
const isValid = await verifyPayment(
sessionId,
transactionSignature,
userPublicKey
);
// Or specify a custom API URL
const isValidWithCustomApi = await verifyPayment(
sessionId,
transactionSignature,
userPublicKey,
"https://your-custom-api.com" // Optional custom API URL
);- React 18+
- Solana wallet adapter (compatible with Phantom, Solflare, etc.)
- Modern browser with Web3 support
- Clone the repository
- Install dependencies:
npm install - Build the SDK:
npm run build
ISC