Skip to content

Environment.INTEGRATION is Ratepay's sandbox, a real deployment of the Payments API that accepts test transactions without moving real money. Use it to validate that your actual request payloads are accepted, end to end, beyond what a mocked unit test can tell you.

Getting credentials

Sandbox OAuth credentials (client id/secret) aren't self-service today, email integration@ratepay.com if you don't already have a set for the INTEGRATION environment.

Pointing the client at the sandbox

RatepayClient client = RatepayClient.builder()
    .clientId(System.getenv("RATEPAY_CLIENT_ID"))
    .clientSecret(System.getenv("RATEPAY_CLIENT_SECRET"))
    .environment(Environment.INTEGRATION)
    .build();

This is exactly the quickstart's client setup, only the environment and credentials differ from production.

What sandbox testing is for (and isn't)

Run your real request-building code against Environment.INTEGRATION to catch:

  • Payloads the API rejects that your local validation (or mocks) wouldn't have caught, like malformed addresses, currency mismatches, unsupported payment-method combinations, and similar 400/422s.
  • Whether a full authorize → capture → refund/cancel sequence behaves the way you expect against a real backend, including realistic response shapes and timing.

It's not a substitute for the mocked unit tests in Unit testing the quickstart flow - sandbox calls are real network requests, so they're slower, require credentials and connectivity, and aren't suitable to run on every build. A practical split: unit-test your logic against a mocked RatepayClient for fast, deterministic coverage in CI, and run a smaller number of sandbox-backed integration tests (or a manual pre-release checklist) to validate against the real API.

No local stub server option

You can't point the SDK at your own local mock HTTP server as an alternative to the real sandbox.