Skip to content

Configuration

In this guide

Initialize DigetPay once at app start, choose an environment, and control logging. Configuration is a one-time setup.

Initialize before any payment call

Every payment or operation call requires an initialized SDK. Calling them before DigetPay.initialize() fails with ErrorCode.NOT_INITIALIZED.

Initialize the SDK once, usually from Application.onCreate().

import android.app.Application
import com.digetpay.sdk.DigetPay
import com.digetpay.sdk.config.DigetPayConfig
import com.digetpay.sdk.config.Environment

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()

        DigetPay.initialize(
            context = this,
            config = DigetPayConfig(
                apiKey = "YOUR_API_KEY",
                environment = Environment.SANDBOX,
                enableLogging = BuildConfig.DEBUG
            )
        )
    }
}
import android.app.Application;
import com.digetpay.sdk.DigetPay;
import com.digetpay.sdk.config.DigetPayConfig;
import com.digetpay.sdk.config.Environment;

public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        DigetPay.initialize(
            this,
            new DigetPayConfig(
                "YOUR_API_KEY",
                Environment.SANDBOX,
                BuildConfig.DEBUG
            )
        );
    }
}

Register the application class in AndroidManifest.xml:

<application
    android:name=".MyApp"
    ...>
</application>

Environments

Environment.SANDBOX
Development and integration testing. Use test cards and expect no real money movement.
Environment.PRODUCTION
Live payments with real cards and settlement.

Never ship SANDBOX to production

Double-check the environment in your release build. Shipping SANDBOX means real customers cannot pay; shipping PRODUCTION in a debug build can move real money during testing.

Logging

enableLogging turns on HTTP request and response logging. Keep it enabled only for development builds.

enableLogging = BuildConfig.DEBUG
new DigetPayConfig("YOUR_API_KEY", Environment.SANDBOX, BuildConfig.DEBUG);

Production

Disable logging in production builds. Logs can expose request metadata that should not appear in Logcat.

Next step

Configuration is done. Run your First Checkout to make an end-to-end payment.