Advance SDK Configuration

If you require to alter the SDK behaviour then following customisations available for Android SDK.

Custom Initialisation of the SDK

If you require to initialise the SDK yourself then follow the steps below

  1. Add the following to your values.xml file.
<bool name="cashfree_pg_core_auto_initialize_enabled">false</bool>
  1. Initialize the SDK yourself before attempting payment.
 CFPaymentGatewayService.initialize(getContext()); // Application Context.
 AnalyticsUtil.sendPaymentEventsToBackend(); // required for error reporting.

🚧

Note

Make sure to initialise the SDK in Application class or Activity or Fragment creation to avoid any Runtime issues.

Enable logging to debugging issues

If you are facing trouble while making a payment, you can take a look at the SDK debug logs to try and identify the issue.
To enable SDK logging add the following to your values.xml file.

<integer name="cashfree_pg_logging_level">3</integer>

Following are the Logging levels.

  • VERBOSE = 2
  • DEBUG = 3
  • INFO = 4
  • WARN = 5
  • ERROR = 6
  • ASSERT = 7

🚧

Note

Make sure to set the logging level back to value '4' before going live.

Disable Quick Checkout in Payment Page

If you want to disable quick checkout flow in Drop Payment flow you can add the following to your values.xml file.

<bool name="cf_quick_checkout_enabled">false</bool>

Add Custom Analytics subscriber

From our Android SDK version 2.0.1 onwards, you can subscribe to the analytics events generated from our Drop checkout payment flow and push it to the analytics platform of your choice directly from your application.

If you want to enable this feature in Drop Payment flow you can add the following line to your values.xml file.

<bool name="cashfree_custom_analytics_subscriber_enabled">true</bool>
CFEventsSubscriber subscriber = new CFEventsSubscriber() {
        @Override
        public void receivedEvent(String eventName, @Nullable Map<String, String> metaData) {
            // Handle the events here
        }
    };
    
    // Add this line in onCreate()
        CFAnalyticsService.getInstance().setSubscriber(subscriber);