Building your own Dating App: Tutorial #2

The concept of dating cannot be put into the exact timeline. Humans have been known to date their counterparts for as long as they have set foot on this earth.

Team CometChat • Apr 21, 2020

The concept of dating cannot be put into the exact timeline. Humans have been known to date their counterparts for as long as they have set foot on this earth.

With time, the methods, approach, the process has seen its fair share of nuances. But the core idea of dating has remained the same since time immemorial.

Tinder, Happn, eHarmony, OKCupid etc are some of the big names in the online dating industry. But it does not end there. These are the old players who have tasted success in the very early stages.

This is because people love to connect with each other especially when they know that they are on a shared platform where each one of them is looking for something common: a partner to date.

Once you have decided to build a market leader similar dating app, the valuation of your app has already been done. There are multiple success stories where similar prevailed and succeeded in their niche.

Without much ado, here is your guide to making a great dating app.

What will you learn:

  • Ways to build a dating app

  • Building a dating app MVP

  • Structural optimization and performance scalability of the app

How to create a dating app?

There are multiple ways you can opt for when creating a dating app.

  • Develop and configure a custom app

  • Use a robust online app builder software

  • Use and modify a clone script

Develop and configure a custom app

Developing a custom app is like staring in the face of a blank slate. You start with nothing but an idea in the mind and keep improvising while on the way up.

A custom built dating app can either be native or cross-platform. Considering the huge leaps in technology, today we have cross-platform native apps which can easily streamline your business across mobile audience.

Strudel is one such example of a Nativescript app. It’s a dating app that runs on iOS and Android that lets users find matches and share their interests.

A custom-made app requires a backend entity to function and a database to store the entire data. Most of these apps are built natively making them more efficient.

The bright side to building dating apps this way is that they favor repetitive product development and siphons an agile approach towards development. Every step can be managed and controlled through a centralized node through this approach.

If additional costs are not something you would worry about in order to develop a state-of-the-art app, then using the custom development approach is a smart move to make.

If you completely believe in your idea, developing a Tinder similar app or a custom dating app is the right choice.

A standard path to developing a custom app looks something like this:

  • Planning stage involving product manager, marketer, and business analysts

  • Technical documentation describing all the tech requirements

  • Prototyping stage

  • Development stage- Frontend and backend development

  • Quality assurance and testing

  • Publishing and maintenance

Using an online app builder

The best part about using an app builder is that they save a lot of time and usually it's just dragand drop that one needs to do most of the times.

Having an in-depth technical knowledge is not a prerequisite here. If you play around a little bit, you will get the hang of it in a couple of hours. Creating user interfaces, tweaking backend functions etc can be easily managed with the help of an app builder.

These WYSIWYG builders host your application and keep your backend intact. Most of the UI elements are provided by them which can be used to make your dating app. All the necessary documentation and timely support is provided by them.

There are two types of such app builders:

  • Privately held

  • Open source

Appypie is an example of a privately held app builder where they provide all the necessary backend and frontend support, including UI elements, hosting, and documentation.

Another example is an open source dating software. It requires technical know-how from an individual in order to construct the dating app. Ph7CMS is a great dating app builder open source software.

All the required source code and major components are inbuilt into the software. What one needs is the technical understanding of data migration, compilation, data configuration etc.

In most cases, when using an online app builder, there are certain limitations in terms of optimization, customization, and innovative features. All these limiting factors get eliminated when using a custom software to build the dating app.

Use and modify a clone script

A clone script is basically a replica of the source code of an existing popular app.

These scripts are easily available on online marketplaces. There are dozens of Tinder similar clone scripts available in the market. Once you have the clone script it is easy to find someone who can help you upload the app to the relevant app stores.

Is this scalable?

Innovation is the key to success in any business. Simply by copying and pasting the clone script alone won’t catapult the app towards success.

When you have the source code or the clone script, even if you innovate 10% on the actual code, there is a chance people might love your app and find it interesting.

