Overview
The Android Native SDK provides three types of integration:
- Android Nuvei Fields Native SDK – Provides a UI element for receiving credit card details from the user and end-to-end payment.
- Android Simply Connect Native SDK – Provides a full checkout experience and end-to-end payment processing for cards and APMs.
- Android Direct Native SDK – Allows to perform 3DS authentication.
SDK Installation
Maven/Gradle Integration
- Inside the app-level build.gradle file, update the repositories section as follows, or add it if it does not exist:
repositories { mavenCentral() maven { url 'https://raw.githubusercontent.com/Nuvei/nuvei-maven-android/master' } }
- In the dependencies section, add:
implementation("com.nuvei.mobile:simply-connect-sdk:+")
Manual Integration
The SDK can be installed manually, as follows:
- Download simply-connect-sdk.aar file.
- Copy the simply-connect-sdk.aar file to the app/libs folder in your project.
- Inside the “dependencies” section of your app/build.gradle file, add the following line:
implementation files('libs/simply-connect-sdk.aar')
Authentication
Authentication for Native Simply Connect is with the Nuvei server-side REST API.
Send the /openOrder
API call, which does the following:
- Authenticates you as our merchant using your given credentials.
- Sets up an order on our system that contains your transaction details, which are referenced later in the payment flow.
Before using the Server SDK, make sure to initialize the SDK before any request by including the relevant SDK initialization.
It is important to set the order from the server-side to prevent front-end user manipulation.
For the/openOrder
authentication, you must create the checksum field. This is a SHA-256 encryption of the concatenation of the following fields in this order:merchantId
, merchantSiteId
, clientRequestId
, amount
, currency
, timeStamp
, and your secret key (merchantSecretKey
) at the end.
Example /openOrder
Request
{ "merchantId":"<your merchantId>", "merchantSiteId":"<your merchantSiteId>", "clientUniqueId":"<unique transaction ID in merchant system>", "clientRequestId":"<unique request ID in merchant system>", "currency":"USD", "amount":"200", "timeStamp":"<YYYYMMDDHHmmss>", "checksum":"<calculated checksum>" }
Example /openOrder
Response
{ "sessionToken": "64fe6953-69d1-440f-8e21-878c85701f09", "orderId": "39272", "merchantId": "427583496191624621", "merchantSiteId": "142033", "clientUniqueId": "12345", "clientRequestId": "1484759782197", "internalRequestId": "866", "status": "SUCCESS", "errCode": "0", "reason": "", "version": "1.0" }
Implementation
To integrate Nuvei payment solutions into your Native mobile apps, follow the steps in the relevant guide:
Android Nuvei Fields Native SDK
Android Simply Connect Native SDK
Android Direct Native SDK
Response Verification
You should verify the payment response that you received on your server-side before storing the complete payment information in your system.
Since the response from the createPayment()
method is returned from the client side, it is vulnerable to manipulation by the end user; therefore, you need to verify the response on your server-side.
Verify the response using one of the methods described below.
Verification by DMN
Because Simply Connect also supports asynchronous APM transactions in which the final transaction status might not be immediately available, use our Direct Merchant Notification (DMN) system to verify the final status. When Nuvei receives the final transaction status from the APM provider, Nuvei sends a DMN containing the final Status
of the transaction (APPROVED or DECLINED) to your webhook endpoint.
Example DMN with Status
=APPROVED
...ppp_status=OK&PPP_TransactionId=547&TransactionId=1110000000004146935&userid=111&merchant_unique_id=234234unique_id&customData=342dssdee&productId=12345product_id&first_name=Diyan&last_name=Yordanov&email=dido%40domain.com&totalAmount=200¤cy=USD&Status=APPROVED,
Verification by /getPaymentStatus
Request
Alternatively, you can call the /getPaymentStatus
API method from your server-side, using the sessionToken
(returned from the /openOrder
and used in the checkout()
method).
Using the sessionToken
retrieves the complete and verified payment response, including additional information about the payment and card used for the transaction.
/getPaymentStatus
can only be called while the session in which the payment was performed is still open. Once the session expires, you receive a “session expired” response.
The /getPaymentStatus
method can only be called at the end of payment processing for that payment. (You can detect the end of payment processing by monitoring the JavaScript events for the final transaction event.)
/getPaymentStatus
is not intended for repeated status polling during the payment processing. Doing so may result in your IP address being blocked.
Example /getPaymentStatus
Request
{ "sessionToken": "274ff0d9-c859-42f5-ae57-997641f93471" }
Example /getPaymentStatus Response
For a full description of responses, refer to /getPaymentStatus
.
{ "transactionStatus": "APPROVED", "gwExtendedErrorCode": 0, "errorCode": 0, "reason": "", "authCode": "075449", "clientRequestId": "9WD9JCZW9", "internalRequestId": 13004281, "version": "1.0", "transactionId": "2110000000001496240", "amount": "10", "currency": "USD", "merchantId": "<your merchantId>", "merchantSiteId": "<your merchantSiteId>", "transactionType": "Sale", "clientUniqueId": "695701003", "errCode": 0, "paymentOption": { "userPaymentOptionId": "7072706", "card": { "uniqueCC": "NuBcbNkc7kBwNExS5j/wgIS8sNk=" } } "sessionToken": "64fe6953-69d1-440f-8e21-878c85701f09", "userTokenId": '<some userTokenId>', "status": "SUCCESS" }
Release Notes
Version | Notes |
---|---|
1.3.2 | Fixed params sent to the backend during 3DS challenge |
1.3.1 | Fixes per version 1.3.0 |
1.3.0 | Updated countryCode handling:
|
1.2.2 | Added Google Pay params |
1.2.1 | Added EnableSafeBrowsing flag |
1.2.0 | Added Serializable interface to some classes used by NVPayment |
1.1.0 |
|
1.0.0 |
|