Integrating Alipay’s New Transfer Interface with Java Spring Boot

This guide explains how to replace the legacy Alipay transfer API with the new alipay.fund.trans.uni.transfer interface by upgrading the SDK, configuring certificates, adding Maven dependencies, and implementing Spring components and utility classes for secure backend payment processing.

Architecture Digest
Architecture Digest
Architecture Digest
Integrating Alipay’s New Transfer Interface with Java Spring Boot

Alipay has released a new transfer interface alipay.fund.trans.uni.transfer that replaces the old alipay.fund.trans.toaccount.transfer and uses certificate verification for higher security.

To use the new API you need to upgrade the Alipay SDK to version 4.10.97, place the three certificates downloaded from the Alipay Open Platform under the resources directory, and configure the alipay.properties file with your appId, serverUrl, privateKey, format, charset, signType, 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, @ConfigurationProperties(prefix="alipay") and @PropertySource("classpath:/production/alipay.properties") to load the properties.

Define a configuration class AliConfig that builds a CertAlipayRequest using the certificates, sets proxy information for production, staging, or test environments, and returns a DefaultAlipayClient bean.

Implement a utility class AliPayUtils with methods for trade query, app payment, and the new transfer operation. The transfer method constructs an AlipayFundTransUniTransferRequest with a BizContentForUniTransfer object, sets product code, biz scene, order title, payee info, and executes the request via certificateExecute.

Define data classes TransferParams, BizContentForUniTransfer, and Participant to hold transfer parameters such as appId, createdBy, outBizNo, payeeType, payeeAccount, amount, payerShowName, payeeRealName, remark, and certificate information.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaSDKIntegrationspringAlipay
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.