However, relying completely upon the clone script might not seem like a good idea.

Chances are that the code may not have proper documentation or comments in place to further tweak or understand the code. Also, in most case, such clone scripts are poorly written and they won’t scale at all.

Only if you feel there is a market for your business and you can innovate with the help of the clone script, should you opt for buying one.

Let’s move to the technical side of creating a dating app now.

Building a Dating app MVP

In order to create one such MVP, you should know about iOS, Android, and backend development. Today, in order to create an app, one should know Objective C & Swift for iOS app development and Java for Android app development.

Backend languages include the technical know-how of Javascript, PHP or any such language based on the subjective preference. The most decent approach in such cases is to follow the minimum viable product way.

This is a mistake even large startups make; often underestimate the importance of an MVP. When Tinder was about to move from 20k users to 500k users overnight, Sean Rad, Tinder’s co-founder was under extreme pressure because they had not defined a proper MVP.

Arum Kang, Co-Founder of Coffee Meets Bagel says, “Sometimes during the initial stages you feel like you really need that feature in your product but later realize you actually don’t need it. And sometimes you completely miss out on the most basic features that defines your product. That is why having a minimum viable product defined is important.”

What could be the MVP for a dating app?

  • User signup and login

  • User authentication through social media like Facebook

  • Basic functionality to ‘like’ or ‘dislike’ on a profile

  • Basic admin tools for creating matches

  • Ability to chat through the app

After defining the MVP for your dating application, let’s look at the core features within the app

Any features within the app should be there for performance, usability, and security. These are the core foundational features that drive your product.

  • Swipe gestures or swipe cards

  • User matching algorithm

  • Content moderation

  • Geolocation

  • Real time chat support

Creating Swipe Gestures

Swipe gestures are a favorite among the users and quite user-friendly for a dating app. However one needs to optimize these swipe cards depending upon the target audience.

Below are some of the factors you need to consider before implementing the swipe card feature:

  • How much the card should shrink or fade upon the swipe

  • What will be its angle of rotation and its strength

  • Distance from the middle depending upon an action to take place

  • How far should the user swipe in order to swap the card

  • The opacity and color variation upon the touch

All these features run in the frontend for the users. Coming to the backend, There is no ‘easiest’ way to make a scalable app.

Tinder uses swipe to choose feature where swiping left on the card reflects ‘Like’ and swiping right on the card reflects ‘Dislike’.

The following is an example of how you can use MDCSwipeToChooseView to display a photo in iOS. Where the users can choose to delete the picture upon swiping towards left or save it by swiping right.

Objective-C

#import

// ... in a view controller

#pragma mark - Creating and Customizing a MDCSwipeToChooseView

- (void)viewDidLoad {
[super viewDidLoad];

// You can customize MDCSwipeToChooseView using MDCSwipeToChooseViewOptions.
MDCSwipeToChooseViewOptions *options = [MDCSwipeToChooseViewOptions new];
options.likedText = @"Keep";
options.likedColor = [UIColor blueColor];
options.nopeText = @"Delete";
options.onPan = ^(MDCPanState *state){
if (state.thresholdRatio == 1.f && state.direction == MDCSwipeDirectionLeft) {
NSLog(@"Let go now to delete the photo!");
}
};

MDCSwipeToChooseView *view = [[MDCSwipeToChooseView alloc] initWithFrame:self.view.bounds
options:options];
view.imageView.image = [UIImage imageNamed:@"photo"];
[self.view addSubview:view];
}

#pragma mark - MDCSwipeToChooseDelegate Callbacks

// This is called when a user didn't fully swipe left or right.
- (void)viewDidCancelSwipe:(UIView *)view {
NSLog(@"Couldn't decide, huh?");
}

// Sent before a choice is made. Cancel the choice by returning `NO`. Otherwise return `YES`.
- (BOOL)view:(UIView *)view shouldBeChosenWithDirection:(MDCSwipeDirection)direction {
if (direction == MDCSwipeDirectionLeft) {
return YES;
} else {
// Snap the view back and cancel the choice.
[UIView animateWithDuration:0.16 animations:^{
view.transform = CGAffineTransformIdentity;
view.center = [view superview].center;
}];
return NO;
}
}

