Security & Architecture

📘

BI-SNAP Compliance

This page describes how Midtrans implements the BI-SNAP technical standard for API architecture, data formats, HTTP methods, and URI path standardization. It serves as reference material for both developers integrating with the BI-SNAP Core API and for compliance/audit purposes.


API Architecture



Architecture Type

The BI-SNAP Core API uses a RESTful architecture over HTTPS, aligning with the ASPI standard requirement (Tipe Arsitektur API = REST). All communication between merchants and Midtrans occurs over encrypted TLS channels using standard HTTP request/response patterns with JSON payloads.


System Components & Roles

The BI-SNAP integration involves three primary roles:

RoleDescription
Merchant (Client)Initiates API calls to create payments, check status, request refunds, and manage account linking. The merchant's backend authenticates using signed requests.
Midtrans (PJP / Payment Service Provider)Acts as the authorization server (issuing access tokens) and the resource server (processing payment transactions). Midtrans validates signatures, routes transactions, and sends notifications.
Payment Network / Acquiring BankUnderlying payment infrastructure (GoPay, bank networks, QRIS acquirers) that processes the actual fund transfer. Abstracted from the merchant by Midtrans.

Separation of Concerns

The API is organized into distinct functional groups, each with its own security scope:

API GroupPurposeSecurity Scope
Access Token APIAuthentication — issue B2B access tokens using OAuth 2.0 client_credentials grantAsymmetric signature (SHA256withRSA) with merchant private key
Transactional APIsPayment creation, refund, cancel, status inquirySymmetric signature (HMAC_SHA512) with client secret + Bearer access token
Notification CallbacksMidtrans pushes payment status updates to merchant endpointsAsymmetric signature verification using Midtrans public key
Reporting APIsTransaction history queriesBearer access token + symmetric signature

Architecture Diagram

┌──────────────┐         HTTPS/TLS 1.2+         ┌──────────────────┐
│              │  ────── Access Token API ──────► │                  │
│   Merchant   │  ────── Transactional APIs ───► │     Midtrans     │
│   (Client)   │  ◄───── HTTP Notifications ──── │   (PJP Server)   │
│              │  ────── Reporting APIs ────────► │                  │
└──────────────┘                                  └────────┬─────────┘
                                                           │
                                                  ┌────────▼─────────┐
                                                  │  Payment Network │
                                                  │  (GoPay, Banks,  │
                                                  │   QRIS, etc.)    │
                                                  └──────────────────┘



Data Format & Character Encoding



All BI-SNAP Core API request and response bodies use JSON (JavaScript Object Notation) format with UTF-8 character encoding, in line with the BI-SNAP technical standard.

AspectStandard
Data formatJSON (Content-Type: application/json)
Character encodingUTF-8
Timestamp formatISO-8601 (YYYY-MM-DDTHH:MM:SS±HH:MM), using Western Indonesian Time (GMT+7)
Numeric valuesTransmitted as strings where specified by BI-SNAP (e.g., amount.value as "10000.00")
Boolean valuesJSON native true/false

For detailed JSON object specifications per payment method, refer to:




HTTP Methods



The BI-SNAP Core API uses a limited, well-defined set of HTTP methods. Each method is used consistently across the API according to its semantic meaning:

HTTP MethodUsageBI-SNAP Endpoints
POSTCreate resources, initiate actions (token generation, payment creation, refunds, cancellations, notifications)Access Token, Charge/Payment, Refund, Cancel, Notification
GETRetrieve resource state without side effects (status inquiry, auth code retrieval)Get Transaction Status, Get Auth Code

Endpoint Summary by HTTP Method


POST Endpoints

PathOperationSNAP Service Code
/{version}/access-token/b2bGenerate B2B Access Token73
/{version}/debit/payment-host-to-hostDirect Debit Payment (GoPay/ShopeePay/DANA)54
/{version}/registration-account-bindingBind Account (GoPay Tokenization)08
/{version}/registration-account-unbindingUnbind Account08
/{version}/debit/refundRefund Transaction58
/{version}/debit/cancelCancel Transaction
/{version}/qr/qr-mpm-generateGenerate QRIS MPM47
/{version}/transfer-va/create-vaCreate Virtual Account (Bank Transfer)27

GET Endpoints

PathOperationSNAP Service Code
/{version}/debit/statusGet Transaction Status55
/{version}/authGet Auth Code (GoPay Tokenization)

📘

Note

All BI-SNAP API calls require HTTPS. Plain HTTP requests are rejected. The minimum TLS version is 1.2. See Security Specification for details.




Standardized URI Path



URI Structure

BI-SNAP Core API endpoints follow a standardized URI pattern aligned with ASPI's specification:

https://{domain_api}/{version}/{service-group}/{operation}
ComponentDescriptionExample
{domain_api}Base domain per environment (see table below)merchants.midtrans.com
{version}API versionv1.0
{service-group}Functional grouping (payment type or function)debit, qr, transfer-va, access-token
{operation}Specific actionpayment-host-to-host, refund, status, create-va

API Base Domains

EnvironmentDomainNotes
Sandboxmerchants.sbx.midtrans.comFor testing. Get Auth Code uses merchants-app.sbx.midtrans.com
Stagingmerchants.stg.midtrans.comFor functional testing with Midtrans. Get Auth Code uses merchants-app.stg.midtrans.com
Productionmerchants.midtrans.comLive environment. Get Auth Code uses merchants-app.midtrans.com

URI Examples

The following examples demonstrate how Midtrans BI-SNAP endpoints map to the ASPI URI standard /{domain_api}/{version}/{service-group}/{operation}:

Full URIDomainVersionService GroupOperation
https://merchants.midtrans.com/v1.0/access-token/b2bmerchants.midtrans.comv1.0access-tokenb2b
https://merchants.midtrans.com/v1.0/debit/payment-host-to-hostmerchants.midtrans.comv1.0debitpayment-host-to-host
https://merchants.midtrans.com/v1.0/qr/qr-mpm-generatemerchants.midtrans.comv1.0qrqr-mpm-generate
https://merchants.midtrans.com/v1.0/transfer-va/create-vamerchants.midtrans.comv1.0transfer-vacreate-va
https://merchants.midtrans.com/v1.0/debit/statusmerchants.midtrans.comv1.0debitstatus



Related Pages

For further details on specific security and integration topics: