Files
zeekay 1943f1c093 Hanzo Commerce
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans,
usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.

Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
2026-09-23 21:52:16 -07:00

30 lines
1.4 KiB
Go

// Package mercury provides types and utilities for integrating with the
// Mercury bank API and webhook events.
package mercury
// BaseURL is the Mercury API base URL.
const BaseURL = "https://backend.mercury.com/api/v1"
// Transaction represents a Mercury transaction from a webhook or API response.
type Transaction struct {
ID string `json:"id"`
Amount float64 `json:"amount"`
Status string `json:"status"`
Kind string `json:"kind"` // "externalTransfer", "internalTransfer", etc.
Method string `json:"method,omitempty"` // "wire", "ach", "check", etc.
CounterpartyName string `json:"counterpartyName,omitempty"`
Note string `json:"note,omitempty"`
ExternalMemo string `json:"externalMemo,omitempty"`
CreatedAt string `json:"createdAt"`
AccountID string `json:"accountId,omitempty"`
Direction string `json:"direction,omitempty"` // "credit" or "debit"
}
// WebhookPayload is the Mercury webhook event structure.
type WebhookPayload struct {
EventType string `json:"eventType"` // "transaction.created", "transaction.updated"
ResourceID string `json:"resourceId"` // transaction ID
MergePatch interface{} `json:"mergePatch,omitempty"` // JSON Merge Patch for updates
Data Transaction `json:"data,omitempty"`
}