// This is called then a user swipes the view fully left or right.
- (void)view:(UIView *)view wasChosenWithDirection:(MDCSwipeDirection)direction {
if (direction == MDCSwipeDirectionLeft) {
NSLog(@"Photo deleted!");
} else {
NSLog(@"Photo saved!");
}
}

Swift

To use objective-c code from swift, you need to use bridging-header.

#ifndef BridgingHeader_h
#define BridgingHeader_h
#import
#import
#endif
import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

let options = MDCSwipeToChooseViewOptions()
options.delegate = self
options.likedText = "Keep"
options.likedColor = UIColor.blue
options.nopeText = "Delete"
options.nopeColor = UIColor.red
options.onPan = { state -> Void in
if state?.thresholdRatio == 1 && state?.direction == .left {
print("Photo deleted!")
}
}

let view = MDCSwipeToChooseView(frame: self.view.bounds, options: options)
view?.imageView.image = UIImage(named: "photo.png")
self.view.addSubview(view!)
}

}

extension ViewController: MDCSwipeToChooseDelegate {

// This is called when a user didn't fully swipe left or right.
func viewDidCancelSwipe(_ view: UIView) -> Void{
print("Couldn't decide, huh?")
}

// Sent before a choice is made. Cancel the choice by returning `false`. Otherwise return `true`.
func view(_ view: UIView, shouldBeChosenWith: MDCSwipeDirection) -> Bool {
if shouldBeChosenWith == .left {
return true
} else {
// Snap the view back and cancel the choice.
UIView.animate(withDuration: 0.16, animations: { () -> Void in
view.transform = CGAffineTransform.identity
view.center = view.superview!.center
})
return false
}
}

// This is called when a user swipes the view fully left or right.
func view(_ view: UIView, wasChosenWith: MDCSwipeDirection) -> Void {
if wasChosenWith == .left {
print("Photo deleted!")
} else {
print("Photo saved!")
}
}
}

Backend Functionality

For a minimum viable product, a MySQL + MongoDB database along with Node.js works best for similar applications.

People have recommended using standalone MongoDB for dating apps. Even Tinder used MongoDB. However, this cannot be hailed as the best way. They arise because of the myths surrounding MongoDB. Tinder, too, ran into trouble while using MongoDB.

According to experts, designing a database on MongoDB is a bit tricky. It calls for you to plan well in advance what features you wish to implement for the app and what information you would need to extract from it.

This becomes a bit cumbersome since most apps are driven by agile approach. In order to make this easier, shift all your non-structured data of the app to MongoDB and place all your structured data on MySQL database.

Node.js and API Caching

A dating application functions on variable tasks. Both, from the user’s end and from the server end. This makes Node.js the best choice. When we focus on static content (Images), Node.js doesn’t go well with it.

This problem can be solved with a caching mechanism. This gives a huge boost to Node.js. In this manner, any request with caching appears to have been processed immediately for the end user.

As we know, caching stores information temporarily so that it is easily retrievable whenever there is a request generated from the user’s end. The caching mechanism reduces and multiplexes the HTTP connections, and maintains persistent WebSocket connections.

This is a way one can bring down the number of calls that your app needs to make to your primary database. There are three ways to implement caching in your app:

  • Direct connect caching

  • Local cache

  • API Caching layer

Remember that we are taking into account the MVP. Once the app passes through the bottleneck and is ready to scale, you can include all these three caching mechanisms to serve different purposes.

Scalability

Once you have crossed the MVP phase, your app needs to be made more scalable. It needs to be ready to handle unprecedented amount of traffic and requests. For this, you will need to optimize the server queue.

Instead of opting for N Servers + N queues or Single Server + Single Queue, the preferable model is to opt for Single queue + N servers.

The N depends upon the incoming traffic on your application. Below is the most basic example of how this works:

Once the server deployment is completed, any further tasks can be taken into account. Your app should now anticipate more traffic.

Consider a) What will happen when you take your app live? How many users might log in at one moment? How many messages will be sent and received at one go. b) What are the risks? c) How will you be able to move to a new arrangement if required?

Security

Since a lot of personal data is stored on the dating application’s database, it becomes a favourite target for inappropriate elements to steal and misuse the data.

Dating apps works on one core module- Geolocation. Users share their location with the servers.

On the frontend, users see the terms such as ‘3 miles away’ or ‘6 miles away’. If a hacker, with good backend knowledge, is trying to infiltrate the user’s information, he may be able to find the user distances in the form of decimals. For example, ‘3.06551’ or ‘6.21112’.

Now, the hacker will create multiple profiles on the app. And he will check the user’s location using all the three profiles. This will give him three arbitrary locations such as 3.06551, 3.07558, and 3.11221.

There is a method called ‘Trilateration’, with the help of which anyone can get a near perfect approximation of the targeted user.

To avoid this from happening, simply do not provide accurate location information to your mobile user interface.

Decompilation

Another way online hoodlums exploit your website’s data is through decompiling your app. It is very easy to decompile your app and once the code has been decompiled, there are various ways through which hackers can:

  • Flush out any hard coded third party backend IDs and login details of the users.

  • See debug messages if not shut down by the app developers already. With debug messages, hackers can gain access to potential stream of sensitive information.

In order to prevent this: render obscure the source code. Do not keep the source code in plain simple text. Make sure any login credentials are not hard key coded within the source code.

Cryptographic Hashing and Data Encryption

Data breach is one of the most common types of online fraud. Due to weak or no encryption and negligence, personal data of users gets into the wrong hands. Hence, it is necessary that each communication that takes place between the server and the app should be encrypted.

In most cases, a PGP based cryptographic encryption is enough to provide a strong security. In order to get an overview, here is what you need to do in order to integrate GnuPG (PGP/GPG).

Assuming that you have installed the software and generated a public/private key, the next step involves:

Encrypting using the public key

Note:- This is a hypothetical example.

Create a plain text file called "my-secrets-myname.txt" using a text editor.

My name is "My Name"
My credit card number is 1234-5678-9012-3456
The password for my phone is 42

Now encrypt the file:

gpg -e my-secrets-myname.txt

GPG is going to tell, you didn't include a recipient/user ID

You did not specify a user ID. (you may use "-r")
Current recipients:
Enter the user ID. End with an empty line:

Insert an email id , in this case: john@dover.com

Current recipients:
2048R/3BE8FE75 2013-07-30 "John Dover (sanog key) "

Once done, GPG will perform the required actions voluntarily.

$ ls -l my-secrets-myname.txt*
-rw-rw-r-- 1 sanog sanog 102 Jul 30 12:45 my-secrets-myname.txt
-rw-rw-r-- 1 sanog sanog 441 Jul 30 14:30 my-secrets-myname.txt.gpg

In case of windows:

C:\exercise>dir
Volume in drive C has no label.
Volume Serial Number is 0CB2-23B5

Directory of C:\exercise

08/18/2018 05:04 AM .
08/18/2018 05:04 AM ..
08/18/2018 05:03 AM 105 my-secrets-myname.txt
08/18/2018 05:04 AM 443 my-secrets-myname.txt.gpg
2 File(s) 548 bytes
2 Dir(s) 47,657,218,048 bytes free

C:\exercise>

While establishing security functions for the dating website, cryptographic hashes are not highly recommended as it’s quite easy to buy or download a list of hashes for all the given phone numbers.

The aforementioned security features are easy and cost-effective to execute for a dating app MVP.

Understanding Tinder Algorithm

Now before we talk about what goes under the hood of Tinder, a few things need to be understood. Only a handful amount of people know what exactly goes behind the algorithm of Tinder.

