Integration

Getting Started

Add below url in root project's build.gradle.

allprojects {
    repositories {
        maven {
            url "https://phonepe.mycloudrepo.io/public/repositories/phonepe-intentsdk-android"
        }
    }
}

Add below dependency in your application's build.gradle

implementation 'in.payu:phonepe-intent:1.6.1'

Callbacks

PayUPhonePeCallback provides following callback methods.

  • onPaymentOptionFailure (String payuResponse, String merchantResponse) - Calls when payment fails.

  • onPaymentOptionSuccess (String payuResponse, String merchantResponse) - Calls when payment succeeds.

  • onPaymentOptionInitialisationFailure (int errorCode,String description) - Called for PhonePe initialisation failure.

  • onPaymentOptionInitialisationSuccess (boolean result) - Callback when PhonePe is successfully initialised.

Following are error messages w.r.t. PhonePe initialisation failure.

Create an instance of PayUPhonePeCallback like below.

Set up for Test/Sandbox Merchant

If you are using the SDK with a test merchant, please provide this metadata value to the manifest file else removed these lines below.

Check for PhonePe Availability

SDK provides method checkForPaymentAvailability to check if PhonePe payment is available or not on device.This method is called before showing PhonePe as a checkout option.

To generate PaymentOption Hash visit here.

Make Payment by PhonePe

After successful initialisation of PhonePe by calling checkForPaymentAvailability method call makePayment method to make payment.

To generate Payment Hash visit here.

Sample PostData

Last updated

Was this helpful?