MineSec Pay 7
API Reference
Data Model

These models come from the MineSec POS client library (poslib). The name value of each request is what the Local PayServer reads from the JSON body, and what App2App sends as mhd_extra_trans_type.

RequestnameApp2AppLocal PayServer
WarmUpWARM_UPYesGET /api/v1/warmup
ActivationACTIVATIONYesPOST /api/v1/activation
EnquiryDeviceStatusENQUIRY_STATUSYesGET /api/v1/status
ReloadConfigurationRELOAD_CONFIGSYesGET /api/v1/reload
CancelCANCELNoGET /api/v1/cancel
Transaction.SaleSALEYesPOST /api/v1/trans
Transaction.AuthAUTHYesPOST /api/v1/trans
Transaction.AuthCompletionAUTH_COMPYesPOST /api/v1/trans
Transaction.IncrementalAuthINCREMENTAL_AUTHNoPOST /api/v1/trans
Transaction.VoidVOIDYesPOST /api/v1/trans
Transaction.RefundREFUNDYesPOST /api/v1/trans
EnquiryTranStatusENQUIRY_TRANSACTION_STATUSYesGET /api/v1/trans/{tranId}
EnquiryTranStatusWithMessageIdENQUIRY_TRANSACTION_STATUS_WITH_MESSAGE_IDYesNo
SettlementSETTLEMENTYesPOST /api/v1/settlement
EnquiryBTStatusENQUIRY_BLUETOOTH_CONNECT_STATUSNoNo

POS Request model