t is not something which is open source and available to all. An algorithm is developed after years of learning, experiences, feedbacks, observations etc. Tinder’s current algorithm is its USP. They cannot afford to lose it out in the public.

If we look at the larger picture, it is a combination of machine learning fueled by real-world system dynamics providing the most circumstantial profile’s to its users.

Even though this is one the most sophisticated and trusted ways to match profiles on a dating app, it becomes a substantially expensive deal for startups.

A startup cannot afford to put a machine learning LOB in their business. However, there is a solution to this. You simply need to observe in order to understand and provide.

  • Influence based on similarity-- Render the matchmaking process more effective by evaluating how to add weights to similar or dissimilar interests.

  • Profile Completion-- Look at the user’s profile. An incomplete profile tells a lot about the user. Add more weight to the profiles where a user has 2 or more profile pictures, has provided work details, and has used the number of characters to describe themselves. This helps in indexing genuine user profiles.

  • Niche Related Specifications-- Say, for example, you have built the dating website for professionals and working class. Then the number of qualifications and degrees a user has provided gets more weight. Similarly for sports, athletics, colleges etc.

  • Seriousness Towards the App-- Another way you can weigh a profile more is by sorting all those users who have their push notifications enabled. Apps have a very good opt-in rate when it comes to push notifications. When a user has it enabled, you can be sure that they are inclined towards any updates that they receive from the app.

Here is an example formula to rank a user on a scale of 100:

Points = H1(min(1st degree, x1)/x1) + H2(Degree on Facebook) + H3 + H4(min(2nd degree, x4)/x4) + … + Hn(yn)
Hi is the coefficient of independent variables xi and yi.

This can be helpful when the app has a limited number of users. As the user base increases, the demand for time and effort also shoots up.

Once your app has managed to acquire a large user base, that will be a good time to move the matching algorithm to machine learning.

Improving App Quality

The quality of a dating app is measured by the number of genuine and authentic profiles. Fake profiles, scammers, impersonators etc downgrade the quality of app experience. In order to control this, let’s take an example of Sightengine, an API that helps remove such profiles.

Setting up an automated image moderation system is a good practice for dating apps and websites. The SDKs are available in PHP, Node.js, and Python

Once you register on their website and create an account, you will be provided with two secret keys. After that, you will need to install the SDK which allows using the API in your application.

pip install sightengine

The website returns a JSON. In this JSON there is a scam prob attribute which analyses whether the image contains a scammer or not. The JSON contains also an attributes faces that is an array.

Example of Image moderation through public URL:

# Detect nudity in an image
output = client.check('nudity').set_url('http://img09.deviantart.net/2bd0/i/2009/276/c/9/magic_forrest_wallpaper_by_goergen.jpg')

# Detect nudity, weapons, alcohol, drugs and faces in an image, along with image properties and type
output = client.check('nudity', 'type', 'properties', 'wad', 'face').set_url('http://img09.deviantart.net/2bd0/i/2009/276/c/9/magic_forrest_wallpaper_by_goergen.jpg')

Local Image Moderation:

# Detect nudity in an image
output = client.check('nudity').set_file('/full/path/to/image.jpg')

# Detect nudity, weapons, alcohol, drugs and faces in an image, along with image properties and type
output = client.check('nudity', 'type', 'properties', 'wad', 'face').set_file('/full/path/to/image.jpg')

Binary Image Moderation:

# Detect nudity in an image
output = client.check('nudity').set_bytes(binary_image)

# Detect nudity, weapons, alcohol, drugs and faces in an image, along with image properties and type
output = client.check('nudity', 'type', 'properties', 'wad', 'face').set_bytes(binary_image)

Local Image moderation Feedback:

client.feedback("nudity","safe", "/full/path/to/image.jpg")
client.feedback("type","illustration", "/full/path/to/image.jpg")
client.feedback("nudity","raw", "/full/path/to/image.jpg")Source: Github/Sightengine

