Skip to main content

Solana Integration Guide

This guide provides detailed information about integrating Solana-based cryptocurrency payments into your application using WhiskyPay.

Integration Architecture

The Solana payment integration consists of:
  1. WhiskyPay SDK: React components for displaying the payment UI
  2. Payment Gateway: Handles payment processing and verification
  3. Session Management: Manages payment sessions and expirations
  4. Token Swaps: Jupiter integration for accepting any Solana token

Client-Side Integration

Basic Implementation

The simplest way to integrate Solana payments is using the createSession and PaymentModal components:

Advanced Implementation with Custom UI

For more control over the payment flow, you can implement a custom UI:

Server-Side Integration

Setting Up Webhooks

To handle payment notifications, set up a webhook endpoint in your backend:

Payment Status Verification

You can verify payment status server-side using the WhiskyPay API:

Database Schema

A basic schema for storing payments:

Advanced Features

Multi-Currency Support

WhiskyPay supports multiple tokens on Solana. You can specify a preferred token:

Subscription Management

For recurring payments, implement a subscription management system:

Token Price Conversion

To handle price conversion between tokens:

Security Considerations

Securing Your Integration

  1. Verify Webhook Signatures: Always validate webhooks to prevent fraud
  2. Store API Keys Securely: Use environment variables for API keys
  3. Implement Rate Limiting: Prevent abuse of your payment endpoints
  4. Transaction Verification: Always verify transactions on-chain
  5. Double-Spending Protection: Check for duplicate transaction signatures

Protecting User Data

Troubleshooting

Common Issues and Solutions

Debugging Tools

  1. Session Details: Get session information using the API
  2. Transaction Explorer: Use Solana Explorer to check transactions
  3. Gateway Logs: Review logs in the WhiskyPay dashboard

Best Practices

  1. Always Verify Payments: Cross-check webhook notifications with the API
  2. Handle Edge Cases: Implement proper error handling and retries
  3. Test Thoroughly: Test all payment flows before going live
  4. Monitor Transactions: Set up alerts for failed payments
  5. Keep SDK Updated: Regularly update to the latest SDK version

Next Steps