Android Tutorial: How to Integrate Stripe Payment Gateway in Android App and Create Commission Based Transaction

0
Shares
Android Tutorial: How to Integrate Stripe Payment Gateway in Android App and Create Commission Based Transaction
3.2 (63.33%) 12 votes

If you’re building a mobile app for business, you’ll have to somehow accept payments in your application.

Whether it’s a travel app or eCommerce app, you’ll have to provide an option for customers to pay for the goods or services that your app has to offer.

To make it happen, various mobile payment gateways are generally being used. Now, there are a large number of payment gateways available in the market which can allow you to process credit card transaction data through their APIs. But, by integrating one such payment gateway also puts the responsibility of the security of credit card data on your shoulders as that credit card data will be passing through your mobile app.

Moreover, not all payment gateways available in the market supports an authenticated tokenization process, which is necessary to accept payments from a mobile app.

Generally, when mobile payment gateway is implemented in your app, the API should hand back a token from your server’s secure authenticated environment. This token represents the submitted card, and is used for the actual transaction.

Now, if you want to integrate a payment gateway to create commision based transaction, there are only few options available. And among this few option, Stripe is the best.

Stripe payment gateways allows both, individuals as well as businesses to accept payments over mobile apps. Stripe was basically launched in 2011, and now supports 100+ currencies, making it one of the most popular payment gateway all over the world.

In fact, from below you can learn more about Stripe, explained by our one of the Senior Android developer sharing his experience of using Stripe as a payment gateway in one of the Android applications.

Now, if you’re an Android developer and looking forward to learn how to Integrate Stripe payment gateway in an Android Application, the below guide will help you how to do it right.

Integrate Stripe Payment Gateway with Commission Based Transaction

We integrate stripe payment gateway but in addition, our client want us to get a commission on every transaction, and need to connect to user’s account for commision.

We provide a commission based solution that allows our clients to earn some amount for every transaction.

So, here we would like to share the development steps as mentioned below for integration:

Step 1) for developer: Add below two dependency in gradle file of your project.

1) compile 'com.stripe:stripe-java:1.47.0'

2) compile 'com.stripe:stripe-android:1.0.4'

Step 2) To get the commision, you need to connect with user account and for that you need to get authorisation code.

To authorize this code you need to have a client id which you will get through register your application on stripe.

This is just one-time process for obtain the client id. This will give you access to Stripe Connect settings.

Use this link to get register your application with Stripe and begin developing with Stripe Connect.

Here we are showing how you can register your platform (Platform means your application) after. Login into the stripe and to register platform.

Click on Your Account which will be on top right corner of your dashboard. See below screenshot.

picture1

Now the window will be pop up to register your platform. Click on connect and you will have screen to register your platform. See below screenshot for more info.

picture2

Click on register your platform button than you will have one more window which moves to your final destination to register platform. Just fill up all the information and press on Done button.

[Developer note we experienced: You need to enter website url and redirect urls with having https:// format. See below screenshot.]

picture3

With filling all above-mentioned information, you will have a client id that will be used to authorize your account.

Step 3) A process to get Stripe authentication code (OAuth 2.0) through client ID

To connect with user’s account – user needs to go through OAuth2.0  for managed account. This whole authentication process is managed by Stripe. Replace Client ID text in below URL and open it in browser.

https://connect.stripe.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENTID&scope=read_write

For Test and Live modes of Development, you will get different client ids, so take care of client id passing with above URL.

Here are the micros steps to get authorisation code:

3.1) After logging, a user is redirected to URL set, which is Step 1.

http://www.yourredirectionurl.com/?scope=read_write&code=AUTHORIZATION_CODE

Here, we get “AUTHORIZATION_CODE”.

3.2) This AUTHORIZATION_CODE needs to pass through the curl which returns the “stripe_user_id

curl https://connect.stripe.com/oauth/token \
-d client_secret=CLIENT_SECRET_KEY \
-d code=AUTHORIZATION_CODE \
-d grant_type=authorization_code

In the step 3.2) you may have question that what is the CLIENT_SECRET_KEY.

And how do you get it?

This is the key of that client who needs to get some amount of every transaction into his account. To get SECRET_KEY click on API_KEYS which appears at third position of below screenshot. And use Test Secret Key from that all listing keys.

picture4