Another way to moderate fake profiles is by asking users to sign up via Facebook account and putting a threshold on number of friends, profile information, likes, etc a user must have to identify them as a valid user.

Real Time Chat Integration

Providing real time chat support-both online and offline, is integral to an online dating app. One major difference between real time chat and a simple chat is that the later requires the users to refresh the chat window in order to receive new messages. And in real time chat, the chat gets updated automatically

Having an HTTP chat installed is waste of both, time and resources. Moreover such chats will not scale with time and eventually fail. Trusting such chat modules is not a good idea.

Here is how you can implement real time chat support in your dating app:

  • XMPP Server integration

  • Socket programming

  • Socket programming Using robust 3rd party SDKs like CometChat

What does this mean?

If you are just starting out, building a chat module from the scratch and then implementing it into the app is not at all a good idea. This is simply too much work and a tremendous waste of time.

Preferable options include A) Firebase which provides tons of features along with quick user-friendly chat implementation. B) OpenFire is another great example of easy chat module integration. It is a real time collaboration (RTC) server. Both of them provide XMPP protocols for chat functionality.

While both these options are good, they do have their own limitations and scalability issues. Make sure you check them before opting for any one of those.

One such limitation is that unix systems limits the maximum number of simultaneous users Openfire can have. The default limit is set to 4,000.

CometChat is another good example to integrate a chat module for your dating app. It is a pre-packed building block for your chat infrastructure.

Instead of creating a custom chat module and going through the hassle, CometChat’s readily available SDKs give a boost to you app.

It has more than 92+ available integrations and can run on any platform.

Mobile SDKs

Frameworks

Programming Languages

CometChat is a robust and elegant solution for integrating a sophisticated chat module to your app.

It comes with a ready to integrate SDK with complete Source Code for UI. Developers can easily build on top of our existing UI and expand on CometChat’s functionality.

It comes with GIFs, stickers, emojis, video calls, group chats etc and whole bunch of functions.

How to initialize the Chat in iOS?

Swift

let CometChat : CometChat = CometChat();
let licenseKey: String = "COMETCHAT-XXXXX-XXXXX-XXXXX-XXXXX";
let apiKey: String= "xxxxxxxxxxxxxxxxxxxxxx";
self.CometChat.initializeCometChat("", licenseKey:licenseKey, apikey:apiKey,
isCometOnDemand:true,
success: {(response) in
},failure:{(error) in
})

Objective-C

CometChat *CometChat = [[CometChat alloc]init];
NSString* licenseKey = @"COMETCHAT-XXXXX-XXXXX-XXXXX-XXXXX";
NSString* apiKey = @"xxxxxxxxxxxxxxxxxxxxxx";
[CometChat initializeCometChat:@"" licenseKey:licenseKey apikey:apiKey isCometOnDemand:YES
success:^(NSDictionary *response) {
} failure:^(NSError *error) {
}];

How to Login to Chat?

Swift

let UID : String = "SUPERHERO1";
CometChat.login(withUID:UID,
success:{(response) in
},
failure:{(error) in
});

Objective-C

NSString* UID = @"SUPERHERO1";
[CometChat loginWithUID:UID success:^(NSDictionary *response) {
} failure:^(NSError *error) {
}];

Launching the Chat

Swift

let isFullScreen : Bool = true;
let readyUI: readyUIFIle = readyUIFIle();
self.readyUI.launchCometChat(isFullScreen, observer: self, userInfo: { (response) in
}, groupInfo: { (response) in
}, onMessageReceive: { (response) in
}, success: { (response) in
}, failure: { (error) in
}, onLogout: { (response) in
})

Objective-C

BOOL isFullScreen = YES;
readyUIFIle* readyUIFile = [[readyUIFIle alloc]init];
[readyUIFile launchCometChat:IsFullScreen observer:self userInfo:^(NSDictionary *response) {
} groupInfo:^(NSDictionary *response) {
} onMessageReceive:^(NSDictionary *response) {
} success:^(NSDictionary *response) {
} failure:^(NSError *error) {
} onLogout:^(NSDictionary *response) {
}];

