Midtrans ❤️ Postman!
This repository contains Postman collection for various payment API call to Midtrans Payment API.
API covered:
- Download and open Postman
- Import:
- Use this link: https://www.getpostman.com/collections/b25a3fcfb9f0afc1f348 , or
- Clone or download this repository, then import postman collections from
MidtransPaymentAPI.postman_collection
file.
- Register to Midtrans
- Login to Midtrans, switch to Sandbox, go to menu
Settings > Access Keys
. Copy your Server Key - In Postman, open Midtrans Payment API then choose one request you want to try, click on
Authorization
tab (beside Headers tab) - Select Type as
Basic Auth
, fill Username with your Server Key (looks like thisVT-server-xxxxxx
). Leave Password field blank, click Update Request - Now you can
save
then clicksend
the request. You will get server response.
If you are testing Snap transaction token request
you will get response like:
{ "token": "bffb82ff-f8bb-4651-86b0-0c2316b77c0a" }
To see how that token works, you can open file ../snap-opener/index.html
in your web browser to preview the SNAP payment page.
- Tips: you can also append snap token like this in url
../snap-opener/index.html?snap_token=bffb82ff-f8bb-4651-86b0-0c2316b77c0a&is_production=false
You can also edit file snap/index.html
and insert your own token to the HTML, then open in web browser.
This file is for snap token viewer only, you should not use this for integration reference, for front-end integration sample, see below section
For real example on how you can use Snap token in your website front-end, you can see sample minimum implementation here:
../sample-frontend/index.html
Edit the file and insert
<Your-Client-Key-Here>
with your client key.
To get credit card token for Core API Credit Card charge process, you can open ../coreAPI-getTokenCC/index.html
in your web browser. (mandiri clickpay also need get token process).
Edit the file and insert
<Your-Client-Key-Here>
with your client key.
All implementation in this example are pure HTML & Javascript so you don't need to have any server running.
All endpoint used in this postman collection is for sandbox transaction
, to switch to production
change endpoint URL from:
https://api.sandbox.midtrans.com/../..
to
https://api.midtrans.com/../..
(Just remove the sandbox.
from url)
If you get error
{
"error_messages": [
"Access denied due to unauthorized transaction, please check client or server key",
"Visit https://snap-docs.midtrans.com/#request-headers for more details"
]
}
- Please make sure you do step 4-7 properly like instructed in Usage Instruction section.
- Please make sure you are using correct Server Key (Serverkey for sandbox & production are different).
15/11/2018
- Add sample collection for flow recurring Credit Cards.
- Add a list of information and contacts to help understand the use of the Midtrans product API.
25/01/2018
- Add gopay & danamon online banking example.
- Change mandiri clickpay request, according to docs.
- Change sample customer email.
- Midtrans Profile
- Midtrans Registration
- General Documentation Midtrans
- SNAP documentation
- Core API documentation
- Mobile Documentation Product Midtrans
- Can't find answer you looking for? email to Technical Support Team Midtrans support@midtrans.com