Skip to main content

NucleiPaymentCallback()

Please find below the NucleiPaymentCallback with all the methods.

class Application extends MultiDexApplication implements NucleiPaymentCallback {
private NucleiSDK nucleiSDK;

@Override
public void onCreate() {
super.onCreate();
initNuclei();
}

public NucleiSDK getNucleiSDK() {
return nucleiSDK;
}

private void initNuclei() {
nucleiSDK = NucleiSDK.bind(this)
.setEnvironment(SdkEnvironment.STAGING)
.enableLogs(true) //BuildConfig.DEBUG
.setKey("abcd-123-efg")
.setTheme(R.style.SampleAppTheme)
.init();

nucleiSDK.setPaymentCallback(this);

}

/**
* Use nucleiPaymentInitData to start the payment screen of the bank
* NucleiPaymentInitData contains orderId, transactionId, paymentMode
* and transaction related information
*/
@Override
public void onPaymentInit(NucleiPaymentInitData nucleiPaymentInitData) {
/**
* If user returns from payment screen without proceeding to pay,
* the bank app should call the method
* MyApplication.getInstance().getNucleiSDK().onPaymentAborted(nucleiPayment);
* nucleiPayment object can be fetched from nucleiPaymentInitData
*/

/**
* If the payment is failed, bank app can intimate the nuclei sdk using
* MyApplication.getInstance()
* .getNucleiSDK()
* .finishPayment(nucleiPaymentInitData.nucleiPayment, NucleiPaymentStatus.FAILURE);
*/

/**
* If the payment is successful, bank app can intimate the nuclei sdk using
* MyApplication.getInstance()
* .getNucleiSDK()
* .finishPayment(nucleiPaymentInitData.nucleiPayment, NucleiPaymentStatus.SUCCESS);
*/
}

/**
* This method is called when payment handled by nuclei is done.
* Bank app need not handle this if it is using it's own payment screen
*
* @param nucleiPayment
* @param paymentStatus
*/

@Override
public void onPaymentFinish(NucleiPayment nucleiPayment, @NucleiPaymentStatus int paymentStatus) {
/**
* Bank app need not handle this if it is using it's own payment screen
*/

}