Welcome to the WhiskyPay documentation. This guide will help you integrate our crypto payment system into your application with step-by-step instructions.
Before you begin integrating WhiskyPay, ensure you have:
Important: Your merchant wallet must have at least a small amount of USDC already in it for transactions to work properly.
Install the WhiskyPay SDK via npm or yarn:
npm install @whisky-pay/whisky-pay-sdk
yarn add @whisky-pay/whisky-pay-sdk
Import and initialize the WhiskyPay SDK in your application:
import { WhiskyPaySDK } from '@whisky-pay/whisky-pay-sdk'; // Initialize the SDK with your SaaS ID const whiskyPay = new WhiskyPaySDK({ saasId: 'your_saas_id', environment: 'production' // or 'test' }); // Create a payment session const createPayment = async () => { try { const session = await whiskyPay.createSession({ amount: 10.99, currency: 'USDC', customerEmail: 'customer@example.com', metadata: { orderId: '12345', productName: 'Premium Subscription' } }); // Open the payment modal whiskyPay.openPaymentModal(session.id); } catch (error) { console.error('Payment session creation failed:', error); } }
Configure the SDK with these options:
Option | Type | Description | Required |
---|---|---|---|
saasId | String | Your unique SaaS identifier | Yes |
environment | String | 'production' or 'test' | No (defaults to 'test') |
onSuccess | Function | Callback function on successful payment | No |
onCancel | Function | Callback function when user cancels payment | No |
onError | Function | Callback function when payment encounters an error | No |
Configure webhooks in your dashboard to receive real-time payment notifications:
Webhook events include:
payment.succeeded
- When a payment is successfully completedpayment.failed
- When a payment attempt failspayment.refunded
- When a payment is refundedTest your integration thoroughly before going live:
Set environment: 'test'
in your SDK configuration to use the test environment.
In test mode, you can use any USDC-compatible wallet to simulate payments without real transactions.
When you're ready to accept real payments:
environment: 'production'
in your SDK configurationBest Practice: Start with small transactions and gradually scale up as you confirm everything is working correctly.
The SDK provides these key methods:
Creates a new payment session with the specified options.
Parameters:
amount
(Number, required): The payment amountcurrency
(String, required): Currently only 'USDC' is supportedcustomerEmail
(String, optional): Customer's email for receiptsmetadata
(Object, optional): Any additional data for trackingReturns: A Promise that resolves to a session object
Opens the payment modal for the given session.
Parameters:
sessionId
(String, required): The ID of the payment sessionChecks the status of a payment session.
Parameters:
sessionId
(String, required): The ID of the payment sessionReturns: A Promise that resolves to the payment status
WhiskyPay transactions are secured by the Solana blockchain. We never have custody of customer funds - payments go directly from the customer's wallet to your merchant wallet.
Currently, we only support USDC on the Solana blockchain. We plan to add support for more cryptocurrencies in the future.
No, our SDK is designed to be simple and straightforward, even for developers without crypto experience. You just need to ensure your merchant wallet has some USDC balance.
Currently, refunds need to be processed manually from your merchant wallet. We're working on adding automated refund functionality in a future release.
During our proof of concept phase, WhiskyPay does not charge any processing fees beyond the standard Solana network fees, which are typically a fraction of a cent per transaction.
If you have questions or need assistance with your integration, our team is here to help.