# sdk-core-java **Repository Path**: mirrors_yusuke/sdk-core-java ## Basic Information - **Project Name**: sdk-core-java - **Description**: Core Library for Java SDK - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2026-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README This repository contains core files for all Java sdks. ## Prerequisites: * Java JDK-1.5 or higher * Apache Maven 3 or higher ## To build this application: * Run 'mvn install' to build jar file. ## Core Testing: * Run 'mvn test' to run the test cases for all the core classes. * Test reports are generated in testReport folder. ## Core Logging: * For logging - java.util.logging has been used. To change the default configuration, edit the logging.properties file in 'jre/lib' folder under your JDK root. ## Core Configuration: The core uses .properties format configuration file. Sample of this file is at 'src/test/resources/'. You can use the 'sdk_config.properties' configuration file to configure * Mode is specified using the parameter name 'mode' with values 'sandbox' or 'live', if specified 'service.EndPoint' parameter is not required and the SDK choses the sandbox or live endpoints automatically. * (Multiple) API account credentials, by appending a '.' (dot) character and the service name to 'service.EndPoint' parameter. * HTTP connection parameters, if certain connection parameters are not specified, the SDK will assume defaults for them. * Service configuration. ## OpenID Connect Integration * Redirect your buyer to `Authorization.getRedirectUrl(redirectURI, scope, configurationMap);` to obtain authorization. * Capture the authorization code that is available as a query parameter (`code`) in the redirect url * Exchange the authorization code for a access token, refresh token, id token combo ```java Map configurationMap = new HashMap(); configurationMap.put("clientId", "..."); configurationMap.put("clientSecret", "..."); configurationMap.put("service.EndPoint", "https://api.paypal.com/"); APIContext apiContext = new APIContext(); apiContext.setConfigurationMap(configurationMap); ... CreateFromAuthorizationCodeParameters param = new CreateFromAuthorizationCodeParameters(); param.setCode(code); Tokeninfo info = Tokeninfo.createFromAuthorizationCode(apiContext, param); String accessToken = info.getAccessToken(); ``` * The access token is valid for a predefined duration and can be used for seamless XO or for retrieving user information ```java Map configurationMap = new HashMap(); configurationMap.put("clientId", "..."); configurationMap.put("clientSecret", "..."); configurationMap.put("service.EndPoint", "https://api.paypal.com/"); APIContext apiContext = new APIContext(); apiContext.setConfigurationMap(configurationMap); ... Tokeninfo info = new Tokeninfo(); info.setRefreshToken("refreshToken"); UserinfoParameters param = new UserinfoParameters(); param.setAccessToken(info.getAccessToken()); Userinfo userInfo = Userinfo.userinfo(apiContext, param); ``` * If the access token has expired, you can obtain a new access token using the refresh token from the 3'rd step. ```java Map configurationMap = new HashMap(); configurationMap.put("clientId", "..."); configurationMap.put("clientSecret", "..."); configurationMap.put("service.EndPoint", "https://api.paypal.com/"); APIContext apiContext = new APIContext(); apiContext.setConfigurationMap(configurationMap); ... CreateFromRefreshTokenParameters param = new CreateFromRefreshTokenParameters(); param.setScope("openid"); // Optional Tokeninfo info = new Tokeninfo // Create Token info object; setting the refresh token info.setRefreshToken("refreshToken"); info.createFromRefreshToken(apiContext, param); ```