Package com.midtrans

Class Config


  • public class Config
    extends Object
    Midtrans configuration
    • Constructor Detail

      • Config

        public Config​(String serverKey,
                      String clientKey,
                      boolean isProduction)
        Deprecated.
        This constructor will delete soon on the next major release.

        Please use builder() instead.

        Midtrans configuration constructor
        Parameters:
        serverKey - Merchant server-key
        clientKey - Merchant client-key
        isProduction - Merchant Environment Sandbox or Production
      • Config

        public Config​(String serverKey,
                      String clientKey,
                      boolean isProduction,
                      int connectionTimeout,
                      int readTimeout,
                      int writeTimeout,
                      int maxConnectionPool,
                      int keepAliveDuration)
        Deprecated.
        This constructor will delete soon on the next major release.

        Please use builder() instead.

        Midtrans configuration constructor
        Parameters:
        serverKey - Merchant server-key
        clientKey - Merchant client-key
        isProduction - Merchant Environment Sandbox or Production
        connectionTimeout - Config for connection timeout
        readTimeout - Config for read timeout
        writeTimeout - Config for write timeout
        maxConnectionPool - value max for connection pool
        keepAliveDuration - Durations for Keep alive connection
      • Config

        public Config​(String serverKey,
                      String clientKey,
                      boolean isProduction,
                      int connectionTimeout,
                      int readTimeout,
                      int writeTimeout,
                      int maxConnectionPool,
                      int keepAliveDuration,
                      ProxyConfig proxyConfig)
        Deprecated.
        This constructor will delete soon on the next major release.

        Please use builder() instead.

        Midtrans configuration constructor
        Parameters:
        serverKey - Merchant server-key
        clientKey - Merchant client-key
        isProduction - Merchant Environment Sandbox or Production
        connectionTimeout - Config for connection timeout
        readTimeout - Config for read timeout
        writeTimeout - Config for write timeout
        maxConnectionPool - value max for connection pool
        keepAliveDuration - Durations for Keep alive connection
        proxyConfig - Config for use http proxy
      • Config

        public Config​(String serverKey,
                      String clientKey,
                      boolean isProduction,
                      boolean enabledLog,
                      int connectionTimeout,
                      int readTimeout,
                      int writeTimeout,
                      int maxConnectionPool,
                      int keepAliveDuration,
                      TimeUnit httpClientTimeUnit,
                      String irisIdempotencyKey,
                      String paymentIdempotencyKey,
                      String xAppendNotification,
                      String xOverrideNotification,
                      ProxyConfig proxyConfig,
                      Map<String,​String> customHeaders)
    • Method Detail

      • getGlobalConfig

        public static Config getGlobalConfig()
      • isProduction

        public boolean isProduction()
        Get environment type
        Returns:
        boolean
      • getSERVER_KEY

        public String getSERVER_KEY()
        Deprecated.
        This method will delete soon on the next major release.

        Please use getServerKey() instead.

        Get merchant server key
        Returns:
        getServerKey()
      • getServerKey

        public String getServerKey()
        Get merchant server key
        Returns:
        Merchant server key
      • getCLIENT_KEY

        public String getCLIENT_KEY()
        Deprecated.
        This method will delete soon on the next major release.

        Please use getClientKey() instead.

        Get merchant client key
        Returns:
        Merchant client key
      • getClientKey

        public String getClientKey()
        Get merchant client key
        Returns:
        Merchant client key
      • getConnectionTimeout

        public int getConnectionTimeout()
        Get http client connection timeout
        Returns:
        connection timeout
      • getReadTimeout

        public int getReadTimeout()
        Get http client read timeout
        Returns:
        read timeout
      • getWriteTimeout

        public int getWriteTimeout()
        Get http client write timeout
        Returns:
        write timeout
      • getMaxConnectionPool

        public int getMaxConnectionPool()
        Get http client max connection pool
        Returns:
        max connection pool
      • getKeepAliveDuration

        public int getKeepAliveDuration()
        Get http client keep alive durations
        Returns:
        keep alive durations
      • getHttpClientTimeUnit

        public TimeUnit getHttpClientTimeUnit()
      • isEnabledLog

        public boolean isEnabledLog()
        Get enableLog is enabled
        Returns:
        Http client enabledLog
      • getCoreApiURL

        public String getCoreApiURL()
        set BASE_URL to CoreAPI_BASE_URL in accordance with the environment type
      • getSnapApiURL

        public String getSnapApiURL()
        set BASE_URL to SnapAPI_BASE_URL in accordance with the environment type
      • getIrisApiURL

        public String getIrisApiURL()
        set BASE_URL to IRIS_API_BASE_URL in accordance with the environment type
      • getIrisIdempotencyKey

        public String getIrisIdempotencyKey()
        Get Iris Idempotent Key
        Returns:
        iris idempotent key
      • getPaymentIdempotencyKey

        public String getPaymentIdempotencyKey()
        Get Payment Idempotent Key
        Returns:
        payment idempotent key
      • getPaymentAppendNotification

        public String getPaymentAppendNotification()
        Get Payment append notification URL
        Returns:
        URL append notification
      • getPaymentOverrideNotification

        public String getPaymentOverrideNotification()
        Get Payment override notification URL
        Returns:
        URL override notification
      • getIRIS_MERCHANT_KEY

        public String getIRIS_MERCHANT_KEY()
        Get Iris merchant key
        Returns:
        String iris merchant key
      • getIrisMerchantKey

        public String getIrisMerchantKey()
        Get Iris merchant key
        Returns:
        String iris merchant key
      • setSERVER_KEY

        public void setSERVER_KEY​(String SERVER_KEY)
        Deprecated.
        This method will delete soon on the next major release.

        Please use setServerKey(String) instead.

        set server-key for Basic Authentication while calling Midtrans API from backend.
        Parameters:
        SERVER_KEY - merchant server key
      • setServerKey

        public void setServerKey​(String serverKey)
        set server-key for Basic Authentication while calling Midtrans API from backend.
        Parameters:
        serverKey - merchant server key
      • setCLIENT_KEY

        public void setCLIENT_KEY​(String CLIENT_KEY)
        Deprecated.
        This method will delete soon on the next major release.

        Please use setClientKey(String) instead.

        set client-key used for authorization on frontend API request/configuration.
        Parameters:
        CLIENT_KEY - merchant client key
      • setClientKey

        public void setClientKey​(String clientKey)
        set client-key used for authorization on frontend API request/configuration.
        Parameters:
        clientKey - merchant client key
      • setProduction

        public void setProduction​(boolean production)
        set environment sandbox/production
        Parameters:
        production - merchant environment type
      • setEnabledLog

        public void setEnabledLog​(boolean enabledLog)
        set enable log for debugging
        Parameters:
        enabledLog - boolean to turn off/on LOG
      • setConnectionTimeout

        public void setConnectionTimeout​(int connectionTimeout,
                                         TimeUnit timeUnit)
        set connect timeout with time unit HttpClient
        Parameters:
        connectionTimeout -
        timeUnit -
      • setConnectionTimeout

        public void setConnectionTimeout​(int connectionTimeout)
        set connect timeout HttpClient
        Parameters:
        connectionTimeout - int connection time out unit durations is seconds
      • setReadTimeout

        public void setReadTimeout​(int readTimeout,
                                   TimeUnit timeUnit)
        set read timeout with time unit HttpClient
        Parameters:
        readTimeout -
        timeUnit -
      • setReadTimeout

        public void setReadTimeout​(int readTimeout)
        Set read timeout HttpClient
        Parameters:
        readTimeout - int read time out unit durations is seconds
      • setWriteTimeout

        public void setWriteTimeout​(int writeTimeout,
                                    TimeUnit timeUnit)
        set write timeout with time unit HttpClient
        Parameters:
        writeTimeout -
        timeUnit -
      • setWriteTimeout

        public void setWriteTimeout​(int writeTimeout)
        Set write timeout HttpClient
        Parameters:
        writeTimeout - int write time out unit durations is seconds
      • setProxyConfig

        public void setProxyConfig​(ProxyConfig proxyConfig)
        Set proxy configuration
        Parameters:
        proxyConfig - Object from ProxyConfig
      • setMaxConnectionPool

        public void setMaxConnectionPool​(int maxConnectionPool)
        Set max connection pool
        Parameters:
        maxConnectionPool - int max connection pool
      • setKeepAliveDuration

        public void setKeepAliveDuration​(int keepAliveDuration,
                                         TimeUnit timeUnit)
        set keep alive duration with time unit HttpClient
        Parameters:
        keepAliveDuration -
        timeUnit -
      • setKeepAliveDuration

        public void setKeepAliveDuration​(int keepAliveDuration)
        Set keep alive durations
        Parameters:
        keepAliveDuration - int keep alive duration, unit is seconds
      • setIrisIdempotencyKey

        public void setIrisIdempotencyKey​(String irisIdempotencyKey)
        Set Iris idempotent key
        Parameters:
        irisIdempotencyKey - String for idempotent key
      • setPaymentIdempotencyKey

        public void setPaymentIdempotencyKey​(String paymentIdempotencyKey)
        Set Payment idempotent key
        Parameters:
        paymentIdempotencyKey - String for idempotent key
      • paymentAppendNotification

        public void paymentAppendNotification​(String xAppendNotification)
        Set Payment append URL notification
        Parameters:
        xAppendNotification - String URL for append notification, multiple URL can separate with commas
      • paymentOverrideNotification

        public void paymentOverrideNotification​(String xOverrideNotification)
        Set Override URL notification
        Parameters:
        xOverrideNotification - String URL for override notification, multiple URL can separate with commas
      • setIRIS_MERCHANT_KEY

        @Deprecated
        public void setIRIS_MERCHANT_KEY​(String IRIS_MERCHANT_KEY)
        Deprecated.
        This method will delete soon on the next major release.

        Please use setIrisMerchantKey(String) instead.

        Set Iris Merchant key
        Parameters:
        IRIS_MERCHANT_KEY - String iris merchant key
      • setIrisMerchantKey

        public void setIrisMerchantKey​(String irisMerchantKey)
        Set Iris Merchant key
        Parameters:
        irisMerchantKey -
      • setCustomHeaders

        public void setCustomHeaders​(Map<String,​String> customHeaders)
        Set Custom headers for API Request
        Parameters:
        customHeaders - Map string for custom headers