Class MidtransSnapApiImpl

    • Constructor Detail

      • MidtransSnapApiImpl

        public MidtransSnapApiImpl​(Config config)
        SnapAPI constructor
        Parameters:
        config - Midtrans configuration
    • Method Detail

      • apiConfig

        public Config apiConfig()
        Description copied from interface: MidtransSnapApi
        Do re-set config Class like clientKey, serverKey, isProduction
        Specified by:
        apiConfig in interface MidtransSnapApi
        Returns:
        Config.class
      • createTransaction

        public org.json.JSONObject createTransaction​(Map<String,​Object> params)
                                              throws MidtransError
        Description copied from interface: MidtransSnapApi
        Do `/transactions` API request to SNAP API return RAW JSON with JSONObject
        Specified by:
        createTransaction in interface MidtransSnapApi
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • createTransactionToken

        public String createTransactionToken​(Map<String,​Object> params)
                                      throws MidtransError
        Description copied from interface: MidtransSnapApi
        Do `/transactions` API request to SNAP API return String token
        Specified by:
        createTransactionToken in interface MidtransSnapApi
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)
        Returns:
        {String} return tokenId to processing on frontend with Snap.js for transaction with SNAP PopUp
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • createTransactionRedirectUrl

        public String createTransactionRedirectUrl​(Map<String,​Object> params)
                                            throws MidtransError
        Description copied from interface: MidtransSnapApi
        Do `/transactions` API request to SNAP API return String redirectURL
        Specified by:
        createTransactionRedirectUrl in interface MidtransSnapApi
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more detail refer to: https://snap-docs.midtrans.com)
        Returns:
        {String} - return redirectURL for processing transaction with SNAP Redirect
        Throws:
        MidtransError - when an exception was occurred during executing the request.