diff --git a/README.md b/README.md index ea25652..96108ed 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ allprojects { ##### 2. Add the dependency to a module ```groovy -compile 'com.sumup:merchant-api:1.3.1' +compile 'com.sumup:merchant-api:1.4.0' ``` ##### 3. Make a payment @@ -36,10 +36,10 @@ compile 'com.sumup:merchant-api:1.3.1' //mandatory parameters // Please go to https://me.sumup.com/developers to get your Affiliate Key by entering the application ID of your app. (e.g. com.sumup.sdksampleapp) .affiliateKey("YOUR_AFFILIATE_KEY") - .productAmount(1.23) + .total(new BigDecimal("1.23")) .currency(SumUpPayment.Currency.EUR) // optional: add details - .productTitle("Taxi Ride") + .title("Taxi Ride") .receiptEmail("customer@mail.com") .receiptSMS("+3531234567890") // optional: Add metadata @@ -52,7 +52,7 @@ compile 'com.sumup:merchant-api:1.3.1' .skipSuccessScreen() .build(); - SumUpAPI.openPaymentActivity(MainActivity.this, payment, 1); + SumUpAPI.checkout(MainActivity.this, payment, 1); ``` ##### 4. Handle payment result @@ -91,7 +91,7 @@ compile 'com.sumup:merchant-api:1.3.1' "sumupmerchant://pay/1.0" + "?affiliate-key="YOUR_AFFILIATE_KEY"" + "&app-id=com.example.myapp" - + "&amount=1.23" + + "&total=1.23" // field available from App version 1.88.0 and above. Otherwise keep deprecated field "amount". + "¤cy=EUR" + "&title=Taxi Ride" + "&receipt-mobilephone=+3531234567890" @@ -125,9 +125,11 @@ mycallbackscheme://result?smp-status=failed&smp-failure-cause=transaction-failed Put a link onto your website ``` -Start SumUp Payment +Start SumUp Payment ``` +Note that field `total` is available from App version 1.88.0 and above. Keep deprecated field `amount` if still supporting older versions of the SumUp App. + Make sure that the callback URL you provide is correct and controlled by you. Success: @@ -154,8 +156,9 @@ Several response flags are available when the callback activity is called : * SumUpAPI.Response.ResultCode.ERROR_TRANSACTION_FAILED = 2 * SumUpAPI.Response.ResultCode.ERROR_GEOLOCATION_REQUIRED = 3 * SumUpAPI.Response.ResultCode.ERROR_INVALID_PARAM = 4 - * SumUpAPI.Response.ResultCode.ERROR_INVALID_TOKEN = 5 * SumUpAPI.Response.ResultCode.ERROR_NO_CONNECTIVITY = 6 + * SumUpAPI.Response.ResultCode.ERROR_DUPLICATE_FOREIGN_TX_ID = 9; + * SumUpAPI.Response.ResultCode.ERROR_INVALID_AFFILIATE_KEY = 10; * SumUpAPI.Response.MESSAGE * Type : String * Description : A human readable message describing the result of the payment @@ -181,11 +184,11 @@ The response flags are provided within the Bundle that is passed back to the cal ### 2. Additional checkout parameters #### Transaction identifier -The `foreignTransactionID` identifier will be associated with the transaction and can be used to retrieve details related to the transaction. See [API documentation](https://sumup.com/docs/rest-api/transactions-api) for details. Please make sure that this ID is unique within the scope of the SumUp merchant account and sub-accounts. It must not be longer than 128 characters. +The `foreignTransactionID` identifier will be associated with the transaction and can be used to retrieve details related to the transaction. See [API documentation](http://docs.sumup.com/rest-api/transactions-api/) for details. Please make sure that this ID is unique within the scope of the SumUp merchant account and sub-accounts. It must not be longer than 128 characters. The foreignTransactionID is available when the callback activity is called: `SumUpAPI.Param.FOREIGN_TRANSACTION_ID` #### Skip success screen -To skip the screen shown at the end of a successful transaction, the `skipSuccessScreen` parameter can be used. When using the parameter your application is responsible for displaying the transaction result to the customer. In combination with the Receipts API your application can also send your own receipts, see [API documentation](https://sumup.com/docs/rest-api/transactions-api) for details. Please note success screens will still be shown when using the SumUp Air Lite readers. +To skip the screen shown at the end of a successful transaction, the `skipSuccessScreen` parameter can be used. When using the parameter your application is responsible for displaying the transaction result to the customer. In combination with the Receipts API your application can also send your own receipts, see [API documentation](http://docs.sumup.com/rest-api/transactions-api/) for details. Please note success screens will still be shown when using the SumUp Air Lite readers. ## Community - **Questions?** Get in contact with our integration team by sending an email to diff --git a/app/build.gradle b/app/build.gradle index ff639d2..a652d98 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,19 +1,18 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.1' + compileSdkVersion 27 + buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 24 + targetSdkVersion 27 versionCode 4 - versionName "1.3.1" + versionName "1.4.0" } } dependencies { - compile 'com.android.support:appcompat-v7:24.2.1' - - compile 'com.sumup:merchant-api:1.3.1' + compile 'com.android.support:appcompat-v7:27.1.1' + compile 'com.sumup:merchant-api:1.4.0' } \ No newline at end of file diff --git a/app/src/main/java/com/sumup/apisampleapp/MainActivity.java b/app/src/main/java/com/sumup/apisampleapp/MainActivity.java index 2f69609..71241dd 100644 --- a/app/src/main/java/com/sumup/apisampleapp/MainActivity.java +++ b/app/src/main/java/com/sumup/apisampleapp/MainActivity.java @@ -11,6 +11,7 @@ import com.sumup.merchant.api.SumUpAPI; import com.sumup.merchant.api.SumUpPayment; +import java.math.BigDecimal; import java.util.UUID; public class MainActivity extends Activity { @@ -37,9 +38,9 @@ public void onClick(View v) { // mandatory parameters // Please go to https://me.sumup.com/developers to get your Affiliate Key by entering the application ID of your app. (e.g. com.sumup.sdksampleapp) .affiliateKey("7ca84f17-84a5-4140-8df6-6ebeed8540fc") - .productAmount(1.23) + .total(new BigDecimal("1.23")) .currency(SumUpPayment.Currency.EUR)// optional: add details - .productTitle("Taxi Ride") + .title("Taxi Ride") .receiptEmail("customer@mail.com") .receiptSMS("+3531234567890") // optional: Add metadata @@ -51,7 +52,7 @@ public void onClick(View v) { .skipSuccessScreen() .build(); - SumUpAPI.openPaymentActivity(MainActivity.this, payment, REQUEST_CODE_PAYMENT); + SumUpAPI.checkout(MainActivity.this, payment, REQUEST_CODE_PAYMENT); } }); @@ -63,7 +64,7 @@ public void onClick(View v) { "sumupmerchant://pay/1.0" + "?affiliate-key=7ca84f17-84a5-4140-8df6-6ebeed8540fc" + "&app-id=com.sumup.apisampleapp" - + "&amount=1.23" + + "&total=1.23" // field available from App version 1.88.0 and above. Otherwise keep deprecated field "amount" + "¤cy=EUR" + "&title=Taxi Ride" + "&receipt-mobilephone=+3531234567890" diff --git a/build.gradle b/build.gradle index b63f3e8..bb5545d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:3.1.2' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a7fc26b..061e4b2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Apr 11 10:08:08 CEST 2017 +#Mon Jun 04 12:03:27 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip