@whisky-pay/whisky-pay-sdk
v1.0.0
Published
A React SDK for integrating WhiskyPay
Maintainers
Readme
WhiskyPay SDK
A React SDK for integrating cryptocurrency payments on the Solana blockchain.
Installation
npm install whisky-pay/whisky-pay-sdkFeatures
- 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
Usage
1. Create a payment session
import { createSession } from '@whisky-pay/whisky-pay-sdk';
// Create a payment session
const sessionId = await createSession(
"your-merchant-id", // Your merchant/application ID
"[email protected]", // Customer email
"premium-plan" // Plan identifier
);2. Display payment modal
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';
}}
/>
);
}3. Verify payment (optional)
import { verifyPayment } from '@whisky-pay/whisky-pay-sdk';
// Verify a transaction
const isValid = await verifyPayment(
sessionId,
transactionSignature,
userPublicKey
);Requirements
- React 18+
- Solana wallet adapter (compatible with Phantom, Solflare, etc.)
- Modern browser with Web3 support
Development
- Clone the repository
- Install dependencies:
npm install - Build the SDK:
npm run build
License
ISC
