diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml
index aa8485c75..45e3dd3cb 100644
--- a/example/src/main/AndroidManifest.xml
+++ b/example/src/main/AndroidManifest.xml
@@ -27,6 +27,22 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/src/main/kotlin/com/processout/example/redirect/MerchantRedirectActivity.kt b/example/src/main/kotlin/com/processout/example/redirect/MerchantRedirectActivity.kt
new file mode 100644
index 000000000..d8f42d678
--- /dev/null
+++ b/example/src/main/kotlin/com/processout/example/redirect/MerchantRedirectActivity.kt
@@ -0,0 +1,17 @@
+package com.processout.example.redirect
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import com.processout.sdk.api.ProcessOut
+
+class MerchantRedirectActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ ProcessOut.instance.processDeepLink(
+ activity = this,
+ uri = intent.data
+ )
+ finish()
+ }
+}
diff --git a/example/src/main/kotlin/com/processout/example/shared/Constants.kt b/example/src/main/kotlin/com/processout/example/shared/Constants.kt
index 8483003e2..486bf5b51 100644
--- a/example/src/main/kotlin/com/processout/example/shared/Constants.kt
+++ b/example/src/main/kotlin/com/processout/example/shared/Constants.kt
@@ -3,5 +3,6 @@ package com.processout.example.shared
import com.processout.example.BuildConfig
object Constants {
- const val RETURN_URL = "${BuildConfig.APPLICATION_ID}://processout/return"
+ const val DEFAULT_RETURN_URL = "${BuildConfig.APPLICATION_ID}://processout/return"
+ const val MERCHANT_RETURN_URL = "merchant://example/return"
}
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentFragment.kt b/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentFragment.kt
index ad9da8f1e..3ad13f8ed 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentFragment.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentFragment.kt
@@ -117,7 +117,7 @@ class CardPaymentFragment : BaseFragment(
delegate = Netcetera3DS2ServiceDelegate(
provideActivity = { POCardTokenizationActivity.instance },
customTabLauncher = customTabLauncher,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
),
configuration = PONetcetera3DS2ServiceConfiguration(
bridgingExtensionVersion = BridgingMessageExtensionVersion.V20
@@ -130,7 +130,7 @@ class CardPaymentFragment : BaseFragment(
delegate = Checkout3DSServiceDelegate(
activity = requireActivity(),
customTabLauncher = customTabLauncher,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
)
).build()
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentViewModel.kt b/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentViewModel.kt
index 84fe6286e..49551d20e 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentViewModel.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/card/payment/CardPaymentViewModel.kt
@@ -66,7 +66,7 @@ class CardPaymentViewModel(
amount = state.amount,
currency = state.currency,
customerId = state.customerId,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
)
).getOrNull()
_state.update { it.copy(invoiceId = invoice?.id) }
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DefaultDynamicCheckoutDelegate.kt b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DefaultDynamicCheckoutDelegate.kt
index 155ceee42..99843217b 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DefaultDynamicCheckoutDelegate.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DefaultDynamicCheckoutDelegate.kt
@@ -43,7 +43,7 @@ class DefaultDynamicCheckoutDelegate(
amount = details.amount,
currency = details.currency,
customerId = customerId,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
)
)
}
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutFragment.kt b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutFragment.kt
index 3d9dbe3e3..f3f772c4e 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutFragment.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutFragment.kt
@@ -98,7 +98,7 @@ class DynamicCheckoutFragment : BaseFragment(
clientSecret = uiModel.clientSecret
),
alternativePayment = AlternativePaymentConfiguration(
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
)
)
)
@@ -111,7 +111,7 @@ class DynamicCheckoutFragment : BaseFragment(
delegate = Netcetera3DS2ServiceDelegate(
provideActivity = { PODynamicCheckoutActivity.instance },
customTabLauncher = customTabLauncher,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
),
configuration = PONetcetera3DS2ServiceConfiguration(
bridgingExtensionVersion = BridgingMessageExtensionVersion.V20
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutViewModel.kt b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutViewModel.kt
index b4cbf18bd..cc3f82d90 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutViewModel.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/checkout/DynamicCheckoutViewModel.kt
@@ -59,7 +59,7 @@ class DynamicCheckoutViewModel(
amount = details.amount,
currency = details.currency,
customerId = customerId,
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.DEFAULT_RETURN_URL
)
).onSuccess { invoice ->
_uiState.value = Submitted(
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmFragment.kt b/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmFragment.kt
index d04aeb8fb..0a7433b64 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmFragment.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmFragment.kt
@@ -120,7 +120,8 @@ class NativeApmFragment : BaseFragment(
),
cancelButton = CancelButton(),
redirect = RedirectConfiguration(
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.MERCHANT_RETURN_URL,
+ enableHeadlessMode = true
),
paymentConfirmation = PaymentConfirmationConfiguration(
confirmButton = Button(),
@@ -137,7 +138,7 @@ class NativeApmFragment : BaseFragment(
),
cancelButton = CancelButton(),
redirect = RedirectConfiguration(
- returnUrl = Constants.RETURN_URL,
+ returnUrl = Constants.MERCHANT_RETURN_URL,
enableHeadlessMode = true
),
paymentConfirmation = PaymentConfirmationConfiguration(
@@ -162,7 +163,7 @@ class NativeApmFragment : BaseFragment(
),
cancelButton = CancelButton(),
redirect = RedirectConfiguration(
- returnUrl = Constants.RETURN_URL
+ returnUrl = Constants.MERCHANT_RETURN_URL
),
paymentConfirmation = PaymentConfirmationConfiguration(
confirmButton = Button(),
diff --git a/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmViewModel.kt b/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmViewModel.kt
index ceea8af0e..6f5acae7f 100644
--- a/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmViewModel.kt
+++ b/example/src/main/kotlin/com/processout/example/ui/screen/nativeapm/NativeApmViewModel.kt
@@ -62,7 +62,7 @@ class NativeApmViewModel(
amount = amount,
currency = currency,
customerId = customerId,
- returnUrl = Constants.RETURN_URL,
+ returnUrl = Constants.MERCHANT_RETURN_URL,
shipping = POContact(
address1 = "6th Street",
city = "Paris",
diff --git a/sdk/src/main/kotlin/com/processout/sdk/api/ProcessOut.kt b/sdk/src/main/kotlin/com/processout/sdk/api/ProcessOut.kt
index 047bf69db..da18c93c7 100644
--- a/sdk/src/main/kotlin/com/processout/sdk/api/ProcessOut.kt
+++ b/sdk/src/main/kotlin/com/processout/sdk/api/ProcessOut.kt
@@ -2,6 +2,9 @@
package com.processout.sdk.api
+import android.app.Activity
+import android.content.Intent
+import android.net.Uri
import com.processout.processout_sdk.ProcessOutLegacyAccessor
import com.processout.sdk.BuildConfig
import com.processout.sdk.api.dispatcher.PODefaultEventDispatchers
@@ -17,6 +20,7 @@ import com.processout.sdk.api.service.POCustomerTokensService
import com.processout.sdk.api.service.POInvoicesService
import com.processout.sdk.core.logger.POLogger
import com.processout.sdk.di.*
+import com.processout.sdk.ui.web.customtab.POCustomTabAuthorizationActivity
/**
* Entry point to ProcessOut Android SDK.
@@ -70,6 +74,19 @@ class ProcessOut private constructor(
dispatchers.nativeAlternativePaymentMethod
}
+ /**
+ * Processes an incoming deep/app link received by your app.
+ * Call this method even when [uri] is _null_ to complete the flow correctly.
+ */
+ fun processDeepLink(activity: Activity, uri: Uri?) {
+ POLogger.info("Processing deep link: %s", uri)
+ val intent = Intent(activity, POCustomTabAuthorizationActivity::class.java)
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
+ intent.data = uri
+ activity.startActivity(intent)
+ }
+
/**
* Entry point to ProcessOut Android SDK.
* Provides configuration and access to services.
diff --git a/sdk/src/main/kotlin/com/processout/sdk/ui/web/customtab/POCustomTabAuthorizationActivity.kt b/sdk/src/main/kotlin/com/processout/sdk/ui/web/customtab/POCustomTabAuthorizationActivity.kt
index 6cb5909f8..c124c87d1 100644
--- a/sdk/src/main/kotlin/com/processout/sdk/ui/web/customtab/POCustomTabAuthorizationActivity.kt
+++ b/sdk/src/main/kotlin/com/processout/sdk/ui/web/customtab/POCustomTabAuthorizationActivity.kt
@@ -69,8 +69,8 @@ class POCustomTabAuthorizationActivity : AppCompatActivity() {
if (!::configuration.isInitialized) {
POLogger.info(
- "Configuration is not provided. Activity is finished immediately before it's created. " +
- "Possibly started from the redirect activity by a deep link when the flow is already finished."
+ message = "Configuration is not provided. Activity is finished immediately before it's created. " +
+ "Possibly started from the redirect activity by a deep link."
)
finish()
return