HTTP(S) Header

HeaderValueDefinition
Content-Typeapplication/jsonThe Content-Type field indicates that JSON type is acceptable to send to the recipient
Acceptapplication/jsonThe Accept field is used to specify that JSON type is acceptable for the response
AuthorizationBasic AUTH_STRINGThe Authorization field credentials can be found in Midtrans's Dashboard side menu
X-Idempotency-Key<unique-identifierAn idempotency-key which can be used to uniquely identify a request. Maximum length is 100 characters



Idempotency-Key


{
    "error_message": "idempotency-key is not unique",
    "errors": "idempotency-key is not unique"
}

Idempotency-Key is used to uniquely identify a request. Every request which has the same Idempotency-Key must be identical. If the same Idempotency-Key is used for multiple requests which are not identical, the request will be rejected.

If the same identical requests is sent multiple times to the server using the same Idempotency-Key, it is guaranteed the request will be processed only once, and the same result will be given for every requests.

In the event of timeout, we can resend the request again using the same Idempotency-Key, to get the result from the previous request, without worrying the request will be processed twice.

We will removing Idempotency-Key which is older than 24 hours, every midnight (UTC).


Usage of Idempotency-Key are supported on the following endpoints:




Content-Type and Accept Header


In Payouts API, the input and output parameters of the methods will be in JSON format. To accept JSON input and output parameters, you need to add the following HTTP(S) header:

  • Content-Type: application/json
  • Accept: application/json



Authorization Header


AUTH_STRING = Base64.strict_encode64(API_KEY + ":")

The authorization header utilizes API Key following HTTP(S) BASIC AUTH convention:

  • For Development environment, obtain API Key in Midtrans's Sandbox Dashboard sidebar
  • For Production environment, obtain API Key in Midtrans's Production Dashboard sidebar

Authorization: Basic AUTH_STRING

AUTH_STRING = Base64(API_KEY + :)


Payouts validates HTTP request by using Basic Authentication method. You can find your API_KEY, at Midtrans Dashboard on the sidebar.




Monetary Value


All monetary is serialized as JSON string, with some restrictions:

  • Only contains numeric characters and a . character as a decimal-fraction separator.
  • Has at most 2 decimal-fraction digits.

Example of valid monetary values:

  • "10000"
    • "10000.0"
      • "10000.00"

📘

Decimal rounding might take place if the decimal-fraction value is not equal to .0