sealed class PosRequest(
  val name: String,
) : Serializable {
 
  /**
   * Warm Up command will warm init MineSec Pay 7 to make it ready for payment.
   * You can send a warm-up command when your business application is doing configuration OR it is
   * under preparing for the coming transaction.
   */
  object WarmUp : PosRequest("WARM_UP"), Serializable
 
  /**
   * Cancel the operation in progress, for example a sale waiting for the card.
   * Local PayServer only (GET /api/v1/cancel). Not supported over App2App.
   */
  object Cancel : PosRequest("CANCEL"), Serializable
 
  /**
   * Activation Command: MineSec Pay 7 has to be activated before any other API calling.
   * This command triggers application to do activation by using the activation code
   * @param activationCode the activation code get from MineSec backend
   */
  data class Activation(val activationCode: String) : PosRequest("ACTIVATION"), Serializable
 
  /**
   * Enquiry the device status by sending this command.
   */
  object EnquiryDeviceStatus : PosRequest("ENQUIRY_STATUS"), Serializable
 
  /**
   * Force the device to do full reconfiguration by sending this command. The reconfiguration command
   * will force application to reload EMV profiles as well as crypto keys.
   */
  object ReloadConfiguration : PosRequest("RELOAD_CONFIGS"), Serializable
 
  /**
   * Not supported by MineSec Pay 7. Kept in poslib for compatibility; do not send it.
   */
  object EnquiryBTStatus : PosRequest("ENQUIRY_BLUETOOTH_CONNECT_STATUS"), Serializable
 
  // Transaction Command
  sealed class Transaction(name: String) : PosRequest(name) {
 
    // Sale Operation
    data class Sale(
      // transaction amount. it's a BigDecimal way. e.g. BigDecimal("1.0").
      // currency is automatically configured in backend.
      val amount: BigDecimal,
 
      // Description that will be added into payment record / receipt.
      val description: String? = null,
 
      // Unique ID that is generated by business Application. it could be used for payment record query/search.
      val posMessageId: String? = null,
 
      // SoftPOS will be disappeared automatically immediately after payment action done if this item is set to true
      val autoDismissResult: Boolean = true,
      // For QR payment,QR_GUEST_SCAN or QR_MERCHANT_SCAN, defaulted as CARD
      val preferredInstrument: PreferredInstrument? = null,
      // Optional,in QR guest scan mode, if no QR payment method is specified, MineSec Pay 7 will display a list of supported QR payment methods for the user to select from
      val qrPaymentMethods: QRPaymentMethods? = null
    ) : Transaction("SALE"), Serializable
 
    /**
     * Authorization
     */
    data class Auth(
      // transaction amount. it's a BigDecimal way. e.g. BigDecimal("1.0").
      // currency is automatically configured in backend.
      val amount: BigDecimal,
 
      // Description that will be added into payment record / receipt.
      val description: String? = null,
 
      // Unique ID that is generated by business Application. it could be used for payment record query/search.
      val posMessageId: String? = null,
 
      // SoftPOS will be disappeared automatically immediately after payment action done if this item is set to true
      val autoDismissResult: Boolean = false,
    ) : Transaction("AUTH"), Serializable
 
    /**
     * Authorization completion: captures a previous pre-authorization (AUTH).
     */
    data class AuthCompletion(
      // transaction ID of the original pre-authorization
      val orgTranId: String,
 
      // amount to capture. it's a BigDecimal way. e.g. BigDecimal("1.0").
      val amount: BigDecimal,
 
      // Unique ID that is generated by business Application.
      val posMessageId: String? = null,
    ) : Transaction("AUTH_COMP"), Serializable
 
    /**
     * Incremental authorization: increases the amount of a previous pre-authorization (AUTH).
     * Local PayServer only (POST /api/v1/trans). Not supported over App2App.
     */
    data class IncrementalAuth(
      // transaction ID of the original pre-authorization
      val orgTranId: String,
 
      // amount to add. it's a BigDecimal way. e.g. BigDecimal("1.0").
      val amount: BigDecimal,
 
      // Unique ID that is generated by business Application.
      val posMessageId: String? = null,
    ) : Transaction("INCREMENTAL_AUTH"), Serializable
 
    // Void
    data class Void(
      // original transaction Id
      val orgTranId: String,
 
      // Unique ID that is generated by business Application.
      // it could be used for payment action(or record) query/search.
      val posMessageId: String? = null,
 
      // void password.
      val adminPwd: String,
    ) : Transaction("VOID"), Serializable
 
    // Refund without card-present
    data class Refund(
      // original transaction Id
      val orgTranId: String,
 
      // Unique ID that is generated by business Application.
      // it could be used for payment action(or record) query/search.
      val posMessageId: String? = null,
 
      // void password.
      val adminPwd: String,
    ) : Transaction("REFUND"), Serializable
  }
 
  // transaction status query
  data class EnquiryTranStatus(
    // transaction id
    val orgTranId: String,
  ) : PosRequest("ENQUIRY_TRANSACTION_STATUS"), Serializable
 
  /**
   * Transaction status query by the posMessageId your app sent with the transaction.
   * App2App only. The Local PayServer can only query by transaction ID.
   */
  data class EnquiryTranStatusWithMessageId(
    // posMessageId of the original transaction
    val posMessageId: String
  ) : PosRequest("ENQUIRY_TRANSACTION_STATUS_WITH_MESSAGE_ID"), Serializable
 
 
  // settlement
  data class Settlement(
    // Unique ID that is generated by business Application.
    // it could be used for payment action(or record) query/search.
    val posMessageId: String? = null,
  ) : PosRequest("SETTLEMENT"), Serializable
 
}

POS Response Model

 
// App-to-app call response
sealed class PosResponse<T>(
  // error code when calling fails
  val rspCode: String,
  // error message when calling fails
  val rspMsg: String,
) : Serializable {
  // success object when calling is success. the data element represents a valid object returned by application.
  class Success<T>(val data: T, rspCode: String, rspMsg: String) : PosResponse<T>(rspCode, rspMsg), Serializable
 
  // failed calling. rspCode & rspMsg details the reason of failing
  class Failed<Unit>(rspCode: String, rspMsg: String, val tranId: String? = null) : PosResponse<Unit>(rspCode, rspMsg), Serializable
}
 
