-
Notifications
You must be signed in to change notification settings - Fork 10
PayU SamsungPay SDK Integration
Gradle: compile 'com.payu.samsungpay:samsungpay:1.0'
Download latest Android SamsungPay
1. Import gradle in your project or download the samsungpay-release.aar file from github.
4. Call method checkForSamsungPayAvailiability available in PayUSamsungPay to check if Samsung Pay payment is available or not for every transaction.
Sample
PayUSamsungPay.getInstance().checkForSamsungPayAvailiability( PayUSamsungPayCallback payUSamsungPayCallback, Context context, String paymentOptionHash, String merchantKey, String user_credentials)
Input :
PayUSamsungPayCallback : the class to provide callbacks
Context : Context instance
paymentOptionHash : Payment Related Details hash
merchantKey : PayU Merchant Key
user_credentials : Provide user credentials or use "default"
Notes:
To generate paymentoptionHash use below method
sha512(key|command|var1|salt)
where key = Provide your merchant key here
command = "payment_related_details_for_mobile_sdk"
var1 = Provide user credentials or use "default"
salt = Provide your merchant salt here
After successful initialisation of SamsungPay by calling checkForSamsungPayAvailiability method call init method
to make payment.
Sample
PayUSamsungPay.getInstance().init( Activity mActivity, PayUSUPIPostData payUSUPIPostData);
Input:
Activity : activity instance
PayUSUPIPostData : PayUSUPIPostData instance
Initialize PayUSUPIPostData using builder class PayUSUPIPostData.Builder.
Use bankcode = SAMPAY and pg = SAMPAY for Samsung Pay payments in your post data.
PayUSUPIPostData.Builder builder = new PayUSUPIPostData.Builder();
builder.setPostData(postData);
PayUSUPIPostData payUSUPIPostData = null;
try {
payUSUPIPostData = builder.build();
} catch (Exception e) {
e.printStackTrace();
}
Sample post data:
txnid=1524122818080&productinfo=product_info&user_credentials=default&key=*****&surl=**SUCCESS_URL**&furl=**FAILURE_URL&firstname=firstname&[email protected]&amount=10&udf1=udf1&udf2=udf2&udf3=udf3&udf4=udf4&udf5=udf5&pg=SAMPAY&bankcode=SAMPAY&hash=***PAYMENT_HASH***
Notes:
To generate paymentHash use below method
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt)
where key = Provide merchant key
txnid = Provide transaction id
amount = Provide transaction amount
productinfo = Provide product info
firstname = Provide customer firstname
email = Provide customer email
udf1-udf5 = Used Defined values
salt = Provide merchant Salt
List of the callback function provided by PayU Samsung Pay:
-
onSamsungPayFailure (String payuResponse) - Calls when payment fails
-
onSamsungPaySuccess (String payuResponse) - Calls when payment succeeds
-
onSamsungPayInitialisationFailure (int errorCode,String description) - Called for Samsung Pay initialisation failure where,
- errorCode : Error Code
- description : Error Description
Following are error messages w.r.t. Samsung Pay initialisation failure
- ErrorCode : Description
- 1 : VENDOR_NOT_SUPPORTED
- 2 : DEVICE_NOT_SUPPORTED // Device is not supported
- 3 : APP_VERSION_MISMATCH // Samsung Pay version doesn't meet requirements
- 4 : COUNTRY_NOT_SUPPORTED // Country of device origin is not supported by Samsung Pay
- 5 : MERCHANT_KEY_NOT_REGISTER_FOR_SAMSUNG_PAY // Merchant is not registered for
Samsung Pay with PayU
- 6 : CONTEXT_NULL // Context is null
- 7 : PAYMENT_ID_NOT_PRESENT // Check your postdata
-
onSamsungPayInitialisationSuccess (String vpa) - Callback when Samsung Pay is successfully initialised.
- vpa : Customer vpa in masked form
// Callback for SamsungPay
PayUSamsungPayCallback payUSamsungPayCallback = new PayUSamsungPayCallback() {
@Override
public void onSamsungPayFailure (String payuResponse) {
Intent intent = new Intent();
intent.putExtra(getString(R.string.cb_payu_response), payuResponse);
setResult(Activity.RESULT_CANCELED, intent);
finish();
}
@Override
public void onSamsungPayInitialisationSuccess(String vpa) {
super.onSamsungPayInitialisationSuccess(vpa);
// Merchants are advised to show Samsung Pay option on their UI in this callback.
}
@Override
public void onSamsungPaySuccess(String payuResponse) {
Intent intent = new Intent();
intent.putExtra(getString(R.string.payu_response), payuResponse);
setResult(Activity.RESULT_OK, intent);
finish();
}
@Override
public void onSamsungPayInitialisationFailure (int errorCode, String description) {
//Callback thrown in case Samsung Pay initialisation fails.
}
};
- SDKs Overview
- Server Side
- Client Side
- Android SDK Integration
- Android Custom Browser
- Android Samsung Pay SDK integration
- Android PhonePe Intent SDK integration
- Android Google Pay™ SDK Integration
- Android PayU CheckoutPro SDK Integration
- IOS PayU CheckoutPro SDK Integration
- iOS integration with PayU Checkout UI
- iOS SDK integration
- iOS Custom Browser
- Mobile Releases
- FAQs
- Common Issues