Core

Consists of all the Core sdk components and implementation.

Getting Started

PayU Android SDK version 3.0 is deprecated.We are no longer supporting it.

Add below dependency in your application's build.gradle to get started

We have moved to Maven Central. Please update your existing dependency with below

implementation 'in.payu:payu-sdk:5.1.1'

Payment Request Generation

To create a Payment Request you would first need to create an object of PaymentParams.

Creating PaymentParams

Create an object of PaymentParams, put all the obtained parameters in it by using its default set methods an object of PaymentParams

PaymentParams mPaymentParams = new PaymentParams();
mPaymentParams.setKey(<Your Key issued by PayU>);
mPaymentParams.setAmount(<Transaction Amount>);
mPaymentParams.setProductInfo(<Product Description>);
mPaymentParams.setFirstName(<Customer First Name>);
mPaymentParams.setEmail(<Customer Email>);
mPaymentParams.setTxnId(<Transaction Id>);
mPaymentParams.setSurl(<Success URL>);
mPaymentParams.setFurl(<Failure URL>);
mPaymentParams.setUdf1(<User Defined Fields>);
mPaymentParams.setUdf2(<User Defined Fields>);
mPaymentParams.setUdf3(<User Defined Fields>);
mPaymentParams.setUdf4(<User Defined Fields>);
mPaymentParams.setUdf5(<User Defined Fields>);

For Recurring Payments(SI)

For SI payment, an object of siParams need to be created and set on above payment params as below

SIParamsDetails siParamsDetails = new SIParamsDetails();
siParamsDetails.setBillingAmount("1.0");
siParamsDetails.setBillingCycle(BillingCycle.MONTHLY);
siParamsDetails.setBillingInterval(1);
siParamsDetails.setPaymentStartDate("2021-10-15");
siParamsDetails.setPaymentEndDate("2021-10-15");
SIParams siParams = new SIParams();
siParams.setFree_trial(false);
siParams.setSi_details(siParamsDetails);
mPaymentParams.setSiParams(siParams);

SI Params Definitions

Parameter

Type

Description

Mandatory

Billing Amount

String

Billing amount in XX.XX format

Yes

Billing Cycle

Enum of Type BillingCycle

Billing Cycle can be DAILY, WEEKLY, MONTHLY, YEARLY, ONCE or ADHOC

Yes

Billing Interval

Int

Frequency at which subscription needs to be executed. For once in month pass it as 1 and BillingCycle.MONTHLY in Billing Cycle

Yes

Payment State Date

String

Start date of billing plan. Format is DDDD-MM-YY

Yes

Payment End Date

String

End date of billing plan. Format is DDDD-MM-YY

Yes

Free Trial

Boolean

This is required when free trial need to be set

No

Remarks

String

To pass additional billing remarks

No

Information for creating PaymentParams

  • You don't need to set udf1-5 in case you are not using them.

  • Email and First name can be empty strings "" if you don't want to use them

  • For store user card feature, you need to pass user_credentials as below:

mPaymentParams.setUserCredentials("your_key:user_id")

  • For offers mPaymentParams.setOfferKey("your_offer_key")

  • For any other payment default param (like phone and others)

mPaymentParams.setPhone(<Customer's Phone number>)

Get the required hashes by using your own server. Create an object of class PayuHashes and set the corresponding hashes using the default set methods provided.

mPaymentParams.setHash(payuHashes.getPaymentHash());

Creating Payment Post Data

To create Payment PostData you need to pass the Payment Type from SDK's supported payment options.

PostData postData = new PaymentPostParams(mPaymentParams, <Payment Type>).getPaymentPostParams();