Skip to Content
API ReferenceTransactionsIn-Person PaymentsPost auth

Post Auth

ENDPOINT
POST
https://open.sunbay.us/v1/semi-integration/transaction/post-auth

The Post-Authorization API is used to complete a pre-authorization transaction and officially deduct the pre-authorized funds. After calling this API, the post-authorization request will be pushed to the specified payment terminal, and the API returns immediately, indicating that the request has been successfully dispatched (does not mean the transaction is complete). Terminal processing (usually no customer action required). Transaction results are obtained through asynchronous notification or active query.

Parameters

Header parameters

NameTypeRequiredDescription
Authorization
stringYes
Bearer Token authentication, format: Bearer {your_api_key}
Example: "Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"
Content-Type
stringYes
Request content type, fixed value: application/json
X-Client-Request-Id
string(64)Yes
Request unique identifier, used to prevent duplicate requests and issue tracking. UUID format is recommended, each request must use a unique Request ID
Example: "550e8400-e29b-41d4-a716-446655440000"
X-Timestamp
stringYes
Request timestamp, Unix timestamp (milliseconds), 13 digits. The deviation between the request timestamp and server time cannot exceed ±10 minutes
Pattern: ^[0-9]{13}$
Example: "1701234567890"

Body parameters

NameTypeRequiredDescription
appId
string(32)Yes
Application ID, the unique identifier of the integrated application created through the SUNBAY Connect developer platform
Example: "smkrjobsk3sifh90"
merchantId
string(11-11)Yes
SUNBAY platform merchant unique identifier, created via the SUNBAY Copilot portal. Format: 11-character alphanumeric string starting with M.
⚠ Note: This is not the MID assigned by a payment processor
Pattern: ^M[A-Za-z0-9]{10}$
Example: "M1261833002"
originalTransactionId
string(64)No
SUNBAY Nexus transaction ID of the original pre-authorization transaction to be completed, choose one between this and originalTransactionRequestId. When both exist, originalTransactionId takes priority
Example: "TXN20231119001"
originalTransactionRequestId
string(32)No
Transaction request ID of the original pre-authorization transaction to be completed, choose one between this and originalTransactionId. When both exist, originalTransactionId takes priority
Example: "PAY_REQ_20231119002"
transactionRequestId
string(32)Yes
Transaction request ID. Client-generated unique identifier for API idempotency control. Must be unique per request.
Pattern: ^[A-Za-z0-9_\-]+$
Example: "PAY_REQ_20231119005"
amount
objectYes
description
string(128)Yes
Product description, need to pass a description that truly represents the product information, may be displayed on the bill page of some payment apps
Example: "Post authorization"
terminalSn
string(32)Yes
Payment terminal serial number. SUNBAY provided payment terminal device serial number, this device is used for reading bank cards, processing PIN and other security operations
Example: "T1234567890"
attach
string(128)No
Additional data, returned as is, JSON format recommended
Example: "{\"checkoutTime\":\"2023-11-19T12:00:00+08:00\"}"
notifyUrl
string(200)No
Asynchronous notification URL. Receives Transaction Result Webhook notifications.
Format: uri
Example: "https://merchant.com/notify"
terminalEventNotifyUrl
string(200)No
URL to receive terminal event notifications. Events are pushed only when pushToTerminal=true (transaction dispatched to the terminal). See Subscribe to Terminal Events.
Format: uri
Example: "https://merchant.com/terminal-events"
tipConfig
objectNo
Tip configuration. When amount.tipAmount is not provided, the payment terminal will display a tip collection interface based on this configuration; when amount.tipAmount is provided, it indicates the tip was collected on the POS side and the terminal will not participate in the tip collection flow
printReceipt
stringNo
Receipt printing option
Possible values:
  • NONE- Do not print receipt
  • MERCHANT- Print merchant copy only
  • CUSTOMER- Print customer copy only
  • BOTH- Print both merchant and customer copies
  • AUTO- Auto mode. The receipt printing behavior is automatically determined by the Tapro application
Default: "AUTO"
Example: "MERCHANT"
pushToTerminal
booleanNo
Whether to push the transaction request to the payment terminal for processing. When true, the transaction request is pushed to the specified terminal device; when false, the transaction is processed directly in the cloud
Default: true
Example: true

Request Example

{
  "appId": "smkrjobsk3sifh90",
  "merchantId": "M1261833002",
  "originalTransactionId": "TXN20231119001",
  "originalTransactionRequestId": "AUTHREQ20231119001",
  "transactionRequestId": "PAY_REQ_20231119005",
  "amount": {
    "orderAmount": 10000,
    "priceCurrency": "USD",
    "tipAmount": null
  },
  "description": "Post authorization",
  "terminalSn": "T1234567890",
  "attach": "{\"checkoutTime\":\"2023-11-19T12:00:00+08:00\"}",
  "notifyUrl": "https://merchant.com/notify",
  "tipConfig": {
    "useHostConfig": false,
    "onScreenTip": true,
    "tipMode": "ON_SALE",
    "tipWithTax": false,
    "suggestions": {
      "names": [
        "Recommended low tip",
        "Recommended medium tip",
        "Recommended high tip"
      ],
      "feeMode": "RATE",
      "values": [
        15,
        18,
        20
      ]
    }
  }
}

Code Examples

cURLbash

Response parameters

NameTypeRequiredDescription
code
string(16)Y
Response code, 0 indicates request has been successfully dispatched to terminal
Example: "0"
msg
string(128)N
Response description
Example: "Post authorization request sent"
traceId
string(64)Y
Trace ID for troubleshooting
Example: "TRACE123456789"
data
objectY
Last updated on