mercury

package
v1.36.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mercury provides types and utilities for integrating with the Mercury bank API and webhook events.

Index

Constants

View Source
const BaseURL = "https://backend.mercury.com/api/v1"

BaseURL is the Mercury API base URL.

Variables

This section is empty.

Functions

func VerifySignature

func VerifySignature(payload []byte, signature string, secret string) bool

VerifySignature verifies a Mercury webhook signature. Mercury signs payloads with HMAC-SHA256 using the webhook secret.

Types

type Transaction

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"
}

Transaction represents a Mercury transaction from a webhook or API response.

type WebhookPayload

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"`
}

WebhookPayload is the Mercury webhook event structure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL