You can communicate with Midtrans API by sending HTTP(S) request. The request consists of Base URL and HTTP(S) Header. The Base URL specifies the resource to which the request is applied. The HTTP(S) Header carries the data type of the request, data type of the response, and the authentication information. Midtrans then sends a response back in JSON format.
The Base URLs are as given below.
- Sandbox Environment:
- Production Environment:
In the Sandbox Environment, the transactions will not trigger actual purchase. Midtrans service can be fully utilized in the Production Environment.
An HTTP Header is used in an HTTP request to provide information about the request. The HTTP Header for Midtrans API request carries the following information.
|Indicates data type of the request.
|Indicates the expected data type of the response.
server key ,
|Contains the credentials to authenticate a user. Midtrans uses Basic AUTH for authentication. For more details, refer Authorization
The input and output parameters for Midtrans API are in JSON format.
To accept JSON input and output parameters, you need to add the following HTTP(S) Header.
Maximum allowed size of HTTP(S) request is 16KB. Please limit the size of your HTTP requests to this value to avoid request failures.