Skip to content

Latest commit

 

History

History
189 lines (142 loc) · 9.75 KB

README.md

File metadata and controls

189 lines (142 loc) · 9.75 KB

alipay-sdk-java-v3

支付宝开放平台API

  • API version: 1.0

支付宝开放平台v3协议文档

For more information, please visit https://openhome.alipay.com/developmentDocument.htm

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.alipay.sdk</groupId>
  <artifactId>alipay-sdk-java-v3</artifactId>
  <version>1.0-SNAPSHOT</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'alipay-sdk-java-v3' jar has been published to maven central.
    mavenLocal()       // Needed if the 'alipay-sdk-java-v3' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.alipay.sdk:alipay-sdk-java-v3:1.0-SNAPSHOT"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/alipay-sdk-java-v3-1.0-SNAPSHOT.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.alipay.v3.ApiClient;
import com.alipay.v3.ApiException;
import com.alipay.v3.Configuration;
import com.alipay.v3.models.*;
import com.alipay.v3.api.AlipayOpenFileApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://openapi.alipay.com");

    AlipayOpenFileApi apiInstance = new AlipayOpenFileApi(defaultClient);
    String returnUrl = "returnUrl_example"; // String | 页面跳转地址
    String notifyUrl = "notifyUrl_example"; // String | 通知地址
    AlipayOpenFileUploadModel data = new AlipayOpenFileUploadModel(); // AlipayOpenFileUploadModel | 
    File fileContent = new File("/path/to/file"); // File | 
    try {
      AlipayOpenFileUploadResponseModel result = apiInstance.upload(returnUrl, notifyUrl, data, fileContent);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AlipayOpenFileApi#upload");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to https://openapi.alipay.com

Class Method HTTP request Description
AlipayOpenFileApi upload POST /v3/alipay/open/file/upload 支付宝文件上传接口
OperationApi query GET /v3/alipay/open/operation/openbizmock/closelyrzone/query 测试路由转发closelyrzone
OperationApi query_0 POST /v3/alipay/open/operation/openbizmock/encrydata/query 测试专用_此接口类型为强制加密接口
OperationApi query_1 GET /v3/alipay/open/operation/openbizmock/gzone/query V3网关测试gzone转发
OperationApi query_2 POST /v3/alipay/open/operation/openbizmock/openidtesting/query 网关测试接口openid升级测试
OperationApi query_3 GET /v3/alipay/open/operation/openbizmock/rzone/query 测试openapi路由
OperationApi query_4 POST /v3/alipay/open/operation/openbizmock/rzonegroovy/query 测试路由转发groovy脚本
OperationApi query_5 GET /v3/alipay/open/operation/openbizmock/testcertificate/query 测试专用此接口为强制走证书的接口
OperationApi query_6 GET /v3/alipay/open/operation/openbizmock/testerrorcode/query 测试错误码验证接口
OperationApi query_7 POST /v3/alipay/open/operation/openbizmock/testpathkey/query/{keykey}/{a} 测试网关协议3.0key和path

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization. Authentication schemes defined for the API:

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author