public class MidtransCoreApiImpl extends java.lang.Object implements MidtransCoreApi
MidtransCoreApi
Constructor and Description |
---|
MidtransCoreApiImpl(Config config)
CoreAPI constructor
|
Modifier and Type | Method and Description |
---|---|
Config |
apiConfig()
Do re-set config Class like clientKey, serverKey, isProduction
|
org.json.JSONObject |
approveTransaction(java.lang.String param)
Do `/{orderId}/approve` API request to Core API
|
org.json.JSONObject |
cancelTransaction(java.lang.String param)
Do `/{orderId}/cancel` API request to Core API
|
org.json.JSONObject |
captureTransaction(java.util.Map<java.lang.String,java.lang.String> params)
Do `/capture API` request to Core API
|
org.json.JSONObject |
cardPointInquiry(java.lang.String tokenId)
Do `/point_inquiry/{tokenId}` API request to Core API
|
org.json.JSONObject |
cardToken(java.util.Map<java.lang.String,java.lang.String> params)
Do `/token` API request to Core API
|
org.json.JSONObject |
chargeTransaction(java.util.Map<java.lang.String,java.lang.Object> body)
Do /charge API request to Core API
|
org.json.JSONObject |
checkTransaction(java.lang.String param)
Do /{orderId}/status API request to Core API
|
org.json.JSONObject |
createSubscription(java.util.Map<java.lang.String,java.lang.Object> subscriptionReq)
Do `v1/subscriptions` API request to Core API for Create subscription.
|
org.json.JSONObject |
denyTransaction(java.lang.String param)
Do `/{orderId}/deny` API request to Core API
|
org.json.JSONObject |
directRefundTransaction(java.lang.String param,
java.util.Map<java.lang.String,java.lang.String> requestBody)
Do `/{orderId}/status/b2b` API request to Core API
|
org.json.JSONObject |
disableSubscription(java.lang.String subscriptionId)
Do `v1/subscriptions/{subscription_id}/disable` Make the subscription inactive (the subscription will not create transaction anymore)s.
|
org.json.JSONObject |
enableSubscription(java.lang.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(java.lang.String param)
Do `/{orderId}/expire` API request to Core API
|
org.json.JSONObject |
getBIN(java.lang.String binNumber)
Do `v1/bins/{bin}` API request to Core API
|
org.json.JSONObject |
getPaymentAccount(java.lang.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(java.lang.String subscriptionId)
Do `v1/subscriptions/{subscription_id}` Find subscription by id to see the subscription details.
|
org.json.JSONObject |
getTransactionStatusB2B(java.lang.String param)
Do `/point_inquiry/{tokenId}` API request to Core API
|
org.json.JSONObject |
linkPaymentAccount(java.util.Map<java.lang.String,java.lang.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(java.lang.String param,
java.util.Map<java.lang.String,java.lang.String> body)
Do `/{orderId}/refund` API request to Core API
|
org.json.JSONObject |
registerCard(java.util.Map<java.lang.String,java.lang.String> params)
Do `/card/register` API request to Core API
|
org.json.JSONObject |
unlinkPaymentAccount(java.lang.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(java.lang.String subscriptionId,
java.util.Map<java.lang.String,java.lang.Object> subscriptionReq)
Do `v1/subscriptions/{subscription_id}` Update existing subscription details.
|
public MidtransCoreApiImpl(Config config)
config
- Midtrans configuration
public Config apiConfig()
MidtransCoreApi
apiConfig
in interface MidtransCoreApi
public org.json.JSONObject chargeTransaction(java.util.Map<java.lang.String,java.lang.Object> body) throws MidtransError
MidtransCoreApi
chargeTransaction
in interface MidtransCoreApi
body
- 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)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject checkTransaction(java.lang.String param) throws MidtransError
MidtransCoreApi
checkTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject approveTransaction(java.lang.String param) throws MidtransError
MidtransCoreApi
approveTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#approve-transaction)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject cancelTransaction(java.lang.String param) throws MidtransError
MidtransCoreApi
cancelTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#cancel-transaction)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject expireTransaction(java.lang.String param) throws MidtransError
MidtransCoreApi
expireTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#expire-transaction)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject refundTransaction(java.lang.String param, java.util.Map<java.lang.String,java.lang.String> body) throws MidtransError
MidtransCoreApi
refundTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#refund-transaction)body
- {Map Object} object of Core API JSON body as parameter, will be converted to JSONMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject cardToken(java.util.Map<java.lang.String,java.lang.String> params) throws MidtransError
MidtransCoreApi
cardToken
in interface MidtransCoreApi
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)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject registerCard(java.util.Map<java.lang.String,java.lang.String> params) throws MidtransError
MidtransCoreApi
registerCard
in interface MidtransCoreApi
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)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject cardPointInquiry(java.lang.String tokenId) throws MidtransError
MidtransCoreApi
cardPointInquiry
in interface MidtransCoreApi
tokenId
- {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#point-inquiry)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject captureTransaction(java.util.Map<java.lang.String,java.lang.String> params) throws MidtransError
MidtransCoreApi
captureTransaction
in interface MidtransCoreApi
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)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject getTransactionStatusB2B(java.lang.String param) throws MidtransError
MidtransCoreApi
getTransactionStatusB2B
in interface MidtransCoreApi
param
- {String} of credit card (more detail refer to: https://api-docs.midtrans.com/#get-transaction-status-b2b)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject directRefundTransaction(java.lang.String param, java.util.Map<java.lang.String,java.lang.String> requestBody) throws MidtransError
MidtransCoreApi
directRefundTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#direct-refund-transaction)requestBody
- {Map Object} object of Core API JSON body as parameter, will be converted to JSONMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject denyTransaction(java.lang.String param) throws MidtransError
MidtransCoreApi
denyTransaction
in interface MidtransCoreApi
param
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#deny-transaction)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject getBIN(java.lang.String binNumber) throws MidtransError
MidtransCoreApi
getBIN
in interface MidtransCoreApi
binNumber
- {String} of the transaction (more detail refer to: https://api-docs.midtrans.com/#bin-api)MidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject createSubscription(java.util.Map<java.lang.String,java.lang.Object> subscriptionReq) throws MidtransError
MidtransCoreApi
createSubscription
in interface MidtransCoreApi
subscriptionReq
- {Map Object} object of Subscription request bodyMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject getSubscription(java.lang.String subscriptionId) throws MidtransError
MidtransCoreApi
getSubscription
in interface MidtransCoreApi
subscriptionId
- {String} Subscription ID given by MidtransMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject disableSubscription(java.lang.String subscriptionId) throws MidtransError
MidtransCoreApi
disableSubscription
in interface MidtransCoreApi
subscriptionId
- {String} Subscription ID given by MidtransMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject enableSubscription(java.lang.String subscriptionId) throws MidtransError
MidtransCoreApi
enableSubscription
in interface MidtransCoreApi
subscriptionId
- {String} Subscription ID given by MidtransMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject updateSubscription(java.lang.String subscriptionId, java.util.Map<java.lang.String,java.lang.Object> subscriptionReq) throws MidtransError
MidtransCoreApi
updateSubscription
in interface MidtransCoreApi
subscriptionId
- {String} Subscription ID given by MidtranssubscriptionReq
- {Map Object} object of Subscription request bodyMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject linkPaymentAccount(java.util.Map<java.lang.String,java.lang.Object> accountRequest) throws MidtransError
MidtransCoreApi
linkPaymentAccount
in interface MidtransCoreApi
accountRequest
- {Map Object} object of create payment account request bodyMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject getPaymentAccount(java.lang.String accountId) throws MidtransError
MidtransCoreApi
getPaymentAccount
in interface MidtransCoreApi
accountId
- {String} Customer account id to be used for paymentMidtransError
- when an exception was occurred during executing the request.public org.json.JSONObject unlinkPaymentAccount(java.lang.String accountId) throws MidtransError
MidtransCoreApi
unlinkPaymentAccount
in interface MidtransCoreApi
accountId
- {String} Customer account id to be used for paymentMidtransError
- when an exception was occurred during executing the request.