Skip to main content
This guide introduces how to get started with using the Cobo Payments Java SDK, which allows you to integrate the Cobo payments service into your existing application using the Java programming language. To learn more about the initial setup steps necessary for utilizing the Payments API, see Send your first request. You can go to GitHub to access the source code of the SDK.

Prerequisites

  • Install Java 1.8 or newer
  • Install Maven 3.8.3 or newer / Gradle 7.2 or newer
  • Follow the instructions in Preparation for development environment to set up your Cobo account and create your organization. If an organization has already been set up, ask your organization admin to invite you to join the organization.
  • Follow the instructions in Send your first request to generate an API key and an API secret, and register the API key on Cobo Portal.

Add dependency

For Maven users, add the dependency to your project’s POM:
<dependency>
  <groupId>com.cobo.waas2</groupId>
  <artifactId>cobo-waas2</artifactId>
  <version>{VERSION}</version>
  <scope>compile</scope>
</dependency>
For Gradle users, add the dependency to your project’s build file:
  repositories {
    mavenCentral()     // Fetch the dependency from Maven Central
  }

  dependencies {
     implementation "com.cobo.waas2:cobo-waas2:{VERSION}"
  }
Replace {VERSION} with the lastest version number, for example, 1.2.0. Obtain the latest version number from the GitHub repository.

Configure API key and HTTP host

  1. Set the API secret.
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setPrivKey("<YOUR_API_SECRET_IN_HEX>");
  1. Select which environment you want to use. The SDK uses the production environment by default.
// Select the development environment
defaultClient.setEnv(Env.DEV);

// Select the production environment
defaultClient.setEnv(Env.PROD);

Code samples

For operation-specific documentation and sample code, see the docs folder in the GitHub repository.