Skip to main content
Integrate crypto payments into your Spring Boot application using the official XPayLabs Java SDK (xpay-java-sdk). The SDK provides a comprehensive client for collection orders, payouts, webhook handling, and balance management with HMAC-SHA256 signing handled automatically.

Installation

Add the Maven dependency to your pom.xml:
For Gradle:

Configuration

Configure the SDK with your merchant token and API secret:
PropertyRequiredDescription
apiKeyYesMerchant token
apiSecretYesAPI secret for HMAC signing
baseUrlNoGateway base URL (default: https://api.xpaylabs.com; override for self-hosted deployments)
connectTimeoutNoConnection timeout in ms (default: 30000)
readTimeoutNoRead timeout in ms (default: 30000)

Core API Methods

Create a Collection Order

Create a Payout

Query Order Status

Get Supported Symbols

Get Merchant Balance

Get Deposit Address for a User

Handling Webhooks

The SDK provides built-in webhook signature verification and event parsing. Set up a controller to receive webhook callbacks:

Error Handling

The SDK throws XPayApiException for API errors:

Full Example

See the XPayExample.java class in the SDK repository for a complete example covering all API operations.
The SDK uses HMAC-SHA256 for request signing. The XPay class handles this automatically — you only need to pass the request objects and it manages the sign, timestamp, and nonce fields internally.
Last modified on June 26, 2026