Midtrans Payment API Postman Collection

Midtrans  ❤️ Postman!

Description

This repository contains Postman collection for various payment API call to Midtrans Payment API.

API covered:

Usage Instruction

  1. Download and open Postman
  2. Import:
  3. Register to Midtrans
  4. Login to Midtrans, switch to Sandbox, go to menu Settings > Access Keys. Copy your Server Key
  5. In Postman, open Midtrans Payment API then choose one request you want to try, click on Authorization tab (beside Headers tab)
  6. Select Type as Basic Auth, fill Username with your Server Key (looks like this VT-server-xxxxxx). Leave Password field blank, click Update Request
  7. Now you can save then click send the request. You will get server response.

Authorization Config

Specific Usage

You need to download/clone this repo to your local to use these:

SNAP - Snap Popup Viewer

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

SNAP - Snap Front-End Integration Example

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.

Core API - Credit Card Get Token Example

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.

Production Mode

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)

Troubleshooting

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).

Changelog

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.

Get Help