Skip to content

⏱ 5 min
👤 Onboarding Developer Team (Alexandre S.)

The Ratepay Java SDK provides a single-typed client for integrating with Ratepay's Payment API 2.0 using Java or Kotlin.

Use the SDK to authorize, capture, cancel, and refund payments without manually handling HTTP requests, OAuth authentication, or JSON serialization.

The SDK is available on Maven as com.ratepay.sdk:ratepay-sdk-core. All code examples are provided in both Java and Kotlin.

Key features

  • Simplified API integration: Use a single, thread-safe RatepayClient to interact with Ratepay's Payment API 2.0. See Client configuration.
  • Automatic authentication: The SDK manages OAuth2 access tokens, including retrieval and renewal. See Authentication.
  • Type-safe responses: Handle payment outcomes such as Accepted, Declined, and OtpRequired without relying on exceptions for expected business outcomes.
  • Structured error handling: Identify and handle authentication, validation, network, and other API errors using dedicated exception subtypes. See Exception hierarchy.
  • Idempotency support: Use idempotency keys to safely retry supported payment operations. See Idempotency and retries.
  • Testable design: Mock or extend the client interface to support unit testing, logging, and monitoring. See Testing overview.

Payment lifecycle

OperationDescription
authorizeAuthorize a payment for a customer's order.
captureCapture an authorized payment, typically when an order is shipped or confirmed.
incrementalAuthorizeIncrease the authorized amount before capture.
cancelCancel an authorization that has not been captured.
refundRefund a previously captured payment.
sendShippingInformationAdd shipping and tracking details to a capture.

Before you start

To use the SDK, you'll need:

  • Runtime: Java 17 or later, built with Maven 3.9+ or Gradle. See Compatibility.
  • Credentials: an OAuth client ID and secret per environment.
  • Environments: use Environment.INTEGRATION for testing and Environment.PRODUCTION for live transactions. They use separate credentials.
Credentials
Individual credentials will be provided by your Ratepay representative.

Client ID:snbFcxD4Rxt2O4YqeGqDls9yrGWYhmQ0

Client Secret:IHa7jiW0hMlH0VsoxDTZ03XH76NED7RwFvJLsmmUXg9fkowhiVQqp7EA84WoYT1Q

Get started

Ready to integrate Ratepay into your application? Follow the Getting started guide to install the SDK, configure your client, and process your first test payment.