After the payment is initiated the PhonePe app is opened directly for payment. After the payment is complete, the SDK verifies the payment. The response is delivered through onActivityResult().

dependencies {
    ...
    //Dependencies used by all payment functions
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}

You need to first check if PhonePe App is available for payment.

Call the function doesPhonePeExist before showing PhonePe as a payment option to the user. It checks if the device has a valid version of PhonePe app installed. If it is available then it checks if the app is set up to make payments.

public  boolean  doesPhonePeExist(Context context, String stage)

Parameters:

  • context: Context of the calling activity.
  • stage: Value should be either "TEST" for testing server, or "PROD" for production server respectively.
public  void  phonePePayment(Context context, Map<String, String> params, String token, String stage)

Parameters:

  • context: Context object of the calling activity
  • params: A map of all the relevant parameters described here
  • token: The token generated here
  • stage: Value should be either "TEST" or "PROD" for testing server or production server respectively.

© 2019 Cashfree Payments India Pvt Ltd