3.3) You need to save this stripe_user_id and pass this stripe_user_id to get commission. You just need to take of test and live modes of development and make sure you change the secret key and client id.

Based on our client’s requirement, we would like you to share the XML file for obtaining details of credit card number, Expiry Date, CVV number, Amount of Transaction, Description of Transaction and Email of Receipt.

XML File Code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/LinearLayout1"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@drawable/gredientbg"

android:orientation="vertical">

 

 

<ScrollView

android:layout_width="match_parent"

android:layout_height="wrap_content">

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

 

<LinearLayout

android:id="@+id/llTop"

android:layout_width="match_parent"

android:layout_height="wrap_content"

 

android:orientation="vertical">

 

<ImageView

android:id="@+id/imgLogo"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="30dp"

android:src="@drawable/logo" />

 

<com.paynow.utils.MyTextView

android:id="@+id/textTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_horizontal"

android:layout_marginTop="@dimen/scal_10dp"

android:text="@string/text_charge_card_title"

android:textColor="@color/color_white"

android:textSize="@dimen/scal_16sp" />

</LinearLayout>

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

 

 

<FrameLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="@dimen/scal_20dp"

android:layout_marginRight="@dimen/scal_20dp"

android:layout_marginTop="@dimen/scal_20dp">

 

<com.paynow.utils.MyEditText

android:id="@+id/editAmount"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="@dimen/scal_10dp"

android:background="@color/color_white"

android:hint="@string/edit_amount_hint"

android:imeOptions="actionNext"

android:inputType="numberDecimal"

android:maxLength="15"

android:paddingBottom="@dimen/scal_10dp"

android:paddingLeft="@dimen/scal_70dp"

android:paddingRight="@dimen/scal_10dp"

android:paddingTop="@dimen/scal_10dp"

android:singleLine="true"

android:text="0.00"

android:textAllCaps="false" />

 

<Spinner

android:id="@+id/spinnerCurrency"

android:layout_width="@dimen/scal_70dp"

android:layout_height="@dimen/scal_40dp"

android:layout_marginTop="@dimen/scal_10dp"

android:background="@drawable/dropdown_selector"

android:drawSelectorOnTop="true"

android:paddingBottom="@dimen/scal_0dp"

android:paddingRight="@dimen/scal_10dp"

android:paddingTop="@dimen/scal_5dp"

android:prompt="@string/currency_prompt"

android:textColor="@color/color_currency"

android:textSize="18sp" />

</FrameLayout>

 

     <FrameLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="center_vertical"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

android:layout_marginTop="10dp">

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

 

<com.paynow.utils.MyEditText

android:id="@+id/editCardNumber"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/color_white"

android:drawableLeft="@drawable/icon_card"

android:drawablePadding="@dimen/scal_15dp"

android:hint="@string/edit_cardnumber_hint"

android:imeOptions="actionNext"

android:inputType="phone"

android:maxLength="25"

android:paddingBottom="@dimen/scal_10dp"

android:paddingLeft="@dimen/scal_10dp"

android:paddingRight="80dp"

android:paddingTop="@dimen/scal_10dp"

android:singleLine="true"

android:textAllCaps="false" />

</LinearLayout>

 

<ImageView

android:id="@+id/ivCamera"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="right|center_vertical"

android:layout_marginRight="@dimen/scal_10dp"

android:src="@drawable/camera_icon" />

 

<ImageView

android:id="@+id/ivWireless"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="right|center_vertical"

android:layout_marginRight="45dp"

android:src="@drawable/pay_icon" />

</FrameLayout>

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

android:layout_marginTop="@dimen/scal_10dp"

android:orientation="vertical">

 

<com.paynow.utils.MyEditText

android:id="@+id/editEpiryDate"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/color_white"

android:digits="@string/text_char_set_exp_date" <!-- Allows only digits -->

android:drawableLeft="@drawable/icon_calender"

android:drawablePadding="@dimen/scal_15dp"

android:hint="@string/edit_expirydate_hint"

android:imeOptions="actionNext"

android:inputType="number"

android:maxLength="10"

android:padding="@dimen/scal_10dp"

android:singleLine="true"

android:textAllCaps="false" />

</LinearLayout>

 

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

 

android:layout_marginTop="@dimen/scal_10dp"

android:orientation="vertical">

 

<com.paynow.utils.MyEditText

android:id="@+id/editCvcNumber"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/color_white"

