Skip to content

Commit 967585f

Browse files
committed
Address PR feedback
1 parent e92fb13 commit 967585f

3 files changed

Lines changed: 41 additions & 13 deletions

File tree

doc/CloudDeviceApi.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ New features and products will be released exclusively on the Cloud device API
2020

2121
### Setup
2222

23-
First you must initialise the Client **setting the closest** [Region](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/#cloud):
23+
First you must initialise the Client (see an example on TEST):
2424
``` java
2525
// Import the required classes
2626
import com.adyen.Client;
@@ -32,12 +32,30 @@ import java.math.BigDecimal;
3232
import java.time.OffsetDateTime;
3333
import java.time.ZoneOffset;
3434

35-
// Setup Client and Service
36-
Client client = new Client("YOUR_API_KEY", Environment.TEST);
35+
// Setup Client on TEST
36+
Client client = new Client(new Config().apiKey("test").environment(Environment.TEST));
37+
3738
CloudDeviceApi cloudDeviceApi = new CloudDeviceApi(client);
3839

3940
```
41+
On LIVE environment you must **set the closest** [Region](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/#cloud)
42+
``` java
43+
// Import the required classes
44+
import com.adyen.Client;
45+
import com.adyen.enums.Environment;
46+
import com.adyen.service.clouddevice.CloudDeviceApi;
47+
import com.adyen.model.clouddevice.*;
48+
import com.adyen.model.tapi.*;
49+
import java.math.BigDecimal;
50+
import java.time.OffsetDateTime;
51+
import java.time.ZoneOffset;
52+
53+
// Setup Client on LIVE (Region is required)
54+
Client client = new Client(new Config().apiKey("test").environment(Environment.LIVE).terminalApiRegion(Region.US));
4055

56+
CloudDeviceApi cloudDeviceApi = new CloudDeviceApi(client);
57+
58+
```
4159
### Send a payment SYNC request
4260

4361
```java
@@ -115,10 +133,12 @@ The Cloud device API allows your integration to check the status of the terminal
115133
// list of payment terminals or SDK mobile installation IDs
116134
ConnectedDevicesResponse connectedDevices = cloudDeviceApi.getConnectedDevices("myMerchant");
117135
System.out.println(connectedDevices.getUniqueDeviceIds());
136+
// [P400Plus-123456789, AMS1-000168242800763]
118137

119138
// check the payment terminal or SDK mobile installation ID
120139
DeviceStatusResponse deviceStatus = cloudDeviceApi.getDeviceStatus("myMerchant", "AMS1-000168242800763");
121140
System.out.println(deviceStatus.getStatus());
141+
// ONLINE
122142
```
123143
### Helper classes
124144

@@ -148,9 +168,9 @@ The Adyen Java library supports encrypting request and response payloads, allowi
148168
// Encryption credentials from the Terminal configuration on CA
149169
EncryptionCredentialDetails encryptionCredentialDetails =
150170
new EncryptionCredentialDetails()
151-
.adyenCryptoVersion(0)
171+
.adyenCryptoVersion(1)
152172
.keyIdentifier("CryptoKeyIdentifier12345")
153-
.keyVersion(0)
173+
.keyVersion(1)
154174
.passphrase("p@ssw0rd123456");
155175

156176
// Use EncryptedCloudDeviceApi instead of CloudDeviceApi

doc/MigratingToCloudDeviceApi.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ The Terminal (Cloud) API (`TerminalCloudAPI`) was built manually with hand-craft
88

99
Because the Cloud device API models are generated from the spec rather than hand-crafted, there are differences in class names, enum naming conventions, field types, and accessor methods. This guide describes these differences and what to be aware of when adopting the Cloud device API.
1010

11-
### Who should migrate?
12-
13-
- **New integrations**: use the Cloud device API from the start. See the [Cloud device API documentation](CloudDeviceApi.md).
14-
- **Updating your cloud integration**: you should consider migrating to the Cloud device API to benefit from the improvements listed below.
15-
- **Not making changes**: you can continue using the Terminal (Cloud) API. It remains functional, but you will miss out on the benefits of the Cloud device API.
16-
1711
## Benefits of the Cloud device API
1812

1913
The Cloud device API introduces several improvements over the Terminal (Cloud) API:
@@ -23,6 +17,13 @@ The Cloud device API introduces several improvements over the Terminal (Cloud) A
2317
- **Improved security**: supports OAuth authentication alongside API key authentication.
2418
- **Device management endpoints**: query connected devices and check their status directly from your integration.
2519
- **New features**: future In-Person Payments features and products will be released exclusively on the Cloud device API.
20+
21+
### Who should migrate?
22+
23+
- **New integrations**: use the Cloud device API from the start. See the [Cloud device API documentation](CloudDeviceApi.md).
24+
- **Updating your cloud integration**: you should consider migrating to the Cloud device API to benefit from the improvements listed below.
25+
- **Not making changes**: you can continue using the Terminal (Cloud) API. It remains functional, but you will miss out on the benefits of the Cloud device API.
26+
2627
- **Generated from the OpenAPI specification**: unlike the hand-crafted Terminal (Cloud) API models, the Cloud device API is auto-generated from the [Adyen OpenAPI spec](https://github.com/Adyen/adyen-openapi). This brings consistency with every other service in the library (Checkout, Management, Transfers, etc.), ensures the models stay in sync with the API, and provides built-in `fromJson()`/`toJson()` serialization, fluent setters, and Jackson support out of the box.
2728

2829
## Key differences
@@ -128,6 +129,9 @@ Some field types differ in the generated models.
128129

129130
The most common change. The Cloud device API models use `java.time.OffsetDateTime` for timestamp fields, whereas the Terminal (Cloud) API models use `XMLGregorianCalendar`.
130131

132+
The key difference is how each type handles timezone information. `XMLGregorianCalendar` allows an undefined timezone: when constructed from `new GregorianCalendar()` without an explicit timezone, it inherits the JVM default.
133+
This means the same wall-clock time (e.g. 14:30:00) could be serialized as `14:30:00+01:00` on a server in Amsterdam or `14:30:00-05:00` on one in New York — two different points in time. `OffsetDateTime` always carries an explicit offset, so `OffsetDateTime.now(ZoneOffset.UTC)` always serializes as `2025-01-15T14:30:00Z`, unambiguously.
134+
131135
**Terminal (Cloud) API:**
132136
```java
133137
import javax.xml.datatype.XMLGregorianCalendar;
@@ -149,6 +153,10 @@ transactionIDType.setTimeStamp(OffsetDateTime.now(ZoneOffset.UTC));
149153

150154
Some date fields (e.g. `Instalment.firstPaymentDate`) use `java.time.LocalDate` in the Cloud device API instead of `String`.
151155

156+
`LocalDate` has no timezone or offset information — it represents a calendar date only (year, month, day). When the library serializes a `LocalDate`, it uses the date as-is without any timezone conversion.
157+
This means the date sent to the API is whatever date your system clock shows in its local timezone. If your server runs in a timezone that is behind UTC and the transaction happens near midnight UTC, the local date may be one day behind.
158+
**Ensure the system timezone is set correctly and consistently across all environments where the SDK runs.**
159+
152160
**Terminal (Cloud) API:**
153161
```java
154162
instalment.setFirstPaymentDate("2025-01-15");

doc/TerminalApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import javax.xml.datatype.DatatypeFactory;
1313
import javax.xml.datatype.XMLGregorianCalendar;
1414

1515
// Step 2: Initialize the client object
16-
Client client = new Client("YOUR_API_KEY", Environment.TEST);
16+
Client client = new Client(new Config().apiKey("test").environment(Environment.TEST));
1717

18-
// for LIVE environment use
18+
// for LIVE environment set the region
1919
// Config config = new Config();
2020
// config.setEnvironment(Environment.LIVE);
2121
// config.setTerminalApiRegion(Region.EU);

0 commit comments

Comments
 (0)