Integrating Alipay’s New Transfer Interface (alipay.fund.trans.uni.transfer) in Java
This article explains how to upgrade to Alipay's new transfer API, configure certificates, add the required Maven dependency, and implement Spring beans and utility classes in Java to securely perform transfers using the latest SDK version.
Alipay has released a new transfer API alipay.fund.trans.uni.transfer that replaces the older alipay.fund.trans.toaccount.transfer and uses certificate‑based signature verification.
To use the new interface you must upgrade the Alipay SDK to version 4.10.97, place the three certificates from the Alipay Open Platform under the resources directory, and configure the alipay.properties file with your app credentials and certificate paths.
Add the Maven dependency:
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.10.97.ALL</version>
</dependency>Create a Spring bean AliPayBean annotated with @Component and @ConfigurationProperties(prefix="alipay") to hold the configuration values.
Define a configuration class AliConfig that builds a DefaultAlipayClient using CertAlipayRequest , loading the certificates either from classpath (local) or via proxy in production, and registers it as a bean named alipayClient .
Implement a utility class AliPayUtils with methods for trade queries, app payments, and the new transfer operation. The transfer method builds a BizContentForUniTransfer object, sets fields such as out_biz_no , trans_amount , product_code , and executes the request with alipayClient.certificateExecute .
Additional data classes TransferParams , BizContentForUniTransfer , and Participant are provided to encapsulate request parameters.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.