One of the most simple and effective chat module for your online dating app.

Payment Processing

Since you are not selling tangible items through the app, the requirement for a payment gateway is out of the question. Purchases on an online dating app fall under digital goods.

All that needs to be done is integrate Apple and Google’s wallet within your app and you are all set to go.

Here is an example of Google Wallet integration.

1. Here is an example of Google Wallet integration.

private PaymentsClient mPaymentsClient;

@Override
public void onCreate() {
super.onCreate();

mPaymentsClient =
Wallet.getPaymentsClient(
this,
new Wallet.WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.build());
}

2. Call isReadyToPay API

private void isReadyToPay() {
IsReadyToPayRequest request =
IsReadyToPayRequest.newBuilder()
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD)
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD)
.build();
Task task = mPaymentsClient.isReadyToPay(request);
task.addOnCompleteListener(
new OnCompleteListener() {
public void onComplete(Task task) {
try {
boolean result = task.getResult(ApiException.class);
if (result == true) {
// Show Google as payment option.
} else {
// Hide Google as payment option.
}
} catch (ApiException exception) {
}
}
});
}

3. Create PaymentDataRequest object

private PaymentDataRequest createPaymentDataRequest() {
PaymentDataRequest.Builder request =
PaymentDataRequest.newBuilder()
.setTransactionInfo(
TransactionInfo.newBuilder()
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.setTotalPrice("10.00")
.setCurrencyCode("USD")
.build())
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD)
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD)
.setCardRequirements(
CardRequirements.newBuilder()
.addAllowedCardNetworks(
Arrays.asList(
WalletConstants.CARD_NETWORK_AMEX,
WalletConstants.CARD_NETWORK_DISCOVER,
WalletConstants.CARD_NETWORK_VISA,
WalletConstants.CARD_NETWORK_MASTERCARD))
.build());

PaymentMethodTokenizationParameters params =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(
WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
.addParameter("gateway", "example")
.addParameter("gatewayMerchantId", "exampleGatewayMerchantId")
.build();

request.setPaymentMethodTokenizationParameters(params);
return request.build();
}

4. Create OnClickListener object

findViewById(R.id.buy_button)
.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
PaymentDataRequest request = createPaymentDataRequest();
if (request != null) {
AutoResolveHelper.resolveTask(
mPaymentsClient.loadPaymentData(request),
this,
// LOAD_PAYMENT_DATA_REQUEST_CODE is a constant value
// you define.
LOAD_PAYMENT_DATA_REQUEST_CODE);
}
}
});

5. Handle the PaymentData response object

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case LOAD_PAYMENT_DATA_REQUEST_CODE:
switch (resultCode) {
case Activity.RESULT_OK:
PaymentData paymentData = PaymentData.getFromIntent(data);
String token = paymentData.getPaymentMethodToken().getToken();
break;
case Activity.RESULT_CANCELED:
break;
case AutoResolveHelper.RESULT_ERROR:
Status status = AutoResolveHelper.getStatusFromIntent(data);
// Log the status for debugging.
// Generally, there is no need to show an error to
// the user as the Google Pay API will do that.
break;
default:
// Do nothing.
}
break;
default:
// Do nothing.
}
}

Source: Google Developers

This is an example of how one can integrate Google Wallet onto their chat module.

Conclusion

Do not just go for a clone script and start monetizing the app on top of that. Eventually such business is doomed to fail. Building an app gathering all the bits and pieces, lessons and experience, feedbacks and reports is how one should proceed.

There always is a demand for innovation. People love what is unique and user-friendly.

We have given you all the ingredients required to build your own dating app. All you need is to now get up and start hustling.

Date--Set--Go!

Team CometChat

We build chat and messaging SDKs that let you quickly code a full-featured chat experience into any mobile or web app.

Try out CometChat in action

Experience CometChat's messaging with this interactive demo built with CometChat's UI kits and SDKs.