A Java SDK for easy integration with the PayPal Payflow Gateway. Requires Java 11 or newer.
Note: v5 contains breaking changes from v4. Review the CHANGELOG before upgrading an existing integration.
- Java 11+ (LTS releases recommended; Java 8 also works — set
maven.compiler.release=8inpom.xml) - Apache Maven 3.6+ (for building)
Credentials are read at runtime — never hardcoded. You have two options:
Option A — Environment variables (recommended for CI/CD and shared machines):
export PAYFLOW_USER=your_user
export PAYFLOW_VENDOR=your_vendor
export PAYFLOW_PARTNER=PayPal
export PAYFLOW_PASSWORD=your_passwordOn Windows (PowerShell):
$env:PAYFLOW_USER = "your_user"
$env:PAYFLOW_VENDOR = "your_vendor"
$env:PAYFLOW_PARTNER = "PayPal"
$env:PAYFLOW_PASSWORD = "your_password"Option B — Properties file (simple local use):
Create java/payflow.properties and fill in your account details:
PayflowUser=your_user
PayflowVendor=your_vendor
PayflowPartner=PayPal
PayflowPassword=your_passwordThis file is listed in .gitignore and will never be committed.
Priority: Environment variables take precedence over
payflow.properties. If any env var is missing, the file is used as a fallback. If neither is available, the sample prints an error and exits.
Once credentials are set in payflow.properties, run:
# Windows (PowerShell)
cd java
.\run-sample.ps1# Linux / macOS / Git Bash
cd java
./run-sample.shREM Windows (Command Prompt)
cd java
run-sample.batEach script runs mvn clean package, compiles the sample against the resulting JAR, and runs it — no manual classpath setup required.
Note: When running on JDK 21 or later you may see the following warning from Maven's own Guava dependency. It is cosmetic and can be safely ignored — it has no effect on the build or on the SDK at runtime:
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent...This will be resolved in a future Maven release.
cd java
mvn clean packageOutput: target/payflow.jar with zero external runtime dependencies. Copy it to your project's classpath.
Open the java/ directory as a Maven project in IntelliJ IDEA, Eclipse, or VS Code (Java Extension Pack). The IDE detects pom.xml and configures the source roots automatically.
The sample files live under src/paypal/payments/samples/. They are not included in payflow.jar; compile and run them separately:
# 1. Build the SDK
mvn clean package
# 2. Compile the sample into a local output directory
mkdir -p samplebin
javac -cp target/payflow.jar \
-d samplebin \
src/paypal/payments/samples/dataobjects/basictransactions/DOSaleComplete.java
# 3. Run (payflow.properties must be in the working directory)
java -cp "target/payflow.jar:samplebin" \
paypal.payments.samples.dataobjects.basictransactions.DOSaleCompleteOn Windows use ; instead of : as the classpath separator.
Note:
payflow.propertiesmust be present in the directory you run thejavacommand from. Therun-samplescripts automatically run from thejava/directory where the file lives.
The SDK ships with full Javadoc comments. Generate the HTML reference with:
# Windows (PowerShell)
.\generate-docs.ps1# Linux / macOS / Git Bash
./generate-docs.shREM Windows (Command Prompt)
generate-docs.batOutput is written to target/site/apidocs/index.html.
See also the Payflow Gateway Developer Guide.
See CONTRIBUTING.md. PRs are welcome; open an issue first for major changes.
The last v4 SDK binaries are in the SDK Binaries directory.