Appearance
AurellixPay SDK
Update Time: 2025-08-06 15:37:30
Introduction
Welcome to the AurellixPay Payment Cashier SDK!
It is suitable for Java language and development environments with JDK version 1.8 and above.
To help you efficiently integrate payment cashier capabilities, this document focuses on the "simplest process": you can quickly complete the integration of payment functions through 3 steps: initialization configuration → calling the cashier → processing result callbacks.
SDK Coordinates
Import the dependency coordinates in pom.xml and refresh Maven.
- xml
<dependency> <groupId>io.gitee.hexbit</groupId> <artifactId>hexpay-sdk-java</artifactId> <version>1.0.13</version> </dependency>
Specified environment:AurellixPay.overrideApiBase(baseUrl);
SDK Usage Examples
1. Create a Transaction Order
Function description: Merchants send order information to create a transaction order and return a cashier URL containing payOrderId.
Business Request Parameters
| Field Name | Type | Maximum Length | Mandatory | Description |
|---|---|---|---|---|
| mchNo | String | 30 | Y | Merchant number |
| mchOrderNo | String | 64 | Y | Merchant order number (unique) |
| currency | String | 10 | Y | Order currency, optional values: USDT, USDC (refer to CurrencyTypeEnum) |
| network | String | 30 | Y | Network, optional values: Tron, Solana, Ethereum, Polygon, Arbitrum, Binance_smart_chain (refer to ChainTypeEnum) |
| amount | BigDecimal | Length 20, 6 decimal places | Y | Order amount |
| mchUserId | String | 32 | Y | User ID on the merchant side |
| goods | Goods Type | - | Y | Product description |
| appId | String | 64 | Y | Application ID, assigned when creating an application on the merchant platform |
| notifyUrl | String | 256 | N | Asynchronous notification address (order status callback) [Can be configured in the merchant backend application] |
| successUrl | String | 256 | N | Jump page after success (merchant side) [Can be configured in the merchant backend application] |
| failUrl | String | 256 | N | Jump page after failure (merchant side) [Can be configured in the merchant backend application] |
| priKey | String | - | Y | Merchant private key |
| bizCode | Integer | - | N | Channel number, do not pass if unsure, it will be automatically adapted by the interface |
Sample Code
java
public class HexPayCreateTrade {
public static void main(String[] args) {
// Initialize SDK: pass in the appId created in hexpay and the priKey (merchant private key) generated by sign-generator
HexpayClient hexpayClient = HexpayClient.getInstance(Hexpay.appId, Hexpay.priKey);
// Construct request parameters to call the interface
PayOrderCreateRequest request = new PayOrderCreateRequest();
PayOrderCreateReqModel model = new PayOrderCreateReqModel();
// Business type (0 - stablecoin payment, 1 - fiat currency payment)
model.setBizCode(0);
// Set merchant number
model.setMchNo(Hexpay.mchNo);
// Set application ID
model.setAppId(Hexpay.appId);
// Set order currency
model.setCurrency("USDC");
// Set merchant order number
model.setMchOrderNo("47382118895");
// Set total order amount
model.setAmount(3l);
// Set network
model.setNetwork("Tron");
// Set user ID
model.setMchUserId("134673");
// Set product information
Goods goods = new Goods();
goods.setGoodsName("t-shirt");
goods.setGoodsType("A sleek, breathable cotton t-shirt with a classic fit, perfect for everyday comfort and effortless style.");
goods.setGoodsDetail("shop");
model.setGoods(goods);
request.setBizModel(model);
try {
PayOrderCreateResponse response = hexpayClient.execute(request);
_log.info("response:{}", response);
_log.info("getData():{}", response.getData());
} catch (HexpayException e) {
_log.error(e.getMessage());
}
}
}2. Query Order Status
Function description: Query the order status based on [payment order number/merchant order number] (at least one must be passed).
Business Request Parameters
| Field Name | Type | Maximum Length | Mandatory | Description |
|---|---|---|---|---|
| appId | String | 64 | Y | Application ID, created in the merchant backend |
| mchNo | String | 30 | Y | Merchant number |
| signType | String | 10 | Y | Signature type: RSA2 by default |
| payOrderId | String | 30 | At least one of payOrderId and mchOrderNo must be passed | Payment order ID |
| mchOrderNo | String | 64 | At least one of payOrderId and mchOrderNo must be passed | Merchant order number |
Sample Code
java
public class HexPayCreateTrade {
public static void main(String[] args) {
// Initialize SDK: pass in the appId created in hexpay and the priKey (merchant private key) generated by sign-generator
HexpayClient hexpayClient = HexpayClient.getInstance(Hexpay.appId, Hexpay.priKey);
// Construct request parameters to call the interface
PayOrderQueryRequest request = new PayOrderQueryRequest();
PayOrderQueryReqModel model = new PayOrderQueryReqModel();
// Set merchant number
model.setMchNo(Hexpay.mchNo);
// Set application ID
model.setAppId(Hexpay.appId);
// Set merchant order number
model.setMchOrderNo("47382118895");
// Set payment order ID
model.setPayOrderId("P1947931395550150657");
request.setBizModel(model);
// Call
PayOrderQueryResponse response = hexpayClient.execute(request);
_log.info("response.getData():{}", response.getData());
_log.info("response:{}", response);
}
}3. Response Signature Verification
Function description: Use the platform private key to verify the signature of the system's asynchronous callback information.
java
/**
* Signature verification parameters:
* 1. Response parameter jsonObject
* 2. Platform public key Hexpay.PLAT_FORM_PUB_KEY
* 3. Signature value sign
**/
RSA2Utils.verify(jsonObject, Hexpay.PLAT_FORM_PUB_KEY, jsonObject.get("sign").toString());