Solana API Reference
This document provides a comprehensive reference for WhiskyPay’s Solana payment integration.SDK Components
createSession
Creates a new payment session.Parameters
| Parameter | Type | Description |
|---|---|---|
saasId | string | Your merchant ID from the dashboard |
email | string | Customer’s email address |
plan | string | Plan identifier for the purchase |
Returns
A session ID string that you’ll use with the PaymentModal.Example
PaymentModal
React component for displaying the payment UI.Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
sessionId | string | Yes | - | Session ID from createSession |
RPC_URL | string | Yes | - | Solana RPC URL |
onRedirect | function | No | undefined | Callback when payment completes |
theme | object | No | undefined | Custom styling options |
desiredToken | string | No | undefined | Preferred token (USDC, SOL, etc.) |
showCloseButton | boolean | No | false | Allow users to close the modal |
onClose | function | No | undefined | Callback when modal is closed |
ThemeOptions
| Property | Type | Description |
|---|---|---|
colorPrimary | string | Primary color for buttons and accents |
colorBackground | string | Background color |
colorText | string | Text color |
borderRadius | string | Border radius for buttons and panels |
fontFamily | string | Font family |
Example
getSessionDetails
Retrieves details about a payment session.Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID to retrieve |
Returns: SessionDetails
| Property | Type | Description |
|---|---|---|
id | string | Session ID |
status | string | Session status (pending, completed, expired) |
email | string | Customer email |
planId | string | Plan identifier |
amount | number | Payment amount |
currency | string | Currency code |
createdAt | string | Creation timestamp |
expiresAt | string | Expiration timestamp |
Example
checkPaymentStatus
Checks the status of a payment.Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID to check |
Returns: PaymentStatusResponse
| Property | Type | Description |
|---|---|---|
status | PaymentStatus | Payment status enum |
message | string | Status message |
signature | string | Transaction signature (if completed) |
PaymentStatus Enum
Example
verifyPayment
Verifies a payment on-chain.Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID to verify |
signature | string | Transaction signature |
RPC_URL | string | Solana RPC URL |
Returns: VerificationResult
| Property | Type | Description |
|---|---|---|
verified | boolean | Whether payment is verified |
details | object | Transaction details |
Example
REST API Endpoints
These endpoints are available for server-side operations.POST /api/v1/sessions
Creates a new payment session.Request Body
Headers
| Header | Value | Description |
|---|---|---|
Content-Type | application/json | JSON content type |
Authorization | Bearer YOUR_API_KEY | API key authentication |
Response
GET /api/v1/sessions/:sessionId
Retrieves details about a payment session.Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID to retrieve |
Headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer YOUR_API_KEY | API key authentication |
Response
GET /api/v1/payments/:sessionId/status
Checks the status of a payment.Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID to check |
Headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer YOUR_API_KEY | API key authentication |
Response
POST /api/v1/payments/verify
Verifies a payment on-chain.Request Body
Headers
| Header | Value | Description |
|---|---|---|
Content-Type | application/json | JSON content type |
Authorization | Bearer YOUR_API_KEY | API key authentication |
Response
Webhook Events
WhiskyPay sends webhook notifications for payment status changes.Payment Completed
Payment Failed
Signature Verification
Verify webhook signatures to ensure authenticity:Error Handling
WhiskyPay API uses standard HTTP status codes and error responses.Error Response Format
Common Error Codes
| Code | Status | Description |
|---|---|---|
invalid_session | 404 | Session not found or expired |
invalid_parameters | 400 | Invalid request parameters |
authentication_error | 401 | Invalid API key |
rate_limit_exceeded | 429 | Too many requests |
internal_error | 500 | Server-side error |
Token Support
WhiskyPay supports the following Solana tokens:| Symbol | Name | Decimals | Token Type |
|---|---|---|---|
SOL | Solana | 9 | Native |
USDC | USD Coin | 6 | SPL |
USDT | Tether | 6 | SPL |
BONK | Bonk | 5 | SPL |
JUP | Jupiter | 6 | SPL |
RAY | Raydium | 6 | SPL |
Best Practices
Security
- Use HTTPS: Always use secure connections
- Validate Signatures: Verify webhook signatures
- Store API Keys Securely: Use environment variables
- Verify Transactions: Always verify payments on-chain
Performance
- Connection Pooling: Reuse HTTP connections
- Caching: Cache token prices and session data
- Background Processing: Handle webhooks asynchronously
Error Handling
- Retry Logic: Implement exponential backoff for failed API calls
- Monitoring: Set up alerts for failed payments
- Logging: Log all API interactions for debugging
Rate Limits
The WhiskyPay API has the following rate limits:- Session Creation: 60 requests per minute
- Session Status: 120 requests per minute
- Payment Verification: 60 requests per minute
Support and Troubleshooting
For issues with the API, contact support at support@whiskypeak.com with:- Your merchant ID
- The session ID(s) in question
- Error messages received
- Steps to reproduce the issue
- “Invalid API Key”: Verify your API key in dashboard settings
- “Session Not Found”: Check if the session has expired
- “Payment Failed”: Verify the user has sufficient balance