Interface MidtransSnapApi

  • All Known Implementing Classes:
    MidtransSnapApiImpl

    public interface MidtransSnapApi
    Gateway for midtrans SnapAPI
    • Method Detail

      • apiConfig

        Config apiConfig()
        Do re-set config Class like clientKey, serverKey, isProduction
        Returns:
        Config.class
      • createTransaction

        org.json.JSONObject createTransaction​(Map<String,​Object> params)
                                       throws MidtransError
        Do `/transactions` API request to SNAP API return RAW JSON with JSONObject
        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

        String createTransactionToken​(Map<String,​Object> params)
                               throws MidtransError
        Do `/transactions` API request to SNAP API return String token
        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

        String createTransactionRedirectUrl​(Map<String,​Object> params)
                                     throws MidtransError
        Do `/transactions` API request to SNAP API return String redirectURL
        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.