Check the following high-level procedure to implement Revolut Pay on your website. Use the dropdowns to see the details of each step:
Before you start this tutorial, ensure that you have completed the following steps:
Since the SDK is hosted on mavenCentral
, to fetch the dependency add the following lines to your project level build.gradle
:
allprojects {
repositories {
mavenCentral()
}
}
Add the dependency to the module level build.gradle
:
implementation 'com.revolut:revolutpayments:1.0.0'
implementation 'com.revolut:revolutpay:2.0.3'
Sync your project
The minimum Android SDK version that is supported by the SDK is Android 5.0 (API 21).
Initialize the SDK by invoking RevolutPayments.revolutPay.init(environment: RevolutPayEnvironment, returnUri: Uri, merchantPublicKey: String, requestShipping: Boolean, customer: Customer?)
, where you will need to define:
environment
: either MAIN
or SANDBOX
. Use the Revolut Business Sandbox environment to test your Merchant account integration before you push the code changes to the production environment.
returnUri
: a Uri that represents a deep link used by the Revolut app, to return to your app after the payment is confirmed or rejected. This will greatly improve the customer experience, as it will allow them to return to your app after authorizing the payment.
The deep link should be registered in manifest to allow opening an activity, if you want to support automatic redirection.
The returnUri
might be based on a custom host
-scheme
combination that can be defined within your application.
Here is an example of an activity that can handle returnUri
(note that launchMode
should be set to singleTop
, otherwise it will not be possible to return to your app):
<activity
android:name=".MainActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="return_uri_host"
android:scheme="return_uri_scheme" />
</intent-filter>
</activity>
merchantPublicKey
: a public key for your merchant account from Revolut console.
requestShipping
: If you want the shipping address and delivery method to be quickly collected from the user through Revolut Pay, pass the requestShipping
parameter as true
.
This way, your app can skip the shipping flow during checkout and the user can use existing shipping details stored by Revolut Pay.
By default, Fast checkout is not enabled.
Your backend must support Fast checkout for this functionality to work. For more information, see: Implement Revolut Pay with Fast checkout.
customer
: object containing customer details the merchant already has (name, email, phone number, date of birth).
For more details about the available parameters, see: Parameters: Android
Now you can integrate the Revolut Pay button into your layout. It can be done either by including it in your .xml
file, or by creating it via RevolutPayments.revolutPay.provideButton()
method.
Since the SDK relies on the internet connection to process your order, you need to make sure that the internet permission is added to your app. In case it isn't, add the following line to the manifest:
<queries>
<package android:name="com.revolut.revolut" />
</queries>
You can add the Revolut Pay button to your app in the following two ways:
In case you want to create a button from code, you can use the RevolutPayments.revolutPay.provideButton()
method, which has the following parameters:
context
- an instance of context used to create a view
buttonParams
- a set of parameters allowing to setup the appearance of the button
RevolutPayments.revolutPay.provideButton(
context: Context,
params: ButtonParams
): RevolutPayButton
For more details about the available parameters, see: Parameters: Android
Check out the follow pages for further information about: