Download Ccavenue Integration Kit For Android

Posted on

Ford Sync2 headunit OEM touch control Apple CarPlay & Android Auto. Plug and Play easy install. 🛒 https://soso.co.nz/product/ford-sync2-apple-carplay-android. How to download CCAvenue gateway integration kit for Android, iOS and Windows Step 1: Create an Merchant Account Step 2: Login to Merchant Account Step 3. Visit Resources → Mobile Integration Kit → Download Integration Kits. Easy Integration With our detailed integration kit and APIs, integrate and go live with CCAvenue in the. Thanks for sharing a very interesting article about Easy way to integration of ccavenue payment gateway using php. This is very useful information for online blog review readers. Keep it up such a nice posting like this. You need to request for the Android Integration Kit (in addition to your test account credentials such.

Accept mobile payments in any Android App using our native Android SDK. With our mobile SDKs, you do not need to worry about PCI DSS compliance by eliminating the need to send card data to your server. Instead, our libraries send the card data directly to PayU servers which are PCI-DSS Compliant. The PayUmoney mobile SDKs ensure strong encryption and data security to ensure complete peace of mind to your users.

Have a look at the animated image below to understand payment collection through PayUmoney Plug & Play Android SDK.

This integration guide will assist you in integrating with the PayUmoney Android SDK and the PayUmoney Plug n Play module to provide a complete payment experience to your users.

Features Supported

The following features are supported in the PayUmoney Plug and Play Android SDK.

  • Saved Cards
  • Auto-OTP Read and Entry
  • Multiple Payment methods
  • Ready to use Payment UI

Payment Modes Supported

The following payment modes are supported in the PayUmoney Plug and Play Android SDK.

  • EMI
  • UPI
  • Wallets

Prerequisites

Meet the Prerequisites

2

Set up the SDK

Import and configure the PayUmoney PnP SDK

3

Server Side Changes

Calculate the security hash value on your server

4

Set Payments Parameters

Provide details of customer and transaction to the SDK

Response Handling

Verify response hash and display transaction status to the customer

6

Start the Payment Flow

Invoke the function to open the checkout page

5

Set the hash

Build Payment Parameters and set the server computed hash

Getting Started with the Android SDK

This guide will take you through building your app’s payment flow using the PayUmoney Android SDK. The SDK handles collection, storage, and reuse of your user’s payment details, and can also be used to collect billing info. Have a look at the Android SDK Payment Activity Diagram before you take the deep dive.

Prerequisites

Meet the Prerequisites

2

Set up the SDK

Import and configure the PayUmoney PnP SDK

3

Server Side Changes

Calculate the security hash value on your server

4

Set Payments Parameters

Provide details of customer and transaction to the SDK

Response Handling

Verify response hash and display transaction status to the customer

6

Start the Payment Flow

Invoke the function to open the checkout page

5

Set the hash

Build Payment Parameters and set the server computed hash

Prerequisites

  • Sign up with PayUmoney as merchant
  • Get the Merchant Id,Key and Salt, which are available on your merchant dashboard

Selecting the right SDK

The PayUmoney SDK provides a set of optional modules that provide several additional features during Payment Acceptance. Based on your needs, please select the appropriate modules to enhance your user’s payment experience:

  • PayUmoney Core SDK (Mandatory) – This is the base SDK required to accept payments in your app. The Core SDK is mandatorily required. All other modules are optional and work on top of the Core SDK.
  • PayUmoney PnP Module: The PayUmoney PnP (Plug n Play) module provides a rich and well-designed set of ready to use screens that provide a superior payment experience to your users. The PnP module works on top of the PayUmoney Core SDK and allows you to provide multiple payment methods to your users with minimal effort.
  • PayU Custom Browser: The Custom Browser (CB) provides OTP assist features such as auto read of OTP, entry, and submission in the Bank’s 2-Factor authentication page.
Note:
The Core SDK does not contain User Interfaces for accepting payments. If only the Core SDK is used, you must create the UI for displaying the checkout form and the subsequent payment information entry. Please use the PnP module if want a ready-to-use set of checkout UI experiences. To integrate with the Core SDK, please Contact our Integration Support team.

Setting up the PnP SDK