android:digits="@string/text_char_set_numeric"

android:drawableLeft="@drawable/icon_lock"

android:drawablePadding="@dimen/scal_15dp"

android:hint="@string/edit_cvc_hint"

android:imeOptions="actionNext"

android:inputType="number"

android:maxLength="4"

android:padding="@dimen/scal_10dp"

android:singleLine="true"

android:textAllCaps="false" />

</LinearLayout>

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

android:layout_marginTop="@dimen/scal_10dp"

android:orientation="vertical">

 

<com.paynow.utils.MyEditText

android:id="@+id/editRefDesc"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/color_white"

android:drawableLeft="@drawable/icon_pencil"

android:drawablePadding="@dimen/scal_15dp"

android:hint="@string/edit_ref_desc_hint"

android:imeOptions="actionNext"

android:inputType="text"

android:maxLength="50"

android:padding="10dp"

android:singleLine="true"

android:textAllCaps="false" />

</LinearLayout>

 

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="@dimen/scal_20dp"

android:layout_marginRight="@dimen/scal_20dp"

 

android:layout_marginTop="@dimen/scal_10dp"

android:orientation="vertical">

 

<com.paynow.utils.MyEditText

android:id="@+id/editEmail"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/color_white"

android:drawableLeft="@drawable/icon_email"

android:drawablePadding="@dimen/scal_15dp"

android:ems="10"

android:hint="@string/edit_email_hint"

android:imeOptions="actionDone"

android:inputType="textEmailAddress"

android:maxLength="50"

android:padding="@dimen/scal_10dp"

android:singleLine="true"

android:textAllCaps="false" />

</LinearLayout>

 

 

<Button

android:id="@+id/btnChargeCard"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginBottom="@dimen/scal_20dp"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

android:layout_marginTop="20dp"

android:background="@drawable/blank_botton"

android:gravity="center"

android:paddingBottom="@dimen/scal_5dp"

android:text="@string/btn_charge_card"

android:textAllCaps="false"

android:textColor="@color/button_text_color"

android:textSize="@dimen/button_text_size" />

 

<RelativeLayout

android:id="@+id/rlBottom"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:background="#04BECB"

android:padding="@dimen/scal_18dp">

 

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_marginRight="@dimen/scal_20dp"

android:layout_toLeftOf="@+id/switchLive"

android:text="LIVE"

android:textColor="@color/color_white"

android:textSize="@dimen/txt_17" />

 

<android.support.v7.widget.SwitchCompat

android:id="@+id/switchLive"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerInParent="true"

android:checked="true" />

 

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_marginLeft="@dimen/scal_20dp"

android:layout_toRightOf="@+id/switchLive"

android:text="TEST"

android:textColor="@color/color_white"

android:textSize="@dimen/txt_17" />

</RelativeLayout>

</LinearLayout>

</LinearLayout>

 

 

</ScrollView>

</RelativeLayout>

3.3.2) With the above XML, you will get the above mentioned details, but if you want to scanning the credit card, you should follow the below method for  your Java class file.

private void scanCard() {
if (CardIOActivity.canReadCardWithCamera()) {
onScanPress();
isCardIo = true;
} else {
myUtility.setAlertMessage(getString(R.string.app_name), "Enter credit card information manual.");
}
}
public void onScanPress() {
Intent scanIntent = new Intent(this, CardIOActivity.class);

// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, false);
scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, true);
scanIntent.putExtra(CardIOActivity.EXTRA_USE_PAYPAL_ACTIONBAR_ICON, false);
scanIntent.putExtra(CardIOActivity.EXTRA_GUIDE_COLOR, Color.parseColor("#33b5e5"));
// hides the manual entry button
// if set, developers should provide their own manual entry mechanism in the app
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, true); // default: false
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}

3.3.3) To validate the credit card – use the below mentioned method in your Java class file.