// Successful transaction response
data class TransactionResponse(
  // transaction ID unique per transaction. generated by MineSec Backend.
  val tranId: String,
 
  // trace ID. unique per transaction. generated by MineSec Backend.
  val trace: String,
 
  // RRN. unique per transaction. generated by payment host
  val rrn: String,
 
  // transaction type: SALE/AUTH/AUTH_COMP/INCREMENTAL_AUTH/VOID/REFUND
  val tranType: String,
  // transaction status: Approved/Declined/Voided/Refunded/Pending/Timeout/Cancelled
  val tranStatus: String,
  // card present approval auth code.
  val approvalCode: String,
  // payment Method: Visa/Mastercard/etc..
  val paymentMethod: String,
  // generic transaction card returned data. null for QR payments
  val cardData: CardData? = null,
 
  // entryMode: NFC. null for QR payments
  val entryMode: String? = null,
  // masked Account: e.g. **** **** **** 1234. null for QR payments
  val maskedAccount: String? = null,
  // CVM method being used. null for QR payments
  val cvmPerformed: String? = null,
  // MID which process this transaction
  val acqMid: String,
  // TID which process this transaction
  val acqTid: String,
  // unique reference ID generated by application.
  val posMessageId: String,
  // merchant address
  val mchAddress: String,
  // merchant name
  val mchName: String,
  // total txn amount
  val totalAmount: BigDecimal,
  // currency of the amount, e.g. HKD
  val currencyText: String? = null,
 
  val createByName: String,
  val createdAt: String,
  val updatedAt: String,
  // ID of the related transaction, when there is one
  val linkedTranId: String? = null,
) : Serializable
 
data class CardData(
  // application AID
  val aid: String,
  // emv app NAME
  val appName: String,
  // TC code
  val tc: String,
  // tsi
  val tsi: String,
  // tvr
  val tvr: String,
) : Serializable
 
// settlement response
data class SettlementResponse(
  // batch No.
  val batches: String,
  //
  val createByName: String,
 
  // unique reference id generated by application.
  val posMessageId: String,
  //val tranStatus: String,
  val createdAt: String,
  val updatedAt: String,
) : Serializable

Local PayServer response body

Over HTTP, every route answers with the same JSON envelope. A success carries data:

{
  "rspCode": "0",
  "rspMsg": "Approved",
  "data": { "tranId": "…", "tranType": "SALE", "tranStatus": "Approved", "…": "…" }
}

A failure carries no data, and carries tranId when the failed request created a transaction:

{
  "rspCode": "-1",
  "rspMsg": "…",
  "tranId": "…"
}
FieldTypeDescription
rspCodeStringResult code. "0" is success. See Response code.
rspMsgStringResult message
dataObject, success onlyTransactionResponse for transactions and enquiries, SettlementResponse for settlement, and an empty object for status, warm-up, reload and cancel
tranIdString, failure onlyTransaction ID of the failed transaction, when there is one

POS Preferred Instrument

 
enum class PreferredInstrument(val value: String) {
    Card("CARD"),
    QR_GUEST_SCAN("QR_GUEST_SCAN"),
    QR_MERCHANT_SCAN("QR_MERCHANT_SCAN")
}

POS QR Payment Methods

 
enum class QRPaymentMethods(val code: String) {
    WECHAT("A1"),
    ALIPAY("A2"),
    EZPAY("A3"),
    VISA_QR("B1"),
    MASTERCARD_QR("B2"),
    UNION_PAY_QR("B3"),
    SHOPEE_PAY("C1"),
    PAY_NOW("C2"),
    LINEPAY("C3"),
    PI("C4"),
    ESUNWALLET("C5"),
    TAIWANPAY("C6"),
    EASYWALLET("C7"),
    GRAB_PAY("C8"),
    GAMA_PAY("C9"),
    ICASH_PAY("C10"),
    IPASSMONEY_PAY("C11"),
    JIEKOU_PAY("C12"),
    OUFUBAO("C13"),
    QUAN_PAY("C14"),
    QUAN_YIN_PAY("C15"),
    XIAOYOU_PAY("C16"),
    ALIPAY_PLUS("C17"),
    DUIT_NOW("C18"),
}