-
Notifications
You must be signed in to change notification settings - Fork 54
BCA Klikpay Payment Usage
V Sreekanth edited this page Oct 3, 2016
·
3 revisions
BCA Klikpay used webview to redirect users to the payment page provided by BCA.
We provide interface for transaction callback. You just need to implement TransactionCallback when make a transaction to get transaction response.
It contains three implemented methods onSuccess
, onFailure
and onError
.
public interface TransactionCallback {
//transaction response when success
public void onSuccess(TransactionResponse response);
//response when transaction failed
public void onFailure(TransactionResponse response, String reason);
//general error
public void onError(Throwable error);
}
To start the payment, use paymentUsingBCAKlikpay
function from MidtransSDK
instance with a checkout_token
.
MidtransSDK.getInstance().paymentUsingBCAKlikpay(AUTHENTICATION_TOKEN, new TransactionCallback() {
@Override
public void onSuccess(TransactionResponse response) {
//action when transaction success
}
@Override
public void onFailure(TransactionResponse response, String reason) {
//action when transaction failure
}
@Override
public void onError(Throwable error) {
//action when error
}
}
);
Redirect URL is got from TransactionResponse
.
String redirect = response.getRedirectUrl();
Then you must load redirect
into your webview.
webview.loadUrl(redirect);