• Getting Started
    • Mobile Integration (Android/IOS)
      Enterprise Solutions
      Accept Payments
      Process Payments
      API References
      Other Processes
      Mini Program Platform
        Website Integration

      JAVA SDK Integration

      It is a client java library that provides an easy way to interact with the Paytm miniapp ecosystem.

      Installation Guide


      Java 1.7 or later.

      Installing Mini Program SDK with maven

      1. Add below maven repository to your project's POM

      2. Add below maven dependency to your project's POM

      3. Build and install locally by executing below command

        $ mvn install

      SDK code

      Auth Client

      // Configuring Auth client
      /*To create HttpClientProperties, 4 parameters are required
              *  1. socketTimeout - Integer
              *  2. connectionTimeout - Integer
              *  3. connectionRequestTimeout - Integer
              *  4. hostUri - String
              * */
              HttpClientProperties httpClientProperties = new HttpClientProperties
          OAuthClient oAuthClient = OAuthClient.getInstance(httpClientProperties,
                                    "<Auth Client ID received on onboarding>", "<Auth Client Secret received on onboarding>");
      // Fetch Access Token
      // Create oauth token request
          OauthTokenRequest oauthTokenRequest = new OauthTokenRequest
                                                      .setCode("<Auth code received from trust login>")
          try {
                HTTPServiceResponse<OauthTokenResponse> response = oauthClient.oauthToken(oauthTokenRequest, null);
              } catch (MiniAppClientException ex) {
                ErrorResponse errorResponse = ex.getError();
                Integer errorCode = ex.getErrorCode();
      // User Profile
      // Create fetch user profile request
          UserProfileRequest userProfileRequest = new UserProfileRequest
                                                      .setScopeCode("<received from fetch access token api response: access_token>")
          try {
               HTTPServiceResponse<OAuthUserProfile> response = oAuthClient.v2UserProfile(userProfileRequest);
          } catch (MiniAppClientException ex) {
              ErrorResponse errorResponse = ex.getError();
              Integer errorCode = ex.getErrorCode();


      Error TypeError CodeDescription
      UNKNOWN_EXCEPTION1000General error code when cause of exception is not known
      HTTP_IO_EXCEPTION1001Error code when there is an error in HTTP rest call
      JSON_PROCESSING_EXCEPTION1002Error while json serialization or deserialization
      IO_EXCEPTION1003Error in json serialization or deserialization
      ERROR_RESPONSE_FROM_API1004API did not give success response
      MANDATORY_HEADER_MISSING1005Validation error of missing header
      INVALID_REQUEST1006Validation error of not valid request
      INVALID_CLIENT_ATTRIBUTES1007Invalid attributes provided while client creation