This is a sample application to help developers start building Java applications using the Gateway Java SDK.
- Java 8
- Maven
- Registered account with MPGS Gateway system
- You can authenticate in one of two ways:
- Using your API key and password (available from the merchant portal). To do this, see instructions below. The following fields are required for password authentication: merchant ID, API password, currency, and gateway base URL.
- Using a certificate, which can be downloaded from the merchant portal. To do this, see instructions here.
-
Download code
-
Run
mvn clean install
-
Set the environment variables
-
On Mac/Linux: Use the
export
command:prompt> export GATEWAY_MERCHANT_ID=YOUR_MERCHANT_ID prompt> export GATEWAY_API_PASSWORD=YOUR_API_PASSWORD prompt> export GATEWAY_BASE_URL=YOUR_GATEWAY_BASE_URL prompt> export GATEWAY_CURRENCY=YOUR_CURRENCY (optional - default is USD) prompt> export GATEWAY_VERSION=YOUR_VERSION (optional - default is version 52) prompt> export GATEWAY_THREEDS_VERSION=YOUR_THREEDS_VERSION (optional - default is 1.2.0) prompt> export GATEWAY_APM_VERSION=YOUR_APM_VERSION (optional - default is version 1.1.0)
-
On Windows, use the
set
command:prompt> set GATEWAY_MERCHANT_ID=YOUR_MERCHANT_ID prompt> set GATEWAY_API_PASSWORD=YOUR_API_PASSWORD prompt> set GATEWAY_BASE_URL=YOUR_GATEWAY_BASE_URL prompt> set GATEWAY_CURRENCY=YOUR_CURRENCY (optional - default is USD) prompt> set GATEWAY_VERSION=YOUR_VERSION (optional - default is version 52) prompt> set GATEWAY_THREEDS_VERSION=YOUR_THREEDS_VERSION (optional - default is version 1.2.0) prompt> set GATEWAY_APM_VERSION=YOUR_APM_VERSION (optional - default is version 1.1.0)
-
-
Run the following:
java -jar dist/gateway-java-sample-code-1.1.0.jar
-
Navigate to http://localhost:5000 to test locally
If you are behind a web proxy, you'll need to add a couple of flags before running the .jar (in Step 4)
java -Dhttp.proxyHost=YOUR_PROXY_URL -Dhttp.proxyPort=YOUR_PROXY_PORT -jar dist/gateway-java-sample-code-1.0.jar
This software is intended for TEST/REFERENCE purposes ONLY and is not intended to be used in a production environment.