Interface MidtransCoreApi

  • All Known Implementing Classes:
    MidtransCoreApiImpl

    public interface MidtransCoreApi
    Gateway for midtrans CoreAPI
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Config apiConfig()
      Do re-set config Class like clientKey, serverKey, isProduction
      org.json.JSONObject approveTransaction​(String orderId)
      Do `/{orderId}/approve` API request to Core API
      org.json.JSONObject cancelTransaction​(String orderId)
      Do `/{orderId}/cancel` API request to Core API
      org.json.JSONObject captureTransaction​(Map<String,​String> params)
      Do `/capture API` request to Core API
      org.json.JSONObject cardPointInquiry​(String tokenId)
      Do `/point_inquiry/{tokenId}` API request to Core API
      org.json.JSONObject cardToken​(Map<String,​String> params)
      Do `/token` API request to Core API
      org.json.JSONObject chargeTransaction​(Map<String,​Object> params)
      Do /charge API request to Core API
      org.json.JSONObject checkTransaction​(String orderId)
      Do /{orderId}/status API request to Core API
      org.json.JSONObject createSubscription​(Map<String,​Object> subscriptionReq)
      Do `v1/subscriptions` API request to Core API for Create subscription.
      org.json.JSONObject denyTransaction​(String orderId)
      Do `/{orderId}/deny` API request to Core API
      org.json.JSONObject directRefundTransaction​(String orderId, Map<String,​String> params)
      Do `/{orderId}/status/b2b` API request to Core API
      org.json.JSONObject disableSubscription​(String subscriptionId)
      Do `v1/subscriptions/{subscription_id}/disable` Make the subscription inactive (the subscription will not create transaction anymore)s.
      org.json.JSONObject enableSubscription​(String subscriptionId)
      Do `v1/subscriptions/{subscription_id}/enable` Make the subscription active (the subscription will create periodic transaction) (more detail refer to: http://api-docs.midtrans.com/#enable-subscription)
      org.json.JSONObject expireTransaction​(String orderId)
      Do `/{orderId}/expire` API request to Core API
      org.json.JSONObject getBIN​(String binNumber)
      Do `v1/bins/{bin}` API request to Core API
      org.json.JSONObject getPaymentAccount​(String accountId)
      Do `v2/pay/account/{account_id}` find account by id to see the customer account details (more detail refer to: http://api-docs.midtrans.com/#get-pay-account)
      org.json.JSONObject getSubscription​(String subscriptionId)
      Do `v1/subscriptions/{subscription_id}` Find subscription by id to see the subscription details.
      org.json.JSONObject getTransactionStatusB2B​(String orderId)
      Do `/point_inquiry/{tokenId}` API request to Core API
      org.json.JSONObject linkPaymentAccount​(Map<String,​Object> accountRequest)
      Do `/v2/pay/account` to link customer account to be used for specific payment channels (more detail refer to: http://api-docs.midtrans.com/#create-pay-account)
      org.json.JSONObject refundTransaction​(String orderId, Map<String,​String> params)
      Do `/{orderId}/refund` API request to Core API
      org.json.JSONObject registerCard​(Map<String,​String> params)
      Do `/card/register` API request to Core API
      org.json.JSONObject unlinkPaymentAccount​(String accountId)
      Do `v2/pay/account/{account_id}/unbind` to unbind a linked customer account (more detail refer to: http://api-docs.midtrans.com/#unbind-pay-account)
      org.json.JSONObject updateSubscription​(String subscriptionId, Map<String,​Object> subscriptionReq)
      Do `v1/subscriptions/{subscription_id}` Update existing subscription details.
    • Method Detail

      • apiConfig

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

        org.json.JSONObject chargeTransaction​(Map<String,​Object> params)
                                       throws MidtransError
        Do /charge API request to Core API
        Parameters:
        params - Map Object parameter, object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-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.
      • checkTransaction

        org.json.JSONObject checkTransaction​(String orderId)
                                      throws MidtransError
        Do /{orderId}/status API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • approveTransaction

        org.json.JSONObject approveTransaction​(String orderId)
                                        throws MidtransError
        Do `/{orderId}/approve` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#approve-transaction)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • cancelTransaction

        org.json.JSONObject cancelTransaction​(String orderId)
                                       throws MidtransError
        Do `/{orderId}/cancel` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#cancel-transaction)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • expireTransaction

        org.json.JSONObject expireTransaction​(String orderId)
                                       throws MidtransError
        Do `/{orderId}/expire` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#expire-transaction)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • refundTransaction

        org.json.JSONObject refundTransaction​(String orderId,
                                              Map<String,​String> params)
                                       throws MidtransError
        Do `/{orderId}/refund` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#refund-transaction)
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • cardToken

        org.json.JSONObject cardToken​(Map<String,​String> params)
                               throws MidtransError
        Do `/token` API request to Core API
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#get-token)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • registerCard

        org.json.JSONObject registerCard​(Map<String,​String> params)
                                  throws MidtransError
        Do `/card/register` API request to Core API
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#register-card)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • cardPointInquiry

        org.json.JSONObject cardPointInquiry​(String tokenId)
                                      throws MidtransError
        Do `/point_inquiry/{tokenId}` API request to Core API
        Parameters:
        tokenId - {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#point-inquiry)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • captureTransaction

        org.json.JSONObject captureTransaction​(Map<String,​String> params)
                                        throws MidtransError
        Do `/capture API` request to Core API
        Parameters:
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON (more params detail refer to: https://api-docs.midtrans.com/#capture-transaction)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • getTransactionStatusB2B

        org.json.JSONObject getTransactionStatusB2B​(String orderId)
                                             throws MidtransError
        Do `/point_inquiry/{tokenId}` API request to Core API
        Parameters:
        orderId - {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status-b2b)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • directRefundTransaction

        org.json.JSONObject directRefundTransaction​(String orderId,
                                                    Map<String,​String> params)
                                             throws MidtransError
        Do `/{orderId}/status/b2b` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#direct-refund-transaction)
        params - {Map Object} object of Core API JSON body as parameter, will be converted to JSON
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • denyTransaction

        org.json.JSONObject denyTransaction​(String orderId)
                                     throws MidtransError
        Do `/{orderId}/deny` API request to Core API
        Parameters:
        orderId - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#deny-transaction)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • getBIN

        org.json.JSONObject getBIN​(String binNumber)
                            throws MidtransError
        Do `v1/bins/{bin}` API request to Core API
        Parameters:
        binNumber - {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#bin-api)
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • createSubscription

        org.json.JSONObject createSubscription​(Map<String,​Object> subscriptionReq)
                                        throws MidtransError
        Do `v1/subscriptions` API request to Core API for Create subscription. (more detail refer to: http://api-docs.midtrans.com/#create-subscription)
        Parameters:
        subscriptionReq - {Map Object} object of Subscription request body
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • getSubscription

        org.json.JSONObject getSubscription​(String subscriptionId)
                                     throws MidtransError
        Do `v1/subscriptions/{subscription_id}` Find subscription by id to see the subscription details. (more detail refer to: http://api-docs.midtrans.com/#get-subscription)
        Parameters:
        subscriptionId - {String} Subscription ID given by Midtrans
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • disableSubscription

        org.json.JSONObject disableSubscription​(String subscriptionId)
                                         throws MidtransError
        Do `v1/subscriptions/{subscription_id}/disable` Make the subscription inactive (the subscription will not create transaction anymore)s. (more detail refer to: http://api-docs.midtrans.com/#disable-subscription)
        Parameters:
        subscriptionId - {String} Subscription ID given by Midtrans
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • enableSubscription

        org.json.JSONObject enableSubscription​(String subscriptionId)
                                        throws MidtransError
        Do `v1/subscriptions/{subscription_id}/enable` Make the subscription active (the subscription will create periodic transaction) (more detail refer to: http://api-docs.midtrans.com/#enable-subscription)
        Parameters:
        subscriptionId - {String} Subscription ID given by Midtrans
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • updateSubscription

        org.json.JSONObject updateSubscription​(String subscriptionId,
                                               Map<String,​Object> subscriptionReq)
                                        throws MidtransError
        Do `v1/subscriptions/{subscription_id}` Update existing subscription details. (more detail refer to: http://api-docs.midtrans.com/#update-subscription)
        Parameters:
        subscriptionId - {String} Subscription ID given by Midtrans
        subscriptionReq - {Map Object} object of Subscription request body
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • linkPaymentAccount

        org.json.JSONObject linkPaymentAccount​(Map<String,​Object> accountRequest)
                                        throws MidtransError
        Do `/v2/pay/account` to link customer account to be used for specific payment channels (more detail refer to: http://api-docs.midtrans.com/#create-pay-account)
        Parameters:
        accountRequest - {Map Object} object of create payment account request body
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • getPaymentAccount

        org.json.JSONObject getPaymentAccount​(String accountId)
                                       throws MidtransError
        Do `v2/pay/account/{account_id}` find account by id to see the customer account details (more detail refer to: http://api-docs.midtrans.com/#get-pay-account)
        Parameters:
        accountId - {String} Customer account id to be used for payment
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.
      • unlinkPaymentAccount

        org.json.JSONObject unlinkPaymentAccount​(String accountId)
                                          throws MidtransError
        Do `v2/pay/account/{account_id}/unbind` to unbind a linked customer account (more detail refer to: http://api-docs.midtrans.com/#unbind-pay-account)
        Parameters:
        accountId - {String} Customer account id to be used for payment
        Returns:
        {JSONObject} - org.json Promise contains Object from JSON decoded response
        Throws:
        MidtransError - when an exception was occurred during executing the request.