一.准备工作,单独部署dax-pay

1.仓库地址

1.后端仓库:

dax-pay: DaxPay是一款免费开源的支付系统,支持支付宝、微信、云闪付等通道,提供收单、退款、聚合支付、对账、分账等功能。通过HTTP方式进行调用,不与其他系统产生耦合关联,提供可视化界面进行管理。

2.前端仓库:

dax-pay-ui: 免费开源的支付网关,支持支付宝、微信、云闪付等通道,提供收单、退款、对账、分账等功能,通过HTTP方式进行调用,不与其他系统产生耦合关联,可以快速集成到各种系统中,提供可视化界面进行管理,便于实现统一的支付信息管理。

3.部署后端

后端默认数据库是postgresql数据库,我改成mysql连接了,需要改yml和pom文件换成mysql的

1.prod-yml:(yml使用prod)

这里记得把mysql的信息换成云服务器mysql数据库的东西(sql文件在后端代码的_config文件下面)

2.pom.xml(daxpay-single-server)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.4.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>org.dromara.daxpay</groupId>
    <artifactId>daxpay-single-server</artifactId>
    <packaging>jar</packaging>
    <version>3.0.0.beta5</version>
    <description>daxpay服务端</description>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <java.version>21</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- 三方库 -->
        <mapstruct.version>1.5.5.Final</mapstruct.version>
        <lombok-mapstruct.version>0.2.0</lombok-mapstruct.version>
        <autopoi.version>1.4.8</autopoi.version>
        <easypoi.version>4.5.0</easypoi.version>
        <minio.version>8.5.2</minio.version>

        <bootx-platform.version>3.0.0.beta5</bootx-platform.version>
        <daxpay.version>3.0.0.beta5</daxpay.version>
    </properties>

    <dependencies>
        <!-- lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- lombok 配合 mapstruct -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-mapstruct-binding</artifactId>
            <scope>provided</scope>
            <version>${lombok-mapstruct.version}</version>
        </dependency>

        <!-- 类型转换处理器 -->
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <scope>provided</scope>
            <version>${mapstruct.version}</version>
        </dependency>

        <!-- web框架 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- 数据库驱动 PG -->