private boolean isCardValid() {
cardNumber = editCardNumber.getText().toString().replace(" ", "");
cardCVC = editCvcNumber.getText().toString();
StringTokenizer tokens = new StringTokenizer(editEpiryDate.getText().toString(), "/");
cardExpMonth = Integer.parseInt(tokens.nextToken());
cardExpYear = Integer.parseInt(tokens.nextToken());
// Card card = new Card("4242424242424242", 12, 2016, "123");
Card card = new Card(cardNumber, cardExpMonth, cardExpYear, cardCVC);
boolean validation = card.validateCard();
if (validation) {
return true;
} else if (!card.validateNumber()) {

myUtility.setAlertMessage("Error", “The card number that you entered is invalid.”);
} else if (!card.validateExpiryDate()) {

myUtility.setAlertMessage("Error", “The expiration date that you entered is invalid.”);
} else if (!card.validateCVC()) {
myUtility.setAlertMessage("Error",”The CVC code that you entered is invalid.”);
} else {
myUtility.setAlertMessage("Error", “The card details that you entered are invalid.”);

}
return false;
}

3.3.4) After card validation, the next step is to get stripeToken and to get stripe token you need add below code in your java class file.

3.3.4.1) In the code, there is publishable key. You will get the publishable key from API keys in Stripe account. We would like you to check the screenshot of step number 3.2. Where you will be able to see publishable key below the SECRET_KEY.

As per Stripe recommendation we fetch the keys by making an API call to https url. Best practice is to save the keys on secured database in encrypted form and on user request decrypt it and send the keys to user on making an API call for keys.

Now we need to call an API to get this keys from secured server. For that we can have a https api call which will return us the publishable key from server.

private String userPublishableKey = "";
private String userSecretKey = "";
/**
* This is standerd api call method which will get the user's key from server
**/
private void getUserKey() {
// Call api and get user publishable & secret key here and assign key value in userPublishableKey & userSecretKey

}

Card card = new Card(cardNumber, cardExpMonth, cardExpYear, cardCVC);
try {
Stripe stripe = new Stripe(userPublishableKey); stripe.createToken(
card,
publishableKey,
new TokenCallback() {
public void onSuccess(Token token) {
if (myUtility.checkInternetConnection())

sendCardToInfoToStripe(token.getId(), isLive);
else {
myUtility.setInternetAlertMessage();

}

}

public void onError(Exception error) {
myUtility.setAlertMessage("Error", error.getMessage());
}
});

3.3.4.1) In the case of payment process without login, you needs to add below code to open dialog of webview of Stripe.

final Dialog dialog = new Dialog(ChargeCardActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_connect_alert_dialog_with_msg);
dialog.setCanceledOnTouchOutside(false);

TextView textDialog = (TextView) dialog.findViewById(R.id.textDialog);
textDialog.setText(getString(R.string.lbl_stripe_not_connected));
TextView textCancel = (TextView) dialog.findViewById(R.id.textCancel);
TextView textOk = (TextView) dialog.findViewById(R.id.textOk);
// if button is clicked, close the custom dialog
textCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});

textOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
Intent intent = new Intent(ChargeCardActivity.this, WebviewPaymentActivity.class);
intent.putExtra(Constants.ISLIVE, isLive);
intent.putExtra(Constants.CARD_NUMBER, cardNumber);
intent.putExtra(Constants.CARD_CVC, cardCVC);
intent.putExtra(Constants.CARD_EXP_MONTH, cardExpMonth);
intent.putExtra(Constants.CARD_EXP_YEAR, cardExpYear);
intent.putExtra(Constants.CENT_AMOUNT, centAmount);
intent.putExtra(Constants.USER_DESCRIPTION, userDescription[bad code]);
intent.putExtra(Constants.USER_EMAIL, userEmail);
intent.putExtra(Constants.USER_CURRENCY, sessionManager.getStringDetail(Constants.USER_CURRENCY));
intent.putExtra(Constants.USER_PUBLISHABLE_KEY, userLivePublishableKey);
startActivity(intent);
}
});
dialog.show();

Custom_connect_alert_dialog_with_msg.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_dialog_background"
android:orientation="vertical">

<TextView
android:id="@+id/textDialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="left"
android:padding="10dp"
android:text="Your stripe live account is not connceted. DO you wan\'t to connect it and make payment?"
android:textColor="@android:color/white"
android:textSize="17sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/color_dialog_button_border" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">

<TextView
android:id="@+id/textOk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/scal_15dp"
android:text="Proceed"
android:textColor="@color/color_white"
android:textSize="17sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color_dialog_button_border" />

<TextView
android:id="@+id/textCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/scal_15dp"
android:text="Cancel"
android:textColor="@android:color/white"
android:textSize="17sp" />

</LinearLayout>

</LinearLayout>

