Billing Webhooks
Midtrans Snap checkout, voucher validation, and settlement notifications.
POST /api/billing/midtrans/snap
Creates a workspace order and returns Snap token/redirect URL.
// request
{
"planCode": "growth_6m",
"voucherCode": "KOMENIN10"
}
// response
{
"orderId": "clx...",
"orderCode": "KMN-1710000000-123",
"token": "snap-token-or-sim-token",
"redirectUrl": "https://app.sandbox.midtrans.com/snap/v2/vtweb/...",
"totalIdr": 2154600,
"discountIdr": 239400,
"subtotalIdr": 2394000,
"clientKey": "SB-Mid-client-xxx",
"isSimulation": false
}POST /api/billing/midtrans/notification
Midtrans server-to-server notification. Signature is verified when MIDTRANS_SERVER_KEY is set.
// request
{
"order_id": "KMN-1710000000-123",
"status_code": "200",
"gross_amount": "2154600.00",
"signature_key": "<sha512>",
"transaction_status": "settlement",
"transaction_id": "midtrans-trx-id",
"payment_type": "qris"
}
// response
{
"ok": true,
"result": {
"ok": true,
"orderId": "clx...",
"subscriptionId": "clx..."
}
}POST /api/billing/voucher/validate
Validates a voucher for the selected plan before checkout.
// request
{ "code": "KOMENIN10", "planCode": "growth_6m" }
// response
{
"voucherId": "clx...",
"code": "KOMENIN10",
"type": "percent",
"value": 10,
"discountIdr": 239400,
"totalIdr": 2154600
}Need the product UI? Open command center