This page describes how to integrate with OlaMoney SDK.
Gradle Dependency
Add below dependency in application's build.gradle.
implementation 'com.payu.olamoney:olamoney:1.1.0'
Callbacks
List of the callback function provided by PayU OlaMoney:
onPaymentInitialisationSuccess() - Callback invoked if the customer is eligible for OlaMoney(Postpaid/Wallet).
onPaymentInitialisationFailure(int errorCode, String description)- Callback invoked when there is some error in Customer eligibility.
Following are the errors which are received in onPaymentInitialisationFailure.
-ErrorCode:Description - 100 : Mandatory params are missing. Please check again! //Mandatory params for checking eligibility is missing.
-101:SomethingWentWrong!
Checking OlaMoney Eligibility
Before proceeding with payment via OlaMoney payment mode merchant must check whether the customer is eligible for OlaMoney or not by using below method.
/***MethodtochecktheeligibilityofCustomerforOlaMoney*@paramactivityActivityContext*@paramcallback{@linkcom.payu.olamoney.callbacks.OlaMoneyCallback}*@paramolaMoneyParams{@linkcom.payu.olamoney.utils.PayUOlaMoneyParams}*/ new OlaMoney().checkForPaymentAvailability(Activity activity, OlaMoneyCallback callback, PayUOlaMoneyParams olaMoneyParams)
where object of PayUOlaMoneyParams can be created like below.
Kindly note that values that are set in PayUOlaMoneyParams must be the same that needs to be sent to PayU's backend in payment post-data.
Creating PayUOlaMoneyParams
PayUOlaMoneyParams payUOlaMoneyParams = new PayUOlaMoneyParams();
payUOlaMoneyParams.setMobile(<Customer Mobile number>));
payUOlaMoneyParams.setFirstName(<Customer Firstname>);
payUOlaMoneyParams.setTxnId(<TransactionId>);
payUOlaMoneyParams.setMerchantKey(<PayU Merchant key>);
payUOlaMoneyParams.setHash(<Hash generated for OlaMoney Eligibility check>);
payUOlaMoneyParams.setAmount(<Amount that customer needs to pay>);
where OlaMoney eligibility hash can be created as below
OlaMoney Eligibility Hash Generation
To generate OlaMoney eligibility hash use below method
sha512(key|command|var1|salt)
where
Key - Merchant Key
Command - get_eligible_payment_options
var1 - {\"amount\":\"<Transaction Amount>",\"txnid\":\"<Transaction Id>\",\"mobile_number\":\"<Customer Phone Number>",\"first_name\":\"<Customer first name>\",\"bankCode\":\"OLAM\",\"email\":\"<Customer's email>\",\"last_name\":\"<Customer's last name>\"}
Order of the fields should be the same written here.
Salt - Merchant's Salt
Ordering of the fields of var1 should be the same written above.
amount: Amount that buyer needs to pay.
txnid: Merchant generated Transaction id for the order.
mobile_number: The buyer mobile number for OlaMoney Payment.
first_name: Buyer first name.
bankCode: It must be OLAM.
email: Buyer Email ID. Not mandatory If don’t have, send blank "".
last_name: Buyer Last name. Not mandatory If don’t have, send blank "".