# requestWithdrawal

open fun requestWithdrawal(@NonNull activity: Activity, @Nullable callback: GamebaseDataCallback<TemporaryWithdrawalInfo>)

Request to withdraw. If the user who requested the withdrawal logs in, you can check the grace expiration time through the AuthToken.getTemporaryWithdrawalInfo().getGracePeriodDate().

Example Usage:

    // Request withdrawal
    public static void testRequestWithdraw() {
        Gamebase.TemporaryWithdrawal.requestWithdrawal(new GamebaseCallback() {
            @Override
            public void onCallback(TemporaryWithdrawalInfo data GamebaseException exception) {
                if (!Gamebase.isSuccess(exception)) {
                	if (exception.getCode() == GamebaseError.AUTH_WITHDRAW_ALREADY_TEMPORARY_WITHDRAW) {
                        // Already requested temporary withdrawal before.
                    } else {
                        // Request temporary withdrawal failed.
                        return;
                    }
                }

                // Request temporary withdrawal success.
            }
        });
    }

    // Login after requested withdrawal
    public static void testLogin() {
        Gamebase.login(activity, provider, new GamebaseDataCallback<AuthToken>() {
            @Override
            public void onCallback(AuthToken data, GamebaseException exception) {
                if (!Gamebase.isSuccess(exception)) {
                    // Login failed
                    return;
                }

                // Check if user is requesting withdrawal
                if (data.getTemporaryWithdrawalInfo() != null) {
                    // User is under temporary withdrawal
                    long gracePeriodDate = data.getTemporaryWithdrawalInfo().getGracePeriodDate();
                } else {
                    // Login success.
                }
            }
        });
    }

Content copied to clipboard

#### Since

Added 2.9.0.

#### Parameters

activity

The activity which is starting the mapping process.

callback

Callbacks the result of requesting withdrawal.

#### See also

TemporaryWithdrawalInfo
GamebaseDataCallback
Gamebase
AuthToken