Skip to content

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 NameTypeMaximum LengthMandatoryDescription
mchNoString30YMerchant number
mchOrderNoString64YMerchant order number (unique)
currencyString10YOrder currency, optional values: USDT, USDC (refer to CurrencyTypeEnum)
networkString30YNetwork, optional values: Tron, Solana, Ethereum, Polygon, Arbitrum, Binance_smart_chain (refer to ChainTypeEnum)
amountBigDecimalLength 20, 6 decimal placesYOrder amount
mchUserIdString32YUser ID on the merchant side
goodsGoods Type-YProduct description
appIdString64YApplication ID, assigned when creating an application on the merchant platform
notifyUrlString256NAsynchronous notification address (order status callback) [Can be configured in the merchant backend application]
successUrlString256NJump page after success (merchant side) [Can be configured in the merchant backend application]
failUrlString256NJump page after failure (merchant side) [Can be configured in the merchant backend application]
priKeyString-YMerchant private key
bizCodeInteger-NChannel 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 NameTypeMaximum LengthMandatoryDescription
appIdString64YApplication ID, created in the merchant backend
mchNoString30YMerchant number
signTypeString10YSignature type: RSA2 by default
payOrderIdString30At least one of payOrderId and mchOrderNo must be passedPayment order ID
mchOrderNoString64At least one of payOrderId and mchOrderNo must be passedMerchant 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());