To import and configure the PayUmoney SDK in your project, please implement the following changes in your app:

Import PayUmoney SDK as a Gradle Dependency

In your project’s build.gradle file, please add the PayUmoney Plug and Play (PnP) SDK module as a dependency by adding the following line:

Calculate Server-Side Hash

Download Ccavenue Integration Kit For Android Sdk

The only server side change required while integrating PayUmoney Android SDK is generating a hash parameter for both the payment request & response.

A hash is an encrypted value (checksum) that must be sent by the merchant in a payment request that is then sent back by PayUmoney in the payment response. A hash is used to protect transactions against “man in the middle” attacks.

Hash Generation for Payment Request

Use the following sample java sequence to generate a request hash.

Note:
The entire hash logic is built on the assumption ‘Salt’ is always safe with the merchant. Hence, it is very important for the merchant to keep the ‘Salt’ safe by adhering to the best security practices. For eg: Merchant should always compute from the server side and never from the client side, should never share the ‘Salt’ & ‘Key’ over emails or directly commit on public repositories like Github.

Set Payments Params

To start using the PayUmoney PnP SDK, you need you initialize the SDK by providing details about the customer and the transaction. Please use the sample code provided below to setup the SDK initializer.

The ‘udf’ fields below stand for ‘user defined field’. These are optional fields to pass custom information about the transaction to PayUmoney. You may pass up to 5 UDF fields.

Build payment params and set the hash

The hash computed on the server side should be passed as an input parameter to the transaction request and hence needs to be passed to the SDK as shown below:

Start the Payment Flow

Invoke the following function to open the checkout page. The Customer will now interact with PayUmoney screens till the transaction is complete.

Inputs:

  • PayUmoneySdkInitializer.PaymentParam – paymentparams (initialized in step 2)
  • Activity – activity context
  • Style – theme resource

Example:
<style name=”AppTheme.Green” parent=”PayumoneyAppTheme”>
<item name=”colorPrimary”>@color/persian_green_primary</item>
<item name=”colorPrimaryDark”>@color/persian_green_dark</item>
<item name=”colorAccent”>@color/persian_green_accent</item>
<item name=”colorButtonNormal”>@color/persian_green_primary</item>
<item name=”alertDialogTheme”>@style/AlertDialogStyle_green</item>
<item name=”actionMenuTextColor”>@color/white</item>
</style>

  • isOverrideResultScreenFalse – PNP will take care of Transaction result screen
    True – merchant will take care of Transaction result screen

Start the Payment Flow

Invoke the following function to open the checkout page. The Customer will now interact with PayUmoney screens till the transaction is complete.

Inputs:

    • PayUmoneySdkInitializer.PaymentParam – paymentparams (initialized in step 2)
    • Activity – activity context
    • Style – theme resource

Example:
<style name=”AppTheme.Green” parent=”PayumoneyAppTheme”>
<item name=”colorPrimary”>@color/persian_green_primary</item>
<item name=”colorPrimaryDark”>@color/persian_green_dark</item>
<item name=”colorAccent”>@color/persian_green_accent</item>
<item name=”colorButtonNormal”>@color/persian_green_primary</item>
<item name=”alertDialogTheme”>@style/AlertDialogStyle_green</item>
<item name=”actionMenuTextColor”>@color/white</item>
</style>

  • isOverrideResultScreenFalse – PNP will take care of Transaction result screen
    True – merchant will take care of Transaction result screen

Response Handling

The PayUmoney SDK provides default response handling and screens thereby removing the need for you to create your own screens or handle the response from the PayUmoney server.

The default screens are illustrated in the screenshots below:

Download ccavenue integration kit for android developers

If you need custom screens for transaction success and failure, please review the steps below.

When making a payment using the PayUmoney Android SDK gives two types of payment response:

  • A client-side response in the callback function
  • A server to server callback on the Webhook, if set from the PayUmoney dashboard.

To know when the payment has completed, override the onActivityResult in your activity as exemplified in the sample code below

Blue iris 3 key generator. Now, you will need to add these lines of JavaScript to your success and failure pages (SURL, FURL) for the Android SDK to be able to detect the result.

Success Page:
PayUmoney.success()

Failure Page:
PayUmoney.failure()

Download Ccavenue Integration Kit For Android Tv Box

Before transaction response is displayed to the user, please verify the authenticity of the transaction by
generating a response hash.
The hash generated by you should match the one send by PayUmoney in response.

Managing User Login

The PayUmoney SDK provides a simple mechanism to allow users to log into their PayUmoney account and utilize features such a Saved Cards, PayUmoney wallet balance etc when making payments.

  • isUserLoggedIn() – Return true if user is logged in else return false
  • logoutUser() – Log out logged in user

Order Review

Through the PayUmoney PnP SDK, you can provide an interface to your users to allow them to review an order’s details. To display a review order screen, you will need to pass the details of the order that you want to display. While the SDK controls the look and feel of the Order Review screen, the content itself is defined by you.

To set the order details, pass the information to the PnP SDK in the form of key:value pairs with the key being the row descriptor and the value being the corresponding value associated with that descriptor.

For example:

Testing the Integration

For using SDK in test mode you need to follow the below-mentioned steps.

  1. PayUmoneySdkInitializer.PaymentParam.Builder().setIsDebug(true)
  2. Send the SURL/FURL, MerchantId and key accordingly for test and live mode.Goto ‘Parameters Section’ to know what this means.
S.No.Parameter NameRequiredValue
1.keyCompulsoryMerchant key provided by PayUmoney
2.TxnidCompulsoryUnique transaction id to be sent by the merchant.
3.AmountCompulsoryPayment amount (Type cast to float)
4.ProductInfoCompulsoryProduct Description
5.firstNameCompulsoryOnly alphabets a-z are allowed
6.EmailCompulsoryCustomer’s email id
7.phoneCompulsoryMobile or landline number (numerics only)
8.udf1User defined field 1
9.udf2User defined field 2
10.udf3User defined field 3
11.udf4User defined field 4
12.udf5User defined field 5
13.SURLCompulsoryURL called on payment completion
14.FURLCompulsoryURL called on payment failure
15.hashCompulsoryHash or Checksum = sha512(key txnid amount productinfo firstname email udf1 udf2 udf3 udf4 udf5 salt) (SALT is provided by PayUmoney)
Note:
udf1 to udf5 are user-defined fields. These are meant to send any additional values that you need to post. However, if you don’t feel the need to post any additional params, even then you will need post these params with blank values.
S.No.Parameter NameDescriptionSample Value
1.statusTransaction Status. (Described in detail in the Transaction Status section)success
2.firstnameFirstname of the payerTom
3.amountTransaction Amount1.0
4.txnidTransaction Id passed by the merchant0nf725
5.hashSecurity hash generated in response to protect against data tampering. Merchant is required to generate a response hash and verify it against this hash. 127e2c44016aa4c3dd5bacc09b0239b09c6174f275c0ec4c8ec7da3db915a754407849cf2537f8655255ac54ee652c4ef972c721462ec9d0a67c08b66bdbb6ba
6.productinfoBook1
7.mobileMobile No of the payer7406740707
8.emailEmail Id of the payerabc@payu.in
9.payuMoneyIdThe PayUmoney transaction id.144190307
10.modePayment Mode in:
  • Netbanking (NB)
  • Debit Card(DC)
  • Credit Card(CC)
NB

Transaction Response Parameters

This section contains the details about different response parameters encountered when transacting using PayUmoney.

Transaction Status

A transaction can have several different statuses as explained in the table below.

S.No.StatusDescription
1.Not StartedThe transaction has not been started yet.
2.InitiatedThe transaction has been started but not completed.
3.Money With PayUmoneyThe transaction was successful and the transaction amount is with PayUmoney.
4.Under DisputeA dispute for the transaction has been raised.
5.RefundedThe entire amount of the transaction has been refunded.
6.Partially RefundedA part of the amount of the transaction has been refunded.
7.BouncedIncomplete or no details provided at PayUmoney payment page.
8.FailedThe transaction didn’t complete due to a failure.
9.Settlement in ProcessSettlement for the transaction is in process.
10.CompletedThe transaction is settled and complete.

Sample App

To understand the PayUmoney payment flow, you may download and install our sample app and choose to Pay using PayUmoney.

Download Link: https://github.com/payu-intrepos/payumoney-new-sample-app

We recently made an Android app and a web-app for our client (Kabra Express) with CCAvenue as the payment gateway. Kabra Express is one of the largest travel company in Gujarat and has operations throughout the country.

CCAvenue is one of the biggest payment gateways in India. It supports multiple payment options, mobile payments (via WebView) and is highly secure.

Download Ccavenue Integration Kit For Android Download

However, the lack of proper documentation makes its integration with mobile apps a bit troublesome. Looking at how many people use CCAvenue, we decided to help the community by writing an article on it’s integration with Android.

Prerequisites

  1. Get your public IP address whitelisted at CCAvenue in both production and staging environment (mail them about it, mentioning your merchant ID)
  2. Get access code and encryption key from the dashboard. For this, you’ll need to ask the support to generate these for your hosts (like localhost or example.com etc).

The whole mechanism relies on RSA. RSA (Rivest–Shamir–Adleman) is one of the first public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and it is different from the decryption key which is kept secret (private).

Download Ccavenue Integration Kit For Android Developers

This request/response flow, as it happens

  1. Mobile app sends a request to the PHP server for RSA keys.
  2. The PHP server calls the CCAvenue server, with the access code and a unique order ID.
  3. CCAvenue replies with a text string which is the RSA key.
  4. This RSA keys is then sent back to the Android app in the response.
  5. Using the RSA key, the mobile app encrypts the payment information like customer info, order id, amount etc and performs a POST request using WebView to reach the CCAvenue payment page. The fields that are encrypted includes amount, currency, billing_tel (phone number), billing_email, billing_name. The user is presented with the CCAvenue payment page.
  6. Depending on the payment status (success/failure), CCAvenue redirects the user to the respective URL on the PHP server.
  7. The server, after parsing the gateway response, returns an HTML page (to the WebView) which has the Java-JS bridging code. The Java code is executed from the JS (inside the HTML page) and the user is sent to the activity in the app accordingly.

Explaining the flow

Step 1, 2, 3 and 4: All these steps happen in a single request-response cycle, initiated by the mobile app. The PHP server gets a request for RSA key from the app, it calls CCAvenue API using cURL. An example code is below:

The response sent by the server will have the RSA key (from the above code), order id (must be unique and a whole number), access code, merchant id, redirect (success) and cancel URLs.

As soon as the app gets this RSA key (and other parameters in response), it encrypts amount, currency, billing_tel (phone number), billing_email, billing_name using this key. The Java code for encryption method is below:

The string returned by this method is POSTed to CCAvenue’s transaction URL via a WebView (code provided below) along with other parameters received from the server. The payment page is now presented to the user. Depending on the success or failure of the payment, the server and then the app will get the response.

Now comes the interesting part. You must be wondering- how does our app know if the payment was successful or failure? After all, the WebView is completely detached from the normal flow of the app as it renders HTML pages. The magic lies in the JS-Java bridge that allows execution of Java from JavaScript in Android! You can read more about it here.

Here’s how it happens (assuming that the payment has been made successfully):

The success URL sent to CCAvenue is our server’s URL. This URL when hit on redirection, will cause a series of events: response decryption, transaction status checks, updating the database, sending relevant emails and finally returning an HTML page in the response (Keep in mind that it’s the WebView that’s getting redirected along with the POST data from CCAvenue). This HTML is extremely simple:

See the line Payment.onSucess()? This is the magic sauce.

We attach something called as a JavaScript interface to the WebView. This interface is given a name (Payment, in our case). This interface’s object is made available to JS and it calls the methods of its equivalent Java class. A sample code is below:

As you can see, “Payment” is just a simple class with two methods and @JavascriptInterface annotation. This annotation tells the WebView to bind JS-Java objects together and hence, calling Payment.onSuccess from JS is similar to calling it from Java!

onSucess() sets the result code, and finishes the WebView activity. This way our app know if the payment was successful or failure.

This concludes the journey of integrating CCAvenue in an Android app in case of non-seamless integration. We almost always prefer this way when integrating other payment gateways too (if they don’t have an SDK). We also almost always go with non-seamless integration as it requires little adherence to compliance.