Navigation Menu

Skip to content

Gift Card Payment

Raka Westu Mogandhi edited this page Dec 20, 2016 · 1 revision

Overview

Gift card payment is now supported in mobile SDK.

Implementation

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);
}

Start the payment

You need the checkout token, card number and card password before starting the payment.

midtransSDK.paymentUsingGCI(CHECKOUT_TOKEN, CARD_NUMBER, CARD_PASSWORD, new TransactionCallback() {
                @Override
                public void onSuccess(TransactionResponse response) {
                    // Handle success
                }

                @Override
                public void onFailure(TransactionResponse response, String reason) {
                    // Handle Failure
                }

                @Override
                public void onError(Throwable error) {
                    // Handle Error
                }
            });