Getting Started
Overview
- User performs the checkout operation
- Merchant server makes an api request to the snap backend to get the
SNAP_TOKEN
- Snap backend responds to the api call with the
SNAP_TOKEN
- Merchant server constructs the html page and sends it back to the browser
- User verifies the details and clicks the pay button. Merchant’s javascript code calls
snap.pay(SNAP_TOKEN, options)
. User then fills up the payment details and clicks the confirm button.- Snap JS sends the payment details to the snap backend
- Snap backend processes the details and responds with the charge status. Snap JS then calls the corresponding callback provided by the merchant’s javascript code.
- Snap backend notifies the merchant server about the charge status
Supported Browsers
We try to support the latest versions of all major browsers. The list below provides the minimum supported version of each browser in Mobile and Desktop platform.
Mobile
- Chrome 32 and above
- Android 5.0 and above
- Safari 8 and above
- BlackBerry 10 and above
Desktop
- Chrome 26 and above
- Firefox 29 and above
- Internet Explorer 10 and above
- Safari 6 and above
Library and Plugin
We are trying to make the integration process as easy as possible. This section contains a list of plugins and libraries owned by Midtrans. If you write your own plugin or library and would like us to link it, contact support@midtrans.com.
Libraries
Platform | Resources |
---|---|
PHP | Github |
Plugin
Platform | Resources |
---|---|
Prestashop | v1.6 Github |
Magento | v1.8, v1.9 Github |
Opencart | v2.0, v2.1, v2.2 Github |
WHMCS | WHMCS v5.3.12 or greater Github |
Wordpress Woocommerce |
Wordpress v3.9.1 - v4.x WooCommerce v2.1.11 - v2.5.x Github |
On Board with Snap
To start using Snap, you have to register for Midtrans Sandbox/Production account here. Once you have registered, Midtrans will provide all available payment channels in sandbox mode that you can start to integrate with.
To know more about steps to enable GoPay payment please see this section.
Existing Merchant
For existing merchants (merchants already live in Production), only one step need to be taken to enable a specific payment method.
1. Set Activate Payment Option in Snap Payment List
Merchants can pick to activate a payment method through the Merchant Administration Portal (MAP) in menu Settings -> Snap Preferences Settings on Tab ‘Payment Channels’. Merchant can drag the a desired payment channels into which payment channel’s order. Consider the following figure.
Just drag a desired payment channels option to the active list of payment list. Through this option, the merchant no longer need to do any code adjustment in their end, just set a desired payment channel on and that payment will be live.
New Merchant
Goal: Merchants complete the pre-requisite before integrating with Midtrans
There are a few pre-requisites before integrating with Midtrans:
1. Register to Midtrans Sandbox/Production account
Midtrans has one central login to access both production and sandbox account. Sandbox is utilized for development period while production is utilized when the merchant has completed the integration process and want to go live. Data and transaction made on sandbox account will not trigger an actual purchase while in production account will trigger an actual process. Register for Midtrans Sandbox/Production account here.
Once logged in, there will be a small button on the header of the dashboard that shows you on whether you are in the production or sandbox environment. The color of the navigation sidebar are also set differently between Production (light blue) and Sandbox (dark blue) for further clarity.
2. Fill in the required information in Merchant Admin Portal (MAP)
The required fields can be found under Settings - General Settings.
3. Take note of your account Access Keys
Your account keys can be found under Settings - Access Keys.
4. Configure Redirection URL
Customer will be returned to your website after payment process is completed.
Go to Settings - Configuration menu to manage the redirection URL.
5. Configure Merchant Info (Name, Logo & Theme Color)
Merchants can configure their name (brand name), logo and theme color that can be matched with the merchant’s web theme color through Settings - Snap Preferences on tab ‘Theme and Color’ in their dashboard.
6. Set Activate Payment Option in Snap Payment List
Merchants can pick to activate specific payment methods through Merchant Administration Portal (MAP) in menu Settings - Snap Preferences Settings on Tab ‘Payment Channels’. Merchants can drag the particular payment into which payment channel’s order. Such as this figure. Just drag the a payment channel option to the activate the payment method.
Backend Integration
Backend integration goal is to acquire SNAP_TOKEN
by providing payment informations. We provide a HTTP API to do this.
Endpoint
HTTP Method: POST
Production: https://app.midtrans.com/snap/v1/transactions
Sandbox: https://app.sandbox.midtrans.com/snap/v1/transactions
Request Headers
SERVER_KEY = "VT-server-Cpo03kYDOc0cNUKgt6hnLkKg"
AUTH_STRING = Base64("VT-server-Cpo03kYDOc0cNUKgt6hnLkKg:")
AUTH_STRING = "VlQtc2VydmVyLUNwbzAza1lET2MwY05VS2d0NmhuTGtLZzo="
To create valid Snap HTTP request, merchant have to add 3 headers:
Accept: application/json
Content-Type: application/json
Authorization: Basic AUTH_STRING
Snap validates HTTP request by using Basic Authentication method. The username is your SERVER_KEY
while the password is empty. You can see your SERVER-KEY
on Settings - Access Keys.
Authorization
header value is represented by AUTH_STRING
. AUTH_STRING
is base-64 encoded string of your username & password.
AUTH_STRING
= Base64(SERVER_KEY
+ :
)
Request Body (JSON Parameter)
Minimum request
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
}
}
Complete request
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456",
"billing_address": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "081 2233 44-55",
"address": "Sudirman",
"city": "Jakarta",
"postal_code": "12190",
"country_code": "IDN"
},
"shipping_address": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "0 8128-75 7-9338",
"address": "Sudirman",
"city": "Jakarta",
"postal_code": "12190",
"country_code": "IDN"
}
},
"enabled_payments": ["credit_card", "cimb_clicks",
"bca_klikbca", "bca_klikpay", "bri_epay", "echannel", "permata_va",
"bca_va", "bni_va", "bri_va", "other_va", "gopay", "indomaret",
"danamon_online", "akulaku", "shopeepay"],
"credit_card": {
"secure": true,
"channel": "migs",
"bank": "bca",
"installment": {
"required": false,
"terms": {
"bni": [3, 6, 12],
"mandiri": [3, 6, 12],
"cimb": [3],
"bca": [3, 6, 12],
"offline": [6, 12]
}
},
"whitelist_bins": [
"48111111",
"41111111"
],
"dynamic_descriptor": {
"merchant_name" : "merchant",
"city_name": "Jakarta",
"country_code": "ID"
}
},
"bca_va": {
"va_number": "12345678911",
"sub_company_code": "00000",
"free_text": {
"inquiry": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
],
"payment": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
]
}
},
"bni_va": {
"va_number": "12345678"
},
"bri_va": {
"va_number": "1234567891234"
},
"permata_va": {
"va_number": "1234567890",
"recipient_name": "SUDARSONO"
},
"shopeepay": {
"callback_url": "http://shopeepay.com"
},
"callbacks": {
"finish": "https://demo.midtrans.com"
},
"expiry": {
"start_time": "2018-12-13 18:11:08 +0700",
"unit": "minutes",
"duration": 1
},
"custom_field1": "custom field 1 content",
"custom_field2": "custom field 2 content",
"custom_field3": "custom field 3 content"
}
Parameter | Description |
---|---|
transaction_details Transaction Details (required) |
Specific information regarding the transaction |
item_details Array of Item Details (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details (optional) |
Specific information regarding the customer |
enabled_payments Array (optional) |
List of payment types that should be enabled. If blank, all active payment types are included. Options: credit_card , gopay , cimb_clicks , bca_klikbca , bca_klikpay , bri_epay , telkomsel_cash , echannel , permata_va , other_va , bca_va , bni_va , bri_va , indomaret , danamon_online , akulaku , shopeepay . An alias refers to a list of payment types. Adding an alias is the equivalent of adding all the the payment types it refers to. Supported aliases: bank_transfer => permata_va , bca_va , bni_va cstore => kioson , indomaret .If you want to use other_va , either permata_va or bni_va because Midtrans handles other bank transfer as either Permata or BNI VA. |
credit_card CreditCard (optional) |
Credit card payment options |
bca_va BCA Virtual Account (optional) |
BCA Virtual Account payment options |
permata_va Permata Virtual Account (optional) |
Permata Virtual Account payment options |
bni_va BNI Virtual Account (optional) |
BNI Virtual Account payment options |
bri_va BRI Virtual Account (optional) |
BRI Virtual Account payment options |
shopeepay ShopeePay (optional) |
ShopeePay payment options |
callbacks Callbacks (optional) |
Redirect URL after transaction is successfully paid (Overriden by JS callback). Can also be set via Snap Settings menu in your dashboard. |
expiry Expiry (optional) |
Custom transaction lifetime |
custom_field1 String(255) (optional) |
Custom field 1 for custom parameter from merchant |
custom_field2 String(255) (optional) |
Custom field 2 for custom parameter from merchant |
custom_field3 String(255) (optional) |
Custom field 3 for custom parameter from merchant |
JSON Objects
Collection of JSON objects that are used in Create Snap Token parameter.
Note: More JSON objects exists for each specific payment channels.
Transaction Details Object
{
"order_id": "ORDER-101",
"gross_amount": 10000
}
Parameter | Description |
---|---|
transaction_details.order_id String(50) (required) |
Unique transaction ID. A single ID could be used only once by a Merchant. NOTE: Allowed Symbols are dash(-), underscore(_), tilde (~), and dot (.) |
transaction_details.gross_amount Integer (required) |
Amount to be charged |
Item Details Object
{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}
Parameter | Description |
---|---|
id String(50) (optional) |
Item ID |
price Integer (required) |
Price of the item NOTE: Don’t add decimal |
quantity Integer (required) |
Quantity of the item NOTE: Must be greater than or equal 1 |
name String(50) (required) |
Name of the item |
brand String(50) (optional) |
Brand of the item |
category String(50) (optional) |
Category of the item |
merchant_name String(50) (optional) |
Merchant selling the item |
Customer Details Object
{
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456",
"billing_address": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "081 2233 44-55",
"address": "Sudirman",
"city": "Jakarta",
"postal_code": "12190",
"country_code": "IDN"
},
"shipping_address": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "0 8128-75 7-9338",
"address": "Sudirman",
"city": "Jakarta",
"postal_code": "12190",
"country_code": "IDN"
}
}
Parameter | Description |
---|---|
first_name String(255) (optional) |
|
last_name String(255) (optional) |
|
email String(255) (optional) |
|
phone String(255) (optional) |
|
billing_address Address (optional) |
|
shipping_address Address (optional) |
Address Object
{
"first_name": "TESTER",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "081 2233 44-55",
"address": "Sudirman",
"city": "Jakarta",
"postal_code": "12190",
"country_code": "IDN"
}
Parameter | Description |
---|---|
first_name String(255) (optional) |
|
last_name String(255) (optional) |
|
email String(255) (optional) |
|
phone String(255) (optional) |
|
address String(255) (optional) |
|
country_code String(10) (optional) |
|
postal_code String(10) (optional) |
|
city String(100) (optional) |
Credit Card Object
{
"save_card": true,
"secure": true,
"channel": "migs",
"bank": "maybank",
"installment": {
"required": false,
"terms": {
"bni": [3, 6, 12],
"mandiri": [3, 6, 12],
"cimb": [3],
"bca": [3, 6, 12],
"offline": [6, 12]
}
},
"whitelist_bins": [
"48111111",
"41111111",
"bni"
],
"dynamic_descriptor": {
"merchant_name" : "merchant",
"city_name": "Jakarta",
"country_code": "ID"
}
}
Parameter | Description |
---|---|
secure Boolean (optional) |
Use 3D-Secure authentication when using credit card. Default: false |
bank String (optional) |
Acquiring bank. Options: bca , bni , mandiri , cimb , bri , danamon , maybank , mega |
channel String (optional) |
Acquiring channel. Options: migs |
type String (optional) |
Credit card transaction type. Options: authorize , authorize_capture . Default: “authorize_capture” |
whitelist_bins Array (optional) |
Allowed credit card BIN numbers. The bin value can be either a prefix(upto 8 digits) of card number or the name of a bank, in which case all the cards issued by that bank will be allowed. The supported bank names are bni bca mandiri cimb bri and maybank . Default: allow all cards |
installment.required Boolean (optional) |
Force installment when using credit card. Default: false |
installment.terms Object (optional) |
Available installment terms |
dynamic_descriptor.merchant_name String (optional) |
Merchant name with max length of 25, required if dynamic_descriptor is present on request |
dynamic_descriptor.city_name String (optional) |
Merchant location with max length of 13 |
dynamic_descriptor.country_code String (optional) |
ISO 3166-1 alpha-2 country code |
BCA Virtual Account Object
{
"va_number": "12345678911",
"sub_company_code": "00000",
"free_text": {
"inquiry": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
],
"payment": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
]
}
}
Parameter | Description |
---|---|
va_number String (optional) |
Custom virtual account number. Length should be within 1 to 11. |
sub_company_code String (optional) |
BCA sub company code directed for this transactions. NOTE: Default is 00000 |
free_text FreeText (optional) |
Free Text
Parameter | Description |
---|---|
inquiry Array of FreeTextItem (optional) |
Size should not exceed 10. |
payment Array of FreeTextItem (optional) |
Size should not exceed 10. |
Free Text Item
Parameter | Description |
---|---|
en String (required) |
Size should not exceed 50 chars. |
id String (required) |
Size should not exceed 50 chars. |
Permata Virtual Account Object
{
"va_number": "1234567890",
"recipient_name": "SUDARSONO"
}
Parameter | Description |
---|---|
va_number String (optional) |
Custom virtual account number. Length should be 10. Only supported for b2b transactions. |
recipient_name String (optional) |
Recipient name shown on the on the bank’s payment prompt. It is shown as 20 character uppercase string. Anyting over 20 character will be truncated. NOTE: Default is merchant name |
BNI Virtual Account Object
{
"va_number": "12345678"
}
Parameter | Description |
---|---|
va_number String (optional) |
Custom virtual account number. Length should be within 1 to 8. |
BRI Virtual Account Object
{
"va_number": "12345678"
}
Parameter | Description |
---|---|
va_number String (optional) |
Custom virtual account number. Length should be within 1 to 13. |
Gopay Object
{
"enable_callback": true,
"callback_url": "http://gopay.com"
}
Parameter | Description |
---|---|
enable_callback Boolean (optional) |
Enable redirect back to merchant from GoJek apps. Default: false |
callback_url String (optional) |
Determine where should customer be redirected from GoJek apps. It supports both HTTP and deeplink. Default: same value as finish url |
ShopeePay Object
{
"callback_url": "http://shopeepay.com"
}
Parameter | Description |
---|---|
callback_url String (optional) |
Determine where should customer be redirected from Shopee apps. It supports both HTTP and deeplink. Default: same value as finish url, if it’s also empty, it will be redirected to default payment processed page |
Cstore Object
{
"alfamart_free_text_1" : "qwerty",
"alfamart_free_text_2" : "asdfg",
"alfamart_free_text_3" : "zxcvb"
}
Parameter | Description |
---|---|
alfamart_free_text_1 String(40) (optional) |
First row of printed receipt description |
alfamart_free_text_2 String(40) (optional) |
Second row of printed receipt description |
alfamart_free_text_3 String(40) (optional) |
Third row of printed receipt description |
Callbacks Object
{
"finish": "https://demo.midtrans.com"
}
Parameter | Description |
---|---|
finish String(255) (optional) |
Redirect URL after transaction is successfully paid (Overriden by JS callback). Can also be set via Snap Settings menu in your dashboard. |
Expiry Object
Note: If this parameter is not sent, the default expiry will use expiry setting on snap preferences on merchant dashboard. Furthermore, if only unit
and duration
is given, start_time
will equal the timestamp of the transaction time (when customer charge).
Note: Maximum expiry for the snap token is 7 days. If the expiry sent is more than 7 days after the token is created. The snap token will still expire 7 days after creation.
{
"start_time": "2018-12-13 18:11:08 +0700",
"unit": "minutes",
"duration": 1
}
Parameter | Description |
---|---|
start_time String(255) (optional) |
Timestamp in yyyy-MM-dd HH:mm:ss Z format. If not specified, transaction time will be used as start time (when customer charge) |
duration Integer (required for expiry) |
Expiry duration |
unit String (required for expiry) |
Expiry unit. Options: day , hour , minute (plural term also accepted) |
Response
Response Success
{
"token": "d379aa71-99eb-4dd1-b9bb-eefe813746e9",
"redirect_url": "https://app.sandbox.veritrans.co.id/snap/v2/vtweb/d379aa71-99eb-4dd1-b9bb-eefe813746e9"
}
HTTP status code: 201
Field | Description |
---|---|
token String(36) |
Snap token for opening the Snap popup |
redirect_url String(75) |
URL for redirection |
Response Failed
Authentication Failed
{
"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"
]
}
HTTP status code: 401
Field | Description |
---|---|
error_messages Array |
Error messages |
Validation Error
{
"error_messages": [
"transaction_details.gross_amount is not equal to the sum of item_details"
]
}
HTTP status code: 400
Field | Description |
---|---|
error_messages Array |
Error messages |
Order ID Already Paid and Utilized
{
"error_messages": [
"transaction_details.order_id has been paid and utilized, please use another order ID"
]
}
HTTP status code: 400
Field | Description |
---|---|
error_messages Array |
Error messages |
Internal System Error
{
"error_messages": [
"Sorry, we encountered internal server error. We will fix this soon."
]
}
HTTP status code: 500
Field | Description |
---|---|
error_messages Array |
Error messages |
Frontend Integration
Overview
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript"
src="https://app.sandbox.midtrans.com/snap/snap.js"
data-client-key="<CLIENT-KEY>"></script>
</head>
<body>
<button id="pay-button">Pay!</button>
<script type="text/javascript">
var payButton = document.getElementById('pay-button');
payButton.addEventListener('click', function () {
snap.pay('<SNAP_TOKEN>');
});
</script>
</body>
</html>
Frontend integration goal is to show Snap payment page within your site.
Include snap.js
into your page so snap
module is available. Don’t forget to put your CLIENT-KEY
as value of data-client-key
attribute in snap.js
script tag. You can see your CLIENT-KEY
on Settings - Access Keys.
You can start payment process by calling snap.pay
with SNAP_TOKEN
acquired from backend integration as parameter.
Snap.js location
Production: https://app.midtrans.com/snap/snap.js
Sandbox: https://app.sandbox.midtrans.com/snap/snap.js
Viewport Meta Tag
To ensure that Snap popup modal is displayed correctly on a mobile device, please include the viewport meta tag inside your <head>
element.
The most common implementation is the line of code below:
<meta name="viewport" content="width=device-width, initial-scale=1">
Snap JS
snap
has 3 public functions: pay
, show
& hide
pay(snapToken, options)
Start Snap payment page.
snap.pay('YOUR_SNAP_TOKEN', {
onSuccess: function(result){console.log('success');console.log(result);},
onPending: function(result){console.log('pending');console.log(result);},
onError: function(result){console.log('error');console.log(result);},
onClose: function(){console.log('customer closed the popup without finishing the payment');}
})
Parameter:
Name | Description |
---|---|
snapToken String (required) |
Snap token acquired from backend integration |
enabledPayments Array (optional) |
List of payment types to be displayed. This will filter out enabled payments from backend integration. |
options.onSuccess Function (optional) |
Payment success callback (200 status_code ) |
options.onPending Function (optional) |
Payment pending callback (201 status_code ) |
options.onError Function (optional) |
Payment error callback (4xx or 5xx status_code ) |
options.onClose Function (optional) |
Called if customer has closed the payment popup prematurely without finishing the payment |
options.language String (optional) |
Sets the language. This will override language setting on Merchant Administration Portal. Supported values are en (English) and id (Bahasa Indonesia). Defaults to id |
options.skipOrderSummary Boolean (optional) |
Skips the order summary page if set to true . Set to false by default. |
options.skipCustomerDetails Boolean (optional) |
Make email and phone number optional in CC form if set to true . Set to false by default. |
options.autoCloseDelay Integer (optional) |
Auto closes the last page of indomaret and bank transfer payments after the specified time delay. The time delay is specified in seconds. Setting it to 0 will disable this feature. Defaults to 0 . |
options.showOrderId Boolean (optional) |
Hide order ID if set to false . Set to true by default. |
options.selectedPaymentType String (optional) |
Skips order summary and select payment page to directly select a specific payment type. Supported values are credit_card , cimb_clicks , bca_klikbca , bca_klikpay , bri_epay , telkomsel_cash , echannel , indosat_dompetku , permata_va , other_va , bca_va , bni_va , kioson , indomaret , gci , and danamon_online . |
options.uiMode String (optional) |
Choose the UI mode for GoPay, ShopeePay . Supported values are deeplink , qr , and auto . Set to auto by default. |
options.gopayMode String (optional) |
Choose the UI mode for GoPay . Supported values are deeplink , qr , and auto . Set to auto by default. |
onSuccess
, onPending
, & onError
function accept one parameter which is Transaction Result object.
function ajaxGetToken(transactionData, callback){
var snapToken;
// Request get token to your server & save result to snapToken variable
if(snapToken){
callback(null, snapToken);
} else {
callback(new Error('Failed to fetch snap token'),null);
}
}
payButton.onclick(function(){
snap.show();
ajaxGetToken(transactionData, function(error, snapToken){
if(error){
snap.hide();
} else {
snap.pay(snapToken);
}
});
});
show()
Show snap loading page. Helper function if you want to show instant loading feedback while getting SNAP_TOKEN
using AJAX.
If AJAX success, call snap.pay
to continue payment process. Else, call snap.hide
to end loading page.
hide()
Hide active snap page. Complementary function of snap.show
. Helper function if you want to show instant loading feedback while getting SNAP_TOKEN
using AJAX.
JS Callback
Transaction Result
Success credit card result
{
"status_code":"200",
"status_message":"Success, Credit Card transaction is successful",
"transaction_id":"6d9677da-45a3-40d0-a0f0-8f0b2f860a64",
"masked_card":"481111-1114",
"order_id":"1459499971",
"gross_amount":"10000.00",
"payment_type":"credit_card",
"transaction_time":"2016-04-01 15:39:58",
"transaction_status":"capture",
"fraud_status":"accept",
"approval_code":"100057",
"bank":"bni",
"card_type":"credit"
}
Pending echannel result
{
"status_code":"201",
"status_message":"Transaksi sedang diproses",
"transaction_id":"0ae66c29-e4a6-4e7b-b223-a103564a8d29",
"order_id":"1459500813",
"gross_amount":"10000.00",
"payment_type":"echannel",
"transaction_time":"2016-04-01 15:54:07",
"transaction_status":"pending",
"fraud_status":"accept",
"bill_key":"001689",
"biller_code":"70012",
"pdf_url": "https://app.midtrans.com/snap/v1/transactions/0ae66c29-e4a6-4e7b-b223-a103564a8d29/pdf"
}
Error result
{
"status_code": "406",
"status_message": ["transaction has been processed"]
}
Object representing transaction result passed to Snap callback.
Name | Description |
---|---|
status_code String |
Transaction status code. Possible values: 200 , 201 , 202 , 400 , 404 , 406 , 500 |
status_message String |
Transaction status message |
order_id String |
Merchant’s payment ID |
gross_amount String |
Processed gross amount |
payment_type String |
Payment type paid by customer. Possible values: credit_card , bca_klikpay , bca_klikbca , bri_epay , telkomsel_cash , bank_transfer , echannel , indosat_dompetku , cstore |
transaction_time String |
Timestamp in yyyy-MM-dd hh:mm:ss format |
transaction_status String |
Transaction status. Possible values: capture , settlement , pending , cancel , expired |
fraud_status String |
Fraud status. Possible values: accept , challenge , deny |
approval_code String |
Bank approval code |
masked_card String |
Customer’s masked card (only in credit_card ) |
bank String |
Acquiring Bank |
permata_va_number String |
Permata VA Number (only in bank_transfer ) |
bill_key String |
Customer bill key (only in echannel ) |
biller_code String |
Customer biller code (only in echannel ) |
redirect_url String |
Where customer should be redirected (only in bca_klikbca ) |
saved_token_id String |
TWO_CLICKS_TOKEN value. Only available in credit_card payment type |
saved_token_id_expired_at String |
Specifies the expiration time of the TWO_CLICKS_TOKEN |
card_type String |
Type of card used. Possible values: credit , debit |
pdf_url String |
Link to show the payment instructions. Used for most asynchronous payment channels. |
Window Redirection
There is an alternative technique to load snap UI page instead of calling snap.js, this method called window redirection. Merchants can utilize the response value in redirect_url
from the Create Snap Token request. Merchants don’t have to load snap.js in their page, as the user is redirected to a page that is hosted by Midtrans.
With this redirection merchant can load snap page in full window mode view like this:
Supported Payment Channels
Credit Card
Payment by credit or debit card with VISA, MasterCard, JCB, or Amex logo. We support both local and internaltional Banks.
Note: Please also refer to the Two Clicks, One Click, and Pre-Authorization section
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["credit_card"],
"credit_card": {
"save_card": true,
"secure": true,
"channel": "migs",
"bank": "maybank",
"installment": {
"required": false,
"terms": {
"bni": [3, 6, 12],
"mandiri": [3, 6, 12],
"cimb": [3],
"bca": [3, 6, 12],
"offline": [6, 12]
}
},
"whitelist_bins": [
"48111111",
"41111111",
"bni"
],
"dynamic_descriptor": {
"merchant_name" : "merchant",
"city_name": "Jakarta",
"country_code": "ID"
}
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Credit Card payment method. Value: credit_card |
credit_card CreditCard (optional) |
Credit card payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
BCA Virtual Account
BCA Virtual Account is a virtual payment method offered by Bank BCA. Users can pay using their BCA Bank account. Payment can be made trough all of Bank BCA’s channels (KlikBCA, m-BCA, and ATM).
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bca_va"],
"bca_va": {
"va_number": "12345678911",
"sub_company_code": "00000",
"free_text": {
"inquiry": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
],
"payment": [
{
"en": "text in English",
"id": "text in Bahasa Indonesia"
}
]
}
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set BCA Virtual Account payment method. Value: bca_va |
bca_va BCA Virtual Account (optional) |
BCA Virtual Account payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section
Note: Please also refer to the Custom VA Number section
Permata Virtual Account
Permata Virtual Account is a virtual payment method facilitated by Bank Permata. Users can pay using any Indonesian Bank account. Payment can be made trough ATM Bersama, Prima, or Alto ATM networks.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["permata_va"],
"permata_va": {
"va_number": "1234567890",
"recipient_name": "SUDARSONO"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Permata Virtual Account payment method. Value: permata_va |
permata_va Permata Virtual Account (optional) |
Permata Virtual Account payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Note: Please also refer to the Custom VA Number section
BNI Virtual Account
BNI Virtual Account is a virtual payment method facilitated by Bank BNI. Users can pay using any Indonesian Bank account. Payment can be made trough ATM Bersama, Prima, or Alto ATM networks.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bni_va"],
"bni_va": {
"va_number": "12345678"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set BNI Virtual Account payment method. Value: bni_va |
bni_va BNI Virtual Account (optional) |
BNI Virtual Account payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Note: Please also refer to the Custom VA Number section
BRI Virtual Account
BRI Virtual Account is a virtual payment method facilitated by Bank BRI. Users can pay using any Indonesian Bank account. Payment can be made through BRI ATM, mobile banking, internet banking, and other Indonesian Bank ATM.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bri_va"],
"bri_va": {
"va_number": "12345678"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set BRI Virtual Account payment method. Value: bri_va |
bri_va BRI Virtual Account (optional) |
BRI Virtual Account payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Note: Please also refer to the Custom VA Number section
Mandiri Bill
Mandiri Bill is a virtual payment method offered by Bank Mandiri. Users can pay using their Mandiri bank account. Payment can be made trough all of Bank Mandiri’s channels (Internet Banking, SMS Banking & ATM).
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["echannel"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Mandiri Bill payment method. Value: echannel |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
GoPay
GoPay is an e-Wallet payment method by GoJek. Users will pay using the GoJek app.
The user flow varies when using a Web Browser (on a computer) compared to a SmartPhone
Note: This assumes that the value of gopayMode
in snap.js options is auto
.
When users make a purchase using GoPay on a Web Browser(on a computer)
- Users see a QR code on their Web Browser
- Users open the GoJek app on their phone
Users tap the Pay function on the GoJek app
Users point their camera to the QR Code
Users check their payment details on the GoJek app and then tap Pay
The transaction is complete and the users’ GoPay balance is deducted
When users make a purchase on their SmartPhone
- Users are automatically redirected to the GoJek app when making purchases on their SmartPhone
- Users finish the payment on the GoJek app
- The transaction is complete and their GoPay balance is deducted
Note: For a list of failure cases, please refer here
Detailed payment Flow for GoPay on a Desktop PC/Laptop
This is the payment flow if customers process GoPay Payments on a Desktop PC/Laptop.
Detailed Payment Flow for GoPay on a Smartphone
This is the payment flow if customers process GoPay Payments on a smartphone.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["gopay"],
"gopay": {
"enable_callback": true,
"callback_url": "http://gopay.com"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set GoPay payment method. Value: gopay |
gopay Gopay (optional) |
GoPay payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
KlikBCA
Internet banking direct payment method by Bank BCA. User will be redirected to the KlikBCA website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bca_klikbca"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set KlikBCA payment method. Value: bca_klikbca |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
BCA KlikPay
Internet banking direct payment method by Bank BCA. User will be redirected to the BCA KlikPay website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bca_klikpay"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set BCA KlikPay payment method. Value: bca_klikpay |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
CIMB Clicks
Internet banking direct payment method by Bank CIMB. User will be redirected to the CIMB Clicks website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["cimb_clicks"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set CIMB Clicks payment method. Value: cimb_clicks |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Danamon Online Banking
Internet banking direct payment method by Bank Danamon. User will be redirected to the Danamon Online Banking website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["danamon_online"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Danamon Online Banking payment method. Value: danamon_online |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
BRI Epay
Internet banking direct payment method by Bank BRI. User will be redirected to the BRI Epay website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["bri_epay"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set BRI Epay payment method. Value: bri_epay |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Indomaret
Convenience store payment method by Indomaret. User will pay through the Indomaret physical convenience store.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["indomaret"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Indomaret payment method. Value: indomaret |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Alfamart
Convenience store payment method by Alfamart. User will pay through the Alfa group convenience stores: Alfamart, Alfamidi, DAN+DAN, and Lawson (coming soon).
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["alfamart"],
"cstore": {
"alfamart_free_text_1" : "qwerty",
"alfamart_free_text_2" : "asdfg",
"alfamart_free_text_3" : "zxcvb"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Alfamart payment method. Value: alfamart |
cstore Convenience Store (optional) |
Convenience store payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Akulaku
Customer financing by Akulaku. User will be redirected to the Akulaku website for payment.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["akulaku"]
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Shopping item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set Akulaku payment method. Value: akulaku |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
ShopeePay
ShopeePay is an e-Wallet payment method by Shopee. Users will pay using the Shopee app.
The user flow varies when using a Web Browser (on a computer) compared to a SmartPhone
Note: This assumes that the value of uiMode
in snap.js options is auto
.
Note: By default, Shopeepay transaction will expire 15 minutes after the charge was made.
When users make a purchase using ShopeePay on a Web Browser(on a computer)
- Users see a QR code on their Web Browser
- Users open the Shopee app on their phone
Users tap the Scan function on the Shopee app
Users point their camera to the QR Code
Users check their payment details on the Shopee app and then tap Lanjutkan. Then Bayar Sekarang
Waiting until the transaction is complete and the users’ ShopeePay balance is deducted
When users make a purchase on their SmartPhone
- Users are automatically redirected to the Shopee app when making purchases on their SmartPhone
- Users finish the payment on the Shopee app
- The transaction is complete and their ShopeePay balance is deducted
Note: For a list of failure cases, please refer here
Detailed payment Flow for ShopeePay on a Desktop PC/Laptop
This is the payment flow if customers process ShopeePay Payments on a Desktop PC/Laptop.
Detailed Payment Flow for ShopeePay on a Smartphone
This is the payment flow if customers process ShopeePay Payments on a smartphone.
Sample JSON Request Body
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"item_details": [{
"id": "ITEM1",
"price": 10000,
"quantity": 1,
"name": "Midtrans Bear",
"brand": "Midtrans",
"category": "Toys",
"merchant_name": "Midtrans"
}],
"customer_details": {
"first_name": "TEST",
"last_name": "MIDTRANSER",
"email": "test@midtrans.com",
"phone": "+628123456"
},
"enabled_payments": ["shopeepay"],
"shopeepay": {
"callback_url": "http://shopeepay.com"
}
}
Parameter | Description |
---|---|
transaction_details Transaction Details Object (required) |
Unique transaction ID |
item_details Item Details Object (optional) |
Item details will be paid by customer |
customer_details Customer Details Object (optional) |
Details of the customer |
enabled_payments Array (optional) |
Set ShopeePay payment method. Value: shopeepay |
shopeepay ShopeePay (optional) |
ShopeePay payment options |
Note: For a full list of request body parameters please refer to the Request Body (JSON Parameter) section.
Other Features
Two Clicks
1) Request /snap/v1/transactions with credit_card.save_card value set to true
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"credit_card": {
"secure": true,
"save_card": true
}
}
2) Save the
saved_token_id
provided in theOnSuccess
callback or HTTP Notification
snap.pay('YOUR_SNAP_TOKEN', {
onSuccess: function(result) {
if (result.saved_token_id) {
// save customer's TWO_CLICKS_TOKEN in database
}
}
})
3) Request /snap/v1/transactions with credit_card.card_token value set to TWO_CLICKS_TOKEN value saved during initial transaction
{
"transaction_details": {
"order_id": "ORDER-102",
"gross_amount": 10000
},
"credit_card": {
"secure": true,
"card_token": "TWO_CLICKS_TOKEN"
}
}
Two clicks feature allows you to capture customer’s card number,
expiry date, email and phone number as a TWO_CLICKS_TOKEN
. For
successive payments by the same customer the TWO_CLICKS_TOKEN
can
be utilized to pre-fill the details. Customer just needs to fill out
the cvv number to finish the payment.
There are two steps required to utilize two clicks feature:
Initial Transaction
- Create
SNAP_TOKEN
withcredit_card.save_card
value set totrue
- Customer will be presented with save option when they fill out the credit card details
- If customer chooses the save option, then the Transaction Result
will have two extra fields namely
saved_token_id
andsaved_token_id_expired_at
Successive Transactions
- Create
SNAP_TOKEN
withcredit_card.card_token
value set toTWO_CLICKS_TOKEN
saved during the initial transaction - Customer will be presented with pre-filled credit card number, expiry date, email and phone number
One Click
Request SNAP_TOKEN with user_id and credit_card.save_card value set to true
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"credit_card": {
"secure": true,
"save_card": true
},
"user_id": "customer-nR6DCOzqGis"
}
In addition to two clicks feature, Snap also supports one click transaction which will also capture card cvv. With this, customer can directly proceed to charge without input any information.
To ease card saving process, Snap provides card token storage feature. So, merchants don’t have to store and manage credit card token by themselves. Merchants can easily integrate credit card token storage feature to Snap by providing unique user_id
that associate with customer account on merchant’s system, in addition to enabling credit_card.save_card
flag.
Snap will then decide to store credit card token as one click token based on two criteria:
- Merchant has
recurring
MID enabled - Initial transaction is 3DS-enabled
If those two conditions are met, credit card token will be saved as one click token. Otherwise, it will be saved as two clicks token.
Similar to two clicks flow, there are two steps required to utilize credit card token storage feature on Snap:
Initial Transaction
- Create
SNAP_TOKEN
withuser_id
andcredit_card.save_card
set to true user_id
is a unique identifier that represents a customer. Its value can be any string with a maximum length of 255. Avoid using values that could be easily linked to a customer like email, id of records in database etc. Instead use something likesha512(email/record.id + salt)
. Don’t expose theuser_id
to frontends like browser or mobile.- Customer will be presented with save option when they fill out the credit card details
- If customer chooses the save option, Snap will store credit card token and associate it with
user_id
- If you want to enable one click feature, make sure to activate
recurring
MID and setcredit_card.secure
to true. Otherwise, credit card token will be saved as two clicks.
Successive Transaction
- Create
SNAP_TOKEN
with the sameuser_id
as in initial transaction - It’s not neccessary to have
credit_card.save_card
flag set to true on successive transaction - Customer can choose between multiple saved cards if they have saved some cards before
- If selected card was saved as one click token, customer will be presented with pre-filled credit card number, expiry date, cvv, email and phone number. Then, customer can directly proceed to charge (this process will bypass 3DS).
- If selected card was saved as two clicks token, customer will need to enter cvv and going through 3DS process when necessary (same as two clicks flow)
Token Storage
Background
Tokenization is proven to be able to increase the conversion rate and convenience of doing payments. It also appeals to returning customers who pays using credit cards, as they are not required to fill in their card information with each consecutive payment.
This document outlines how merchants can utilize Midtrans’ 2-clicks and one-click functionality on Snap by leveraging the token storage feature. There are two prime scenarios that will be covered in this document:
- First time Checkout: First time users will be asked to register their credit card on Snap and as identifier for the credit card that is registered in Snap, merchant will send parameter/information of
user_id
; and - Returning Checkout: Merchants do not have to save the tokenized card details, simply send the returning user’s
user_id
and we will pre-fill the user’s credit card information based on thatuser_id
.
First Time Checkout
When checking out for the first time, merchant will send a parameter that lets Snap know to allow shoppers to save their credit card details with Midtrans, this is accompanied by the user_id
information as an identifier for token retrieval.
Should the customer choose to save their card information, Midtrans will save the card in the form of a token and return the generated card token on the HTTP post payment notification after the payment is successful. Merchants are not required to store the token, instead storing the user_id
will suffice. This approach enables shoppers to save more than one cards, while merchants only have to store a single user_id
as the identifier.
Page Flow
Get Snap Token
Valid Scenario
To utilise this feature, merchants should provide the save_card
parameter with it’s value set to true
within the credit_card
parameter block. To allow tracking of the user’s token, you should also provide a unique user_id
in the request. This will enable the save card toggle button on the Snap popup for the user to check on later during payment.
{
"transaction_details": {
"gross_amount": 10000,
"order_id": "test-123"
},
"credit_card": {
"secure": true,
"save_card": true
},
"user_id": "customer-01"
}
The response of the above request will be a Snap Token (for pop up method) or a redirection URL (for redirection method):
{
"token": "e5624efe-8095-4aca-8d3a-aadbc824437d",
"redirect_url": "https://app.sandbox.veritrans.co.id/snap/v2/vtweb/e5624efe-8095-4aca-8d3a-aadbc824437d"
}
This will enable the “save card” toggle button on Snap’s UI, as illustrated bellow:
Invalid Scenario
Invalid Scenario 1: Merchant sends request to get redirect URL without option to save card:
{
"transaction_details": {
"gross_amount": 10000,
"order_id": "test-123"
},
"credit_card": {
"secure": true,
"save_card": false
},
"user_id": "customer"
}
Midtrans will respond with a token/redirection URL:
{
"token": "e5624efe-8095-4aca-8d3a-aadbc824437d",
"redirect_url": "https://app.sandbox.veritrans.co.id/snap/v2/vtweb/e5624efe-8095-4aca-8d3a-aadbc824437d"
}
Although the request is successful and the response is valid, there will be no toggle button to save the credit card information on the UI. By default, the save_card
parameter is set to false
.
Invalid Scenario 2: Merchant sends request to get redirect URL with invalid JSON Body:
{
"transaction_details": {
"gross_amount": 10000,
"order_id": "test-123"
},
"credit_card": {
"secure": true,
"save_card": yes
},
"user_id": 001
}
Midtrans will respond with error message:
{
"status_code": "413",
"status_message": "The request cannot be processed due to malformed syntax in the request body",
"id": "56d58264-2127-4cd5-94ec-7407dfcbd61e"
}
Example of HTTP Post Payment Notification
Scenario 1: Customer selects option to save card and transaction was successful (accept by bank and by Fraud engine)
Response from Midtrans:
{
"status_code": "200",
"status_message": "Success, Credit Card 3D Secure transaction is successful",
"transaction_id": "f50c0aef-b629-4a5b-957b-4c52f45e2e63",
"order_id": "A87550",
"payment_type": "credit_card",
"transaction_time": "2014-08-25 11:21:48",
"transaction_status": "capture",
"fraud_status": "accept",
"masked_card": "481111-1114",
"saved_token_id": "4811117d16c884-2cc7-4624-b0a8-10273b7f6cc8",
"saved_token_id_expired_at": "2024-08-25 11:21:48",
"approval_code": "1408940508666",
"gross_amount": "145000.00",
"eci": "05"
}
If the customer chose to save the card information and the transaction was successful, we will send 2 additional parameters in the HTTP notification. This is for informative purpose only, merchants will not need to save these parameters:
saved_token_id
: the actual token that was generated by Midtrans
saved_token_id_expired_at
: Datetime when the token is set to expire (this data refers to the Credit Card’s Expiration Date)
Scenario 2: Customer selects option to save card and transaction failed (denied by bank but accepted by FDS)
If the customer chose to save the card information, but the transaction was unsuccessful (due to decline by banks or by our Fraud Detection System), the card information will not be stored.
Response from Midtrans:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "deny",
"fraud_status": "accept",
"masked_card": "481111-1114",
"status_code": "202",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 3: Customer selects option to save card and transaction failed(accepted by bank but denied by FDS)
Response from Midtrans:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "accept",
"fraud_status": "deny",
"masked_card": "481111-1114",
"status_code": "202",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 4: Customer selects option to save card and transaction is set to challenge(accepted by bank but challenged by FDS)
Response:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "accept",
"fraud_status": "challenge",
"masked_card": "481111-1114",
"status_code": "201",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 5: Customer doesn’t select option to save card and transaction was successful
Response from Midtrans:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17550",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "capture",
"fraud_status": "accept",
"masked_card": "481111-1114",
"status_code": "200",
"bank": "bni",
"status_message": "Success, Credit Card 3D Secure transaction is successful",
"approval_code": "1408869563148",
"eci": "05"
}
If at this point the customer does not chose to save the card information and the transaction was successful, we will send the usual HTTP Post payment notification without the additional params for 2-clicks.
Returning Checkout
For returning checkouts, the merchant will only need to provide the user_id
params and Midtrans will fetch all saved card token details and populate them when shoppers open up the Snap payment page.
Page Flow
For returning checkouts, merchant will send a card token parameter that will enable Snap to preload the card information associated with that particular token, the page flow will be as follow:
Get Snap Token
Valid Scenario Merchant sends charge request to get redirection url with a valid card token:
Add params user_id
and save_card
, basically the param is no different in the first call.
{
"transaction_details": {
"gross_amount": 10000,
"order_id": "test-123"
},
"credit_card": {
"secure": true,
"save_card": true
},
"user_id": "customer"
}
Midtrans will respond with a token and a redirection URL:
{
"token": "d190d83d-4f02-4510-85b9-30dd32aecb4a",
"redirect_url": "https://app.sandbox.veritrans.co.id/snap/v2/vtweb/d190d83d-4f02-4510-85b9-30dd32aecb4a"
}
Snap will pre load all credit card information that is associated with that particular user_id
and merchant_id
.
*Note: The saved credit card information is not shared to other merchants who also uses the Snap platform. The credit card tokens and user_id
are unique by merchant_id
Example of HTTP Post Payment Notification
Scenario 1: Transaction successful(accepted by bank and by Fraud Detection System)
Response:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "capture",
"fraud_status": "accept",
"masked_card": "481111-1114",
"status_code": "200",
"bank": "bni",
"status_message": "Success, Credit Card 3D Secure transaction is successful",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 2: Transaction failed(accepted by Fraud Detection System but denied by bank)
Response:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "deny",
"fraud_status": "accept",
"masked_card": "481111-1114",
"status_code": "202",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 3: Transaction failed(accepted by bank but denied by Fraud Detection System)
Response from Midtrans :
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "accept",
"fraud_status": "deny",
"masked_card": "481111-1114",
"status_code": "202",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Scenario 4: Transaction got challenged(accepted by bank but challenged by Fraud Detection System)
Response:
{
"transaction_id": "1a1a66f7-27a7-4844-ba1f-d86dcc16ab27",
"order_id": "C17551",
"gross_amount": "145000.00",
"payment_type": "credit_card",
"transaction_time": "2014-08-24 15:39:22",
"transaction_status": "accept",
"fraud_status": "challenge",
"masked_card": "481111-1114",
"status_code": "201",
"bank": "bni",
"status_message": "Veritrans payment notification",
"approval_code": "1408869563148",
"eci": "05"
}
Custom Virtual Account Number
bca_va
{
"bca_va": {
"va_number": "55555555555"
}
}
permata_va
{
"permata_va": {
"va_number": "1234567890"
}
}
bni_va
{
"bni_va": {
"va_number": "12345678"
}
}
bri_va
{
"bri_va": {
"va_number": "1234567863214"
}
}
A virtual account number contains two parts. for example, in
{91012}{12435678}
, the first part is the company code and the
second part is a unique code. The second part can be customized for
bca_va, permata_va,
bni_va, and bri_va payment types.
Only digits are allowed.
Different banks have different specs on their custom VA numbers. Please see the documentation on the respective banks.
If the number provided is already utilized for another order, then a different unique number will be used instead.
If the number provided is longer than required, then the unnecessary digits in the end will be trimmed.
If the number provided is shorter than required, then the number will be prefixed with zeros.
Pre-Authorization
Request /snap/v1/transactions with
credit_card.type
value set to “authorize”
{
"credit_card": {
"type": "authorize"
}
}
Pre-authorization feature allows you to check and block customer’s card limit. To use this feature, an additional parameter will be required in credit card object:
Parameter | Description |
---|---|
credit_card.type String (optional) |
Credit card transaction type. Options: authorize , authorize_capture . Default: “authorize_capture” |
Transaction Status
Midtrans provides three means for the merchant to obtain the transaction status.
- Email Notification
- HTTP Notification
- Merchant Administration Portal
Email Notification
You can configure the email notification setting at Settings - Email Notification in MAP.
HTTP(S) POST Notification
Notification through HTTP(S) POST will be sent to the merchant’s server when customer completes the payment process. You can utilize the HTTP(S) POST notification to update a payment status or send the item of a transaction in real time.
Enable Midtrans HTTP(S) POST Notification by setting the Payment Notification URL at Settings - Configuration.
Refer here for sample json notification for different payment channels.
Merchant Admin Portal(MAP) Transaction Status
Merchant can check the transactions status from payments menu on MAP.
Example of a successful transaction status for credit card:
Handling Notifications
Signature key logic
SHA512(order_id + status_code + gross_amount + serverkey)
Sample code generate signature key
<?php
$orderId = "1111";
$statusCode = "200";
$grossAmount = "100000.00";
$serverKey = "askvnoibnosifnboseofinbofinfgbiufglnbfg";
$input = $orderId.$statusCode.$grossAmount.$serverKey;
$signature = openssl_digest($input, 'sha512');
echo "INPUT: " , $input."<br/>";
echo "SIGNATURE: " , $signature;
?>
In order to increase security aspect, there are several ways to ensure notification received from Midtrans.
Challenge Response
An additional mechanism we provide to verify the content and the origin of the notification is to challenge. This can be achieved by calling the get status API. The response is the same as the notification status.
Signature Key
We add signature key information in our notification. The purpose of this signature key is to validate whether the notification is originated from Midtrans or not. Should the notification is not genuine, merchants can disregard the notification. Please find on the side, the logic of the signature key and the sample code to generate signature key.
Best Practice to Handle notification
- Always use an HTTPS endpoint. It is secure and there cannot be MITM attacks because we validate the certificates match the hosts. Also do not use self signed certificates.
- Always implement notification in an idempotent way, in extremely rare cases, we may send multiple notifications for the same transaction event twice. It should not cause double entries in the merchant end, The simple way of achieving this is to use orderid as the key to track the entries.
- Always check the signature hash of the notification, This will confirm that the notification was actually sent by Midtrans, because we encode the shared secret (server key). Nobody else can build this signature hash.
- Always check all the following three fields for confirming success transaction
- status code: Should be 200 for successful transactions
- fraud status: ACCEPT
- transaction status : settlement/capture
- We strive to send the notification immediately after the transaction has occurred, but in extremely rare cases, it may be delayed because of transaction spikes. If you have not received a notification, please use the Status API to check for current status of the transaction.
- It is safe to call Status API to get the latest status of the transaction/order on each notification.
- We set the HTTP timeout to 30 seconds.
Please strive to keep the response time of the the HTTP notifications under 5 seconds. - In extremely rare cases we may send the HTTP notifications out of order, ie. a “settlement” status for a notification before the notification for “Pending” status. It’s important that such later notifications are ignored. Here’s the state transition diagram that you could use. But again, use our /status API to confirm the actual status.
- We send the notification body as JSON, please parse the JSON with a JSON parser. Always expect new fields will be added to the notification body, so parse it in a non strict format, so if the parser sees new fields, it should not throw exception. It should gracefully ignore the new fields. This allows us to extend our notification system for newer use cases without breaking old clients.
- Always use the right HTTP Status code for responding to the notification, we handle retry for error cases differently based on the status code
- for
2xx
: No retries, it is considered success - for
500
: We will retry 1 times in the 1 minute interval - for
503
: Retry 4 times - for
400/404
: retry 2 times in 1 minute interval - for all other failures: Retry 5 times at 1 minute interval
- for
- Redirection
- for
307/308
: The request will be repeated with the new URL using POST method and the same notification body. A maximum of 5 redirection is allowed. - for
301/301/303
: The job will be marked as failed without further retries. The merchant will be notified via email. We suggest either to use307/308
or update the notification endpoint settings in merchant portal.
- for
Following are the standard types of notifications. Note different types of notifications can be added in addition to the below. Also new fields may be added to the existing notification, please confirm with the latest documentation for the exact fields.
Override Notification Url
Merchant can opt to change or add custom notification urls on every transaction. It can be achieved by adding additional HTTP headers into charge request.
There are two headers we provide:
X-Append-Notification
: to add new notification url(s) alongside the settings on dashboardX-Override-Notification
: to use new notification url(s) disregarding the settings on dashboard
Both header can only receive up to maximum of 2 urls.
Sample case
Append Notification Sample
curl -X POST \
https://app.midtrans.com/snap/v1/transactions \
-H 'Accept: application/json' \
-H 'Authorization: Basic NjJiMTVhN2QtZTVmOC00YjNjLTllYWItY2E4MjdjYTM3ZjU1Og==' \
-H 'Content-Type: application/json' \
-H 'X-Append-Notification: https://example.com/test1,https://example.com/test2' \
-H 'cache-control: no-cache' \
-d '{
"transaction_details": {
"order_id": "1553229166",
"gross_amount": 10000
}
}'
Override Notification Sample
curl -X POST \
https://app.midtrans.com/snap/v1/transactions \
-H 'Accept: application/json' \
-H 'Authorization: Basic NjJiMTVhN2QtZTVmOC00YjNjLTllYWItY2E4MjdjYTM3ZjU1Og==' \
-H 'Content-Type: application/json' \
-H 'X-Override-Notification: https://example.com/test1,https://example.com/test2' \
-H 'cache-control: no-cache' \
-d '{
"transaction_details": {
"order_id": "1553229166",
"gross_amount": 10000
}
}'
Assuming merchant has set https://example.com as their notification url on the dashboard.
If they set X-Append-Notification
with values https://example.com/test1,https://example.com/test2
. Then, every HTTP notification for that specific transaction will be sent to:
- https://example.com,
- https://example.com/test1, and
- https://example.com/test2
Else if they set X-Override-Notification
with values https://example.com/test1,https://example.com/test2
. Then, every HTTP notification for that specific transaction will be sent to:
- https://example.com/test1 and
- https://example.com/test2
Status Code
Goal: Understand all status codes used by API. For more inquiries, please contact us at support@midtrans.com or visit our support web page.
Status Codes used by Midtrans API are categorized into 2xx, 3xx, 4xx dan 5xx.
Code 2xx
Status | Description |
---|---|
200 | Credit Card: Success . Request is successful, and transaction is successful (authorize, capture, settlement, cancel, get order, approve challenge transactions), accepted by Midtrans and bank. Other payment methods: Success . Transaction is successful/settlement. |
201 | Credit Card: Pending . Transaction is successfully made but the 3D secure process has yet to be completed. Transaction will expire expire within 15 minutes. Challenge . Transaction is successfully sent to bank but the process has not been completed, need manual action from merchant to complete the transaction process. If the merchant does not perform any action until settlement time (H+1 16:00) Midtrans will cancel the transaction. Bank Transfer: Pending . Transaction is successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 24 hours. Cimb Clicks: Pending . Transaction successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 2 hours. BRI ePay: Pending . Transaction successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 2 hours. Klik BCA: Pending . Transaction successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 2 hours. BCA Klikpay: Pending . Transaction successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 2 hours. Mandiri Bill Payment: Pending . Transaction successfully sent to bank but the process has not been completed by the customer. By default the transaction will expire within 2 hours. Indomaret: Pending . Transaction successfully sent to provider but the process has not been completed by the customer. By default the transaction will expire within 2 hours. |
202 | Credit Card: Denied . Transaction has been processed but is denied by payment provider or Midtrans’ fraud detection system. Other payment methods: Denied . Transaction has been processed but is denied by payment provider. |
Code 3xx
Status | Description |
---|---|
300 | Move Permanently, current and all future requests should be directed to the new URL |
Code 4xx
Status | Description |
---|---|
400 | Validation Error, merchant sends bad request data example; validation error, invalid transaction type, invalid credit card format, etc. |
401 | Access denied due to unauthorized transaction, please check client key or server key |
402 | Merchant doesn’t have access for this payment type |
403 | The requested resource is only capable of generating content not acceptable according to the accepting headers that sent in the request |
404 | The requested resource is not found |
405 | HTTP method is not allowed |
406 | Duplicate order ID. Order ID has already been utilized previously |
407 | Expired transaction |
408 | Merchant sends the wrong data type |
409 | Merchant has sent too many transactions for the same card number |
410 | Merchant account is deactivated. Please contact Midtrans support |
411 | Token id is missing, invalid, or timed out |
412 | Merchant cannot modify status of the transaction |
413 | The request cannot be processed due to malformed syntax in the request body |
Code 5xx
Status | Description |
---|---|
500 | Internal Server Error |
501 | The feature has not finished yet, it will be available soon |
502 | Internal Server Error: Bank Connection Problem |
503 | Internal Server Error |
504 | Internal Server Error: Fraud detection is unavailable |
Testing Credentials
Here is a list of dummy transaction credentials that can be used for transaction in the Sandbox Environment.
Credit Card
Please refer to Testing Card.
Bank Transfer
Payment Methods | Description |
---|---|
Permata Virtual Account | Midtrans will generate a dummy 16 digits Permata Virtual Account Number. To perform a test transaction, use the Permata Virtual Account Simulator |
BCA Virtual Account | Midtrans will generate a dummy 11 digits BCA Virtual Account Number. To perform a test transaction, use the BCA Virtual Account Simulator |
Mandiri Bill Payment | Midtrans will generate a dummy 12 digits Bill Key to complete payment via Mandiri e-channel (Internet Banking, SMS Banking, Mandiri ATM). To perform a test transaction, use Mandiri Bill Payment Simulator |
BNI Virtual Account | Midtrans will generate a dummy BNI Virtual Account Number. To perform a test transaction, use the BNI Virtual Account Simulator |
BRI Virtual Account | Midtrans will generate a dummy BRI Virtual Account Number. To perform a test transaction, use the BRI Virtual Account Simulator |
Direct Debit
Payment Methods | Description |
---|---|
CIMB Clicks | Midtrans will redirect CIMB Clicks test transaction to a payment simulator. Success Transaction: testuser00 Failure Transaction: testuser01 |
ePay BRI | Midtrans will redirect ePay BRI test transaction to a payment simulator. Success Transaction: testuser00 Failure Transaction: testuser03 |
BCA Klikpay | Midtrans will redirect BCA Klikpay test transaction to a payment simulator. |
KlikBCA | Midtrans will register user id filled in KlikBCA input. To perform a test transaction, use the KlikBca Simulator |
e-Wallet
Payment Methods | Description |
---|---|
Telkomsel Cash | Accept Customer: 0811111111 Deny Customer: 0822222222 |
Indosat Dompetku | Accept number: 08123456789 Deny number: other than 08123456789 |
Mandiri E-cash | Accept number: 0987654321 PIN: 12345 OTP: 12123434 |
Convenience Store
Payment Methods | Description |
---|---|
Indomaret | Midtrans will generate a dummy Indomaret Payment Code. To perform a test transaction, use the Indomaret Simulator |
Kioson | Midtrans will generate a dummy Kioson Payment Code. To perform a test transaction, use the Kioson Simulator |
Going Live
The tutorial below will assist you in changing the configuration from Sandbox to Production. Please choose the following integration method. If further assistance is required, please contact us at support@midtrans.com or visit our support page.
If you have completed integrating in Sandbox (Testing Environment) and ready to go live in Production Environment, there are a few steps that need to be made:
- Contact Midtrans Support to migrate from Sandbox to Production Environment. Once confirmed, you can now login to Midtrans Production Dashboard at https://account.midtrans.com/login with the current credentials.
- Change
setting environment
in Midtrans plugin from development into production. Here are the list of our lib and plugin setting environment.
Minimum Transaction Amount
Each transaction requires a minimum gross_amount
of 10000.
PHP
<?php
include_once('Veritrans.php');
// Set our production server key
Veritrans_Config::$serverKey = '<your production server key>';
// Use production account
Veritrans_Config:$isProduction = true;
...
?>
Set Veritrans-PHP library to Production Environment. This can be done by changing the value Veritrans_Config::$serverKey
with production server key and Veritrans_Config::$isProduction
into true
.
Magento
Set magento plugin settings with production client key and server key and change environment to production.
v1.9.x
v2.x.x
OpenCart
Set Midtrans’ OpenCart plugin settings with production client key and server key and change environment to production.
Prestashop
Set Midtrans’ Prestashop plugin environment settings to production, input your production client key, and production server key.
Woocommerce
Set Midtrans’ Woocommerce plugin environment settings to production, input your production client key, and production server key.