Monero API Reference
This document provides a comprehensive reference for the Monero payment integration in WhiskyPay.MoneroPaymentComponent
React component for accepting Monero payments.Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
gatewayUrl | string | Yes | - | URL of the Monero payment gateway |
apiKey | string | No | undefined | API key for authentication |
amount | number | Yes | - | Payment amount in XMR |
description | string | No | undefined | Payment description |
refund | string | No | undefined | Refund address |
onPaymentComplete | function | No | undefined | Callback when payment succeeds |
onPaymentError | function | No | undefined | Callback when payment fails |
onPaymentStarted | function | No | undefined | Callback when payment begins |
checkInterval | number | No | 10000 | Interval to check payment status (ms) |
darkMode | boolean | No | false | Enable dark mode styling |
Usage Example
MoneroPayment Class
Core class for programmatic Monero payment handling.Constructor
MoneroPaymentConfig
| Property | Type | Required | Description |
|---|---|---|---|
gatewayUrl | string | Yes | URL of the payment gateway |
apiKey | string | No | Optional API key for authentication |
Methods
createInvoice
Creates a new Monero invoice.CreateInvoiceOptions
| Property | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount in XMR |
description | string | No | Invoice description |
refund | string | No | Refund address |
Returns
| Property | Type | Description |
|---|---|---|
id | string | Invoice ID |
address | string | Payment address |
checkInvoice
Checks the status of an invoice.Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Invoice ID to check |
Returns: InvoiceInfo
| Property | Type | Description |
|---|---|---|
status | string | ’Pending’, ‘Confirming’, ‘Received’, or ‘Expired’ |
amount | string | Invoice amount in XMR |
address | string | Payment address |
refund | string | Refund address (if provided) |
expiry | string | Expiry timestamp |
description | string | Invoice description (if provided) |
isPaymentComplete
Checks if a payment has been completed.Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Invoice ID to check |
Returns
Boolean indicating if payment is complete.waitForPayment
Waits for a payment to complete with a timeout.Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | - | Invoice ID to check |
timeoutMs | number | 30 minutes | Timeout in milliseconds |
checkIntervalMs | number | 10 seconds | Check interval in milliseconds |
Gateway API Endpoints
These endpoints are exposed by the Monero payment gateway.POST /api/monero/new
Creates a new Monero invoice.Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount in XMR |
description | string | No | Invoice description |
refund | string | No | Refund address |
Response
GET /api/monero/info
Gets information about an existing invoice.Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Invoice ID |
Response
Webhook Events
When a payment status changes, a webhook notification is sent to your configured endpoint.Webhook Payload
Signature Verification
Always verify webhook signatures to prevent fraud:Error Handling
The Monero SDK and API will return standard error responses with appropriate HTTP status codes and error messages. Common errors include:400 Bad Request: Invalid parameters401 Unauthorized: Missing or invalid API key404 Not Found: Invoice not found500 Internal Server Error: Server-side error
Security Best Practices
API Key Protection
Store your API key securely:Address Validation
Always validate Monero addresses:Testing
Testing Payments
For testing, you can:- Use the Monero testnet instead of mainnet
- Set up a development gateway with lower confirmation requirements
- Use small amounts (0.001 XMR) for testing
Mocking Payments
For development, you can mock payment responses:Rate Limits
The Monero payment API has the following rate limits:- Create Invoice: 10 requests per minute
- Check Invoice: 60 requests per minute
- Webhook Delivery: Maximum 3 retry attempts
Support and Troubleshooting
For issues with the Monero integration, contact support at support@whiskypeak.com with:- Your merchant ID
- The invoice ID(s) in question
- Error messages received
- Steps to reproduce the issue
- “Invalid API Key”: Verify your API key in dashboard settings
- “Invoice Not Found”: Check the invoice ID format (16 characters)
- “Gateway Unreachable”: Ensure your server can reach the gateway URL
- “Payment Not Detected”: The Monero network may be experiencing delays