3.4) This below code is to make your Stripe integration based on the commission’s transaction you would like to set.

In the below code we have used cents 1000 as a total amount transaction and 100 as a commission. You can also define the currency through below code.

NOTE: As stripe recommend not to store keys data in application we store the key information in encrypted form on database and we make an https web api call to get the decrypted keys.

We get userSecretKey from an API call to server.

private void sendCardToInfoToStripe(final String cardToken, final boolean isLive) {
userDescription = editRefDesc.getText().toString(); // Get User Description[bad code]
userEmail = editEmail.getText().toString(); // Get User Email Id
new Thread(new Runnable() {
@Override
public void run() {

Map<String, Object> chargeParams = new HashMap<String, Object>();
chargeParams.put("amount", 1000);
chargeParams.put("currency", "usd");
chargeParams.put("source", cardToken);
chargeParams.put("description", [Variable name]userDescription[bad code]);[Variable name]
chargeParams.put("receipt_email", userEmail);
chargeParams.put("application_fee", 100);
RequestOptions requestOptions;
requestOptions = RequestOptions.builder().setStripeAccount(sessionManager.getStringDetail(Stripe-user-id)).setApiKey(userSecretKey).build();

try {
Charge.create(chargeParams, requestOptions);
callSuccess();
} catch (final Exception e) {
myUtility.dismissDialog();
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
myUtility.setAlertMessage("Error", e.getMessage());
}
});
}
}
}).start();

}

Developer Note: Above codes has used couple of common class for general methods like internet checking, alert dialogs. We are putting here all the common methods code.

Public class Utility{
public boolean checkInternetConnection() {

ConnectivityManager conMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
// ARE WE CONNECTED TO THE NET
if (conMgr.getActiveNetworkInfo() != null
&& conMgr.getActiveNetworkInfo().isAvailable()
&& conMgr.getActiveNetworkInfo().isConnected()) {
return true;
} else {
return false;
}
}

public void setInternetAlertMessage() {
if (context == null)
return;

dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_alert_dialog);
dialog.setCanceledOnTouchOutside(false);
TextView textDialog = (TextView) dialog.findViewById(R.id.textDialog);
textDialog.setText(context.getString(R.string.msg_internet_connection));
textDialog.setPadding(15, 15, 15, 15);
textDialog.setGravity(Gravity.CENTER);

TextView textOk = (TextView) dialog.findViewById(R.id.textOk);
// if button is clicked, close the custom dialog
textOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();

}
});
dialog.show();
}
public void setAlertMessage(String title, String msg) {

if (context == null)
return;

dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_alert_dialog);
dialog.setCanceledOnTouchOutside(false);
TextView textDialog = (TextView) dialog.findViewById(R.id.textDialog);
textDialog.setText(msg);
textDialog.setPadding(15, 15, 15, 15);
textDialog.setGravity(Gravity.CENTER);

TextView textOk = (TextView) dialog.findViewById(R.id.textOk);
textOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();

}
});
dialog.show();
}
}

Re-Note: Perform all steps carefully while you are moving the codes from Test to Live.

The challenging task was to get a user through the authentication, which can be performed on web only. Thus, we enable a user to the same experience in native application and managed all redirection of a web, as we are not getting any callbacks from stripe SDK and at the end, we achieved this by observing the redirections.

We would like to share with the app owners that when they are in a situation of choosing a payment gateway or any of the payment integration service, it would be suggested to check target audience, and then search the payment gateway support of that region.

For example, if you need to have payment from the Middle East or Northern Africa then Hyper Pay is one of the solutions or if you are targeting the US, UK, Canada, Australia then Stripe payment gateway integration is the best solution. After that, we need to check the costing structure, refund fees and time used by payment gateway to transfer money to the bank account.

Stripe is making a difference in developer community though their payment service integration, user-friendly documents and API. We had happily coded the Stripe integration and our recent app development in Stripe got 3000 users in the first week of the launch, 45000 amount of transaction happening every day, and almost 100+ reviews and a 4.1-star rating on Google Play store. This application was in top charted apps in finance category in the first quarter of the year 2016.

We would love to hear back your words for Stripe payment gateway integration and share your feedback for above content.

This page was last edited on June 9th, 2017, at 15:31.
 
0
Shares
 

Contact us Now to Integrate Stripe Payment Gateway in Android App

Get your free consultation now