Background

PayU provides payment gateway solutions to online businesses and serves more than 5,00,000+ merchants with over 150+ payment methods. It is the preferred payment partner for e-commerce merchants, including all leading e-commerce companies and a majority of airline businesses.

PayU has a host of mobile SDKs that play a vital role in powering payments in our merchant apps. Our primary focus is to make integration on the PayU platform as simpler and seamless as possible with minimal efforts required by businesses.

Let’s talk about how we built our PayU Crash Reporter SDK and integrated it into all of our SDK offerings to adopt an early repair strategy.

Problem Statement  

PayU distributes SDKs via public repositories such as Maven Central Cocoa Pods, where businesses integrate them into their Apps. When a crash used to occur in our codebase, it was getting logged on the merchant’s crash tools dashboard, and the same was conveyed to us later. We were not able to monitor the crashes in real-time. Debug time was high since required debug information was not always available easily from merchant dashboards. At times it was difficult for us to de-obfuscate the stack traces due to the lack of SDK version information and the corresponding mapping files.

Exploration

We tried to solve this problem with multiple products available in the market like Crashlytics, ACRA, BugSnag, but none of them worked out of the box for us. Here’s why we could not solve this problem:

  • The coexistence of multiple such solutions within a single app was technically impossible, as all of these solutions need a single unique id to be configured at the application level.  
  • These products did not support Library Modules. Usage is restricted for Application-level projects only.  

We came across Sentry, an open-source solution that could solve the problems mentioned above.  Sentry has an SDK product that was able to solve our primary goal of monitoring crashes in our SDK, but it had some of its challenges as well:  

Large Size: The size of Sentry SDK is ~1000KB as it offers a lot of other features which were not of our interest, viz.Health monitoring, NDK crash reporting, etc.  

Control over Data: We wanted tighter control over the data as the Sentry SDK was capturing a lot of data points, which was again of no interest to us. Also, the payload size was bloated because of the same.  

The Final Approach

We have developed our own PayU Crash Reporter SDK (using Sentry) to resolve the above problems. The PayU Crash Reporter SDK registers itself with a Global exception handler to parse the stack traces and report only those crashes which occur in PayU SDKs. High-frequency events would then get picked up into our sprint cycles or as hotfixes for proactive issue resolution, thus creating much more stable SDKs.

PayU Crash Reporter SDK Flow
PayU Crash Reporter SDK Flow
PayU Crash Reporter SDK Dashboard
PayU Crash Reporter SDK Dashboard

Size: It’s around 40 KB, almost 1/25th size of Sentry SDK. We were able to reduce the size by this much by removing all the bloatware.  

Control over Data: Reporting only necessary fields such as library version, transaction id, details of all of our modules present in the merchant application, along with Stack traces to ease out the debugging.  

Stability: PayU Crash Reporter is completely written in Kotlin using modern practices such as Coroutines to make network calls lighter, improving stability.  

Extensibility: PayU Crash reporter SDK has been designed in such a way that it is being used by all of our SDK offerings for Crash monitoring.  

Getting Better

With PayU Crash Reporter SDK integrated into all of our SDKs, we were able to provide a smooth and stable experience to all of the 150+ merchant bases.  

One of the recent examples is a top e-commerce player in our country, having millions of DAUs, facing a crash in our SDK during low memory in the devices, causing poor customer experience. We discovered and fixed this issue in the early release stages of the App itself with the aid of our PayU Crash reporter SDK.  

Apart from this, frequently occurring crashes like – Unhandled exceptions / NumberFormat Exceptions, IllegalArgument exceptions, NullPointer exceptions, etc., were observed during runtime by the PayU Crash Reporter SDK and were immediately fixed in the subsequent releases of respective SDKs.  

Everything You Need to Get Started

You can look at a variety of payments SDKs that PayU offers for a seamless payments experience – Android iOS.   

For any integration related support, please reach out to your key account manager or write to us at mobile.integration@payu.in  

7