<!--        <dependency>-->
<!--            <groupId>org.postgresql</groupId>-->
<!--            <artifactId>postgresql</artifactId>-->
<!--            <scope>runtime</scope>-->
<!--        </dependency>-->

        <!-- 数据库驱动 MySQL -->
                <dependency>
                    <groupId>com.mysql</groupId>
                    <artifactId>mysql-connector-j</artifactId>
                </dependency>

        <!--文件存储 (minio方式)-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>${minio.version}</version>
        </dependency>

        <!-- 支付通道实现 -->
        <!-- 支付宝通道实现 -->
        <dependency>
            <groupId>org.dromara.daxpay</groupId>
            <artifactId>daxpay-single-alipay</artifactId>
            <version>${daxpay.version}</version>
        </dependency>
        <!-- 微信通道实现 -->
        <dependency>
            <groupId>org.dromara.daxpay</groupId>
            <artifactId>daxpay-single-wechat</artifactId>
            <version>${daxpay.version}</version>
        </dependency>
        <!-- 云闪付通道实现 -->
        <dependency>
            <groupId>org.dromara.daxpay</groupId>
            <artifactId>daxpay-single-union</artifactId>
            <version>${daxpay.version}</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>daxpay-server</finalName>
        <plugins>
            <!-- spring-boot -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!-- 打包Excel等资源文件损坏问题 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
                        <nonFilteredFileExtension>xls</nonFilteredFileExtension>
                        <nonFilteredFileExtension>docx</nonFilteredFileExtension>
                        <nonFilteredFileExtension>doc</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <!-- 指定打包资源路径 -->
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <!-- java类路径中会被打包的软件 -->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.sql</include>
                    <include>**/*.flt</include>
                    <include>**/*.xlsx</include>
                    <include>**/*.xls</include>
                    <include>**/*.docx</include>
                    <include>**/*.doc</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

4.准备后端打包环境,后端是要求maven要3.8.x,java-jdk21

1.maven3.8.1地址:pan.baidu.com/s/1qw--tSK3kPNiZRFwfWrBhA?pwd=6y29

2.项目选择好jak21和maven3.8.1,记得切换环境变量

3.修改maven3.8.1的setting文件不然一些依赖下不下来

这里也是准备好了setting文件给大家,直接抄就好了,根据自己情况修改一下仓库地址就好了把<localRepository>D:\Maven\repo</localRepository>替换成自己的地址

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">

<localRepository>D:\Maven\repo</localRepository>

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
    	<pluginGroup>org.apache.tomcat.maven</pluginGroup>
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>

    <mirror>
    <id>nexus-163</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus 163</name>
    <url>http://mirrors.163.com/maven/repository/maven-public/</url>
</mirror>
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

到这里就可以打包部署后端了,端口设置为9999(yml文件是9999 ,没改的话服务器也用9999吧)

4.部署前端

1.上传打包的list文件

这里打包list之前需要改一些配置,我是前后端分离部署

修改.env.build

# 名称 不可为空
VITE_GLOB_APP_TITLE=DaxPay服务端

# 独立部署模式
VITE_PUBLIC_PATH=/
# API 接口前缀
VITE_GLOB_API_URL_PREFIX=/server

# 是否启用gzip压缩或brotli压缩, 可选: gzip | brotli | none, 如果你需要多种形式,你可以用','来分隔
VITE_BUILD_COMPRESS='none'

# 接口地址
VITE_GLOB_API_URL=

# 终端类型
VITE_GLOB_APP_CLIENT=dax-pay

# 超时时间
VITE_GLOB_API_TIMEOUT=30000

# 是否开启打包分析
VITE_ENABLE_ANALYZE=false

2.nginx部署

新建php站点,选择上传的list,修改配置文件:

server
{
    listen 80;
    server_name pay.chengquan.icu;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/pay/dist;

    #CERT-APPLY-CHECK--START
    # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
    include /www/server/panel/vhost/nginx/well-known/pay.chengquan.icu.conf;
    #CERT-APPLY-CHECK--END

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #SSL-END

    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-00.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/pay.chengquan.icu.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

    #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }
    # 后端服务请求转发, 
    location /server/ {
        proxy_set_header Host $host; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_buffering on;
        # websocket协议升级
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        # 后端地址
        proxy_pass http://8.141.1.4:9999/; 
        
    }
    # 将根路径映射到web前端
    # location / {
    #     # PC前端静态文件所在的路径
    #     alias /www/wwwroot/pay/list/index/web/;
    #     try_files $uri $uri/ /index.html;
    # }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    access_log  /www/wwwlogs/pay.chengquan.icu.log;
    error_log  /www/wwwlogs/pay.chengquan.icu.error.log;
}

二.调用部署好的支付服务

1.pom文件sdk

<!--        daxpay-sdk-->
        <dependency>
            <groupId>org.dromara.daxpay</groupId>
            <artifactId>daxpay-single-sdk</artifactId>
            <version>3.0.0.beta3</version>
        </dependency>

2.登录pax-pay后台(默认账号密码是bootx,123456)

支付配置->商户管理->应用信息->新建一个配置

3.init写入配置

这里我是把init写在我自己支付服务的service里面了

  @Override   
 public void init() {
        // 初始化支付配置
        DaxPayConfig config = DaxPayConfig.builder()
                .serviceUrl("http://ip:9999") // 替换为您的网关地址
                .signSecret("121234") // 替换为您的签名密钥
                .appId("123456") // 替换为您的应用ID
                .signType(SignTypeEnum.HMAC_SHA256) // 签名类型
                .build();
        DaxPayKit.initConfig(config);
    }

4.启动项加入init初始化

public class RuoYiApplication
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ApplicationContext context = SpringApplication.run(RuoYiApplication.class, args);
        
        // 初始化支付配置
        PaymentServiceImpl paymentService = context.getBean(PaymentServiceImpl.class);
        paymentService.init();

        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");
    }
}

5.DaxPayKit.execute(param)调用支付接口,他会根据参数自动调用对接的接口不用管路径

package com.ruoyi.service.impl;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.config.AliPayAccountConfig;
import com.ruoyi.config.WxAccountConfig;
import com.ruoyi.config.UnionPayConfig;
import com.ruoyi.entity.Order;
import com.ruoyi.entity.Pay.WeChatPayParam;
import com.ruoyi.entity.user.User;
import com.ruoyi.service.IUserService;
import com.ruoyi.service.PaymentService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.daxpay.single.sdk.code.ChannelEnum;
import org.dromara.daxpay.single.sdk.code.PayMethodEnum;
import org.dromara.daxpay.single.sdk.code.SignTypeEnum;
import org.dromara.daxpay.single.sdk.model.trade.pay.PayResultModel;
import org.dromara.daxpay.single.sdk.net.DaxPayKit;
import org.dromara.daxpay.single.sdk.param.trade.pay.PayParam;
import org.dromara.daxpay.single.sdk.response.DaxPayResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.math.BigDecimal;


import org.dromara.daxpay.single.sdk.net.DaxPayConfig;
@Slf4j
@Service
@RequiredArgsConstructor
public class PaymentServiceImpl implements PaymentService {

    @Autowired
    IUserService userService;


    @Override
    public void init() {
        // 初始化支付配置
        DaxPayConfig config = DaxPayConfig.builder()
            xxxx写自己的配置
    }

    @Override
    public String processPayment(Order order, String paymentMethod) {
        try {
            // 构建支付参数
            PayParam param = new PayParam();
            // 设置客户端IP
//            param.setClientIp("127.0.0.1");  // 实际应从请求中获取
            // 设置商户订单号(使用订单ID或时间戳)
            param.setBizOrderNo(order.getOrderNo());
            // 设置订单标题和描述
            param.setTitle("支付");
            param.setDescription(order.getDescription());
            //开启分账
            param.setAllocation(true);
            //关闭自动分账
            param.setAutoAllocation(false);
            //设置订单过期时间  fixme,和业务订单过期时间统一
//            param.setExpiredTime();
            // 设置支付金额
            param.setAmount(order.getAmount());

            // 根据支付方式设置渠道、方法和特定参数
        switch (paymentMethod) {
                case "ALIPAY_APP":  // 支付宝APP支付
                    //设置支付渠道
                    param.setChannel(ChannelEnum.ALI.getCode());
                    //设置支付渠道
                    param.setMethod(PayMethodEnum.APP.getCode());
                    //设置其他特定参数
                    break;
//                case "ALIPAY_BARCODE":  // 支付宝条码支付
//                    param.setChannel(ChannelEnum.ALI.getCode());
//                    param.setMethod(PayMethodEnum.BARCODE.getCode());
//                    AliPayParam aliParam = new AliPayParam();
//                    aliParam.setAuthCode(order.getAuthCode()); // 设置用户的付款码
//                    param.setChannelParam(aliParam);
//                    break;
                case "WECHAT_APP":  // 微信APP支付
                    param.setChannel(ChannelEnum.WECHAT.getCode());
                    param.setMethod(PayMethodEnum.APP.getCode());
                    break;

                case "WECHAT_JSAPI":  // 微信小程序/公众号支付
                    param.setChannel(ChannelEnum.WECHAT.getCode());
                    param.setMethod(PayMethodEnum.JSAPI.getCode());
                    WeChatPayParam wxParam = new WeChatPayParam();
                    Long userId = SecurityUtils.getUserId();
                    User user=userService.getUserProfile(userId);
                    if(user==null){throw new RuntimeException("获取登录用户信息异常,请联系管理员");}
                    wxParam.setOpenId(user.getWxOpenid()); // 设置用户的openId
                    param.setExtraParam(wxParam.getOpenId());
                    break;

//                case "WECHAT_BARCODE":  // 微信条码支付
//                    param.setChannel(ChannelEnum.WECHAT.getCode());
//                    param.setMethod(PayMethodEnum.BARCODE.getCode());
//                    WeChatPayParam wxBarcodeParam = new WeChatPayParam();
//                    wxBarcodeParam.setAuthCode(order.getAuthCode()); // 设置用户的付款码
//                    param.setChannelParam(wxBarcodeParam);
//                    break;

                case "UNION_APP":  // 云闪付APP支付
                    param.setChannel(ChannelEnum.UNION_PAY.getCode());
                    param.setMethod(PayMethodEnum.APP.getCode());
                    break;

//                case "UNION_BARCODE":  // 云闪付条码支付
//                    param.setChannel(ChannelEnum.UNION_PAY.getCode());
//                    param.setMethod(PayMethodEnum.BARCODE.getCode());
//                    UnionPayParam unionParam = new UnionPayParam();
//                    unionParam.setAuthCode(order.getAuthCode()); // 设置用户的付款码
//                    param.setChannelParam(unionParam);
//                    break;

                default:
                    throw new RuntimeException("目前暂不支持: " + paymentMethod +"支付");
            }

            // 设置附加数据和回调配置
            param.setAttach(order.getId().toString());
            param.setAllocation(false);
//            param.setReturnUrl("http://yourdomain.com/pay/return");  // 支付完成后同步跳转页面
            param.setNotifyUrl("localhost/pay/notify");  // 异步通知地址

            // 调用支付接口
            DaxPayResult<PayResultModel> result = DaxPayKit.execute(param);
            if(result.getCode()!=0){throw new RuntimeException(result.getMsg());};
            //更新订单支付流水号
            order.setPaymentNo(result.getData().getOrderNo());
            //更新订单支付状态
            switch (result.getData().getStatus()) {
                case "wait" :
                    order.setStatus(Order.STATUS_UNPAID);
                    break;
                case "progress" :
                    order.setStatus(Order.STATUS_PAYING);
                    break;
                case "success" :
                    order.setStatus(Order.STATUS_UNCONFIRMED);//fixme ?美食支付那块状态会不会有问题
                    break;
                default:
                    order.setStatus(Order.STATUS_CANCELLED);
                    break;

            }

            if (result.getCode()==0) {
                // 返回支付二维码或支付链接等信息
                return result.getData().getPayBody();
            } else {
                log.error("Payment failed: {}", result.getMsg());
                throw new RuntimeException("Payment processing failed: " + result.getMsg());
            }
        } catch (Exception e) {
            log.error("Payment processing error", e);
            throw new RuntimeException("Payment processing error", e);
        }
    }

    @Override
    public boolean servicePayment(Order order, String paymentMethod) {
        return false;
    }

    @Override
    public boolean memberPayment(BigDecimal fee, String paymentMethod) {
        return false;
    }

    @Override
    public String processRefund(Order order, BigDecimal refundAmount) throws Exception {
        return "";
    }


} 

我这里只展示了统一支付接口的调用,其他退款什么的根据接口文档去写

三、pax-pay接口文档

统一支付接口 | DaxPay文档站