22
33# SumUp Java SDK
44
5- [ ![ Maven Central Version] ( https://img.shields.io/maven-central/v/com.sumup/sumup?strategy=releaseProperty )] ( https://mvnrepository.com/artifact/com.sumup/sumup )
5+ [ ![ Maven Central Version] ( https://img.shields.io/maven-central/v/com.sumup/sumup-sdk ?strategy=releaseProperty )] ( https://mvnrepository.com/artifact/com.sumup/sumup-sdk )
66[ ![ Documentation] [ docs-badge ]] ( https://developer.sumup.com )
77[ ![ CI Status] ( https://github.com/sumup/sumup-java/actions/workflows/ci.yaml/badge.svg )] ( https://github.com/sumup/sumup-java/actions/workflows/ci.yaml )
88[ ![ License] ( https://img.shields.io/github/license/sumup/sumup-java )] ( ./LICENSE )
@@ -21,7 +21,7 @@ Add the dependency in your `build.gradle.kts` file:
2121
2222``` kotlin
2323dependencies {
24- implementation(" com.sumup:sumup:0.0.5" )
24+ implementation(" com.sumup:sumup-sdk :0.0.5" )
2525}
2626```
2727
@@ -31,7 +31,7 @@ Add the dependency in your `build.gradle` file:
3131
3232``` groovy
3333dependencies {
34- implementation 'com.sumup:sumup:0.0.5'
34+ implementation 'com.sumup:sumup-sdk :0.0.5'
3535}
3636```
3737
@@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file:
4242``` xml
4343<dependency >
4444 <groupId >com.sumup</groupId >
45- <artifactId >sumup</artifactId >
45+ <artifactId >sumup-sdk </artifactId >
4646 <version >0.0.5</version >
4747</dependency >
4848```
@@ -55,21 +55,25 @@ Authenticate with a personal access token before making calls:
5555export SUMUP_API_KEY=" my-token"
5656```
5757
58- Create synchronous and asynchronous clients using the provided builders :
58+ Create clients using the default constructor (reads ` SUMUP_API_KEY ` ) :
5959
6060``` java
61- String apiKey = System . getenv(" SUMUP_API_KEY" );
61+ SumUpClient client = new SumUpClient ();
62+ SumUpAsyncClient asyncClient = new SumUpAsyncClient ();
63+ ```
64+
65+ Or pass the API key explicitly:
66+
67+ ``` java
68+ SumUpClient client = new SumUpClient (" api-key" );
69+ ```
70+
71+ If you need more configuration, use the builder:
6272
73+ ``` java
6374SumUpClient client =
6475 SumUpClient . builder()
6576 .environment(SumUpEnvironment . PRODUCTION )
66- .accessToken(apiKey)
67- .build();
68-
69- SumUpAsyncClient asyncClient =
70- SumUpAsyncClient . builder()
71- .environment(SumUpEnvironment . PRODUCTION )
72- .accessToken(apiKey)
7377 .build();
7478```
7579
@@ -86,11 +90,9 @@ import com.sumup.sdk.models.CheckoutCreateRequest;
8690import com.sumup.sdk.models.Currency ;
8791import java.util.UUID ;
8892
89- String apiKey = System . getenv(" SUMUP_API_KEY" );
9093SumUpClient client =
9194 SumUpClient . builder()
9295 .environment(SumUpEnvironment . PRODUCTION )
93- .accessToken(apiKey)
9496 .build();
9597
9698String merchantCode = client. merchant(). getMerchantProfile(). merchantCode();
@@ -121,11 +123,9 @@ import com.sumup.sdk.models.Currency;
121123import java.util.UUID ;
122124import java.util.concurrent.CompletableFuture ;
123125
124- String apiKey = System . getenv(" SUMUP_API_KEY" );
125126SumUpAsyncClient client =
126127 SumUpAsyncClient . builder()
127128 .environment(SumUpEnvironment . PRODUCTION )
128- .accessToken(apiKey)
129129 .build();
130130
131131CompletableFuture<Void > checkoutFuture =
@@ -170,13 +170,11 @@ import com.sumup.sdk.models.Money;
170170import java.util.Optional ;
171171import java.util.UUID ;
172172
173- String apiKey = System . getenv(" SUMUP_API_KEY" );
174173String merchantCode = System . getenv(" SUMUP_MERCHANT_CODE" );
175174
176175SumUpClient client =
177176 SumUpClient . builder()
178177 .environment(SumUpEnvironment . PRODUCTION )
179- .accessToken(apiKey)
180178 .build();
181179
182180String readerId =
@@ -215,13 +213,11 @@ import java.util.Optional;
215213import java.util.UUID ;
216214import java.util.concurrent.CompletableFuture ;
217215
218- String apiKey = System . getenv(" SUMUP_API_KEY" );
219216String merchantCode = System . getenv(" SUMUP_MERCHANT_CODE" );
220217
221218SumUpAsyncClient client =
222219 SumUpAsyncClient . builder()
223220 .environment(SumUpEnvironment . PRODUCTION )
224- .accessToken(apiKey)
225221 .build();
226222
227223CompletableFuture<String > readerIdFuture =
0 commit comments