mercury

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

README

Mercury Go API Library

Go Reference

The Mercury Go library provides convenient access to the Mercury REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/MercuryTechnologies/mercury-go" // imported as mercury
)

Or to pin the version:

go get -u 'github.com/MercuryTechnologies/mercury-go@v0.6.3'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/MercuryTechnologies/mercury-go"
	"github.com/MercuryTechnologies/mercury-go/option"
)

func main() {
	client := mercury.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("MERCURY_API_KEY")
		option.WithEnvironmentSandbox(), // defaults to option.WithEnvironmentProduction()
	)
	account, err := client.Accounts.Get(context.TODO(), "REPLACE_ME")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", account.ID)
}

Request fields

The mercury library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, mercury.String(string), mercury.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := mercury.ExampleParams{
	ID:   "id_xxx",              // required property
	Name: mercury.String("..."), // optional property

	Point: mercury.Point{
		X: 0,              // required field will serialize as 0
		Y: mercury.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: mercury.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[mercury.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := mercury.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Accounts.Get(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Customers.ListAutoPaging(context.TODO(), mercury.CustomerListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	customer := iter.Current()
	fmt.Printf("%+v\n", customer)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Customers.List(context.TODO(), mercury.CustomerListParams{})
for page != nil {
	for _, customer := range page.Customers {
		fmt.Printf("%+v\n", customer)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *mercury.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Accounts.Get(context.TODO(), "REPLACE_ME")
if err != nil {
	var apierr *mercury.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/account/{accountId}": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Accounts.Get(
	ctx,
	"REPLACE_ME",
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper mercury.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

// A file from the file system
file, err := os.Open("/path/to/file")
mercury.RecipientAttachmentAttachParams{
	File: file,
}

// A file from a string
mercury.RecipientAttachmentAttachParams{
	File: strings.NewReader("my file contents"),
}

// With a custom filename and contentType
mercury.RecipientAttachmentAttachParams{
	File: mercury.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := mercury.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Accounts.Get(
	context.TODO(),
	"REPLACE_ME",
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
account, err := client.Accounts.Get(
	context.TODO(),
	"REPLACE_ME",
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", account)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: mercury.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := mercury.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (MERCURY_API_KEY, MERCURY_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type Account

type Account struct {
	// ID for a Mercury account.
	ID                string  `json:"id" api:"required" format:"uuid"`
	AccountNumber     string  `json:"accountNumber" api:"required"`
	AvailableBalance  float64 `json:"availableBalance" api:"required"`
	CreatedAt         string  `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	CurrentBalance    float64 `json:"currentBalance" api:"required"`
	DashboardLink     string  `json:"dashboardLink" api:"required"`
	Kind              string  `json:"kind" api:"required"`
	LegalBusinessName string  `json:"legalBusinessName" api:"required"`
	Name              string  `json:"name" api:"required"`
	RoutingNumber     string  `json:"routingNumber" api:"required"`
	// Any of "active", "deleted", "pending", "archived".
	Status AccountStatus `json:"status" api:"required"`
	// Any of "mercury", "external", "recipient".
	Type                   AccountType `json:"type" api:"required"`
	CanReceiveTransactions bool        `json:"canReceiveTransactions" api:"nullable"`
	Nickname               string      `json:"nickname" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccountNumber          respjson.Field
		AvailableBalance       respjson.Field
		CreatedAt              respjson.Field
		CurrentBalance         respjson.Field
		DashboardLink          respjson.Field
		Kind                   respjson.Field
		LegalBusinessName      respjson.Field
		Name                   respjson.Field
		RoutingNumber          respjson.Field
		Status                 respjson.Field
		Type                   respjson.Field
		CanReceiveTransactions respjson.Field
		Nickname               respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Account) RawJSON

func (r Account) RawJSON() string

Returns the unmodified JSON received from the API

func (*Account) UnmarshalJSON

func (r *Account) UnmarshalJSON(data []byte) error

type AccountListParams

type AccountListParams struct {
	// The ID of the account to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the account to start the page after (exclusive). When provided,
	// results will begin with the account immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order AccountListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AccountListParams) URLQuery

func (r AccountListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AccountListParams's query parameters as `url.Values`.

type AccountListParamsOrder

type AccountListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	AccountListParamsOrderAsc  AccountListParamsOrder = "asc"
	AccountListParamsOrderDesc AccountListParamsOrder = "desc"
)

type AccountService

type AccountService struct {
	Options []option.RequestOption
}

Manage bank accounts

AccountService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.

func NewAccountService

func NewAccountService(opts ...option.RequestOption) (r AccountService)

NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountService) Get

func (r *AccountService) Get(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Account, err error)

Get account by ID

func (*AccountService) List

Retrieve a paginated list of accounts. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*AccountService) ListAutoPaging

Retrieve a paginated list of accounts. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

type AccountStatus

type AccountStatus string
const (
	AccountStatusActive   AccountStatus = "active"
	AccountStatusDeleted  AccountStatus = "deleted"
	AccountStatusPending  AccountStatus = "pending"
	AccountStatusArchived AccountStatus = "archived"
)

type AccountType

type AccountType string
const (
	AccountTypeMercury   AccountType = "mercury"
	AccountTypeExternal  AccountType = "external"
	AccountTypeRecipient AccountType = "recipient"
)

type Address

type Address struct {
	Address1   string `json:"address1" api:"required"`
	City       string `json:"city" api:"required"`
	Country    string `json:"country" api:"required"`
	Name       string `json:"name" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	Region     string `json:"region" api:"required"`
	Address2   string `json:"address2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address1    respjson.Field
		City        respjson.Field
		Country     respjson.Field
		Name        respjson.Field
		PostalCode  respjson.Field
		Region      respjson.Field
		Address2    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Address) RawJSON

func (r Address) RawJSON() string

Returns the unmodified JSON received from the API

func (*Address) UnmarshalJSON

func (r *Address) UnmarshalJSON(data []byte) error

type AddressData

type AddressData struct {
	Address1   string `json:"address1" api:"required"`
	City       string `json:"city" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	Address2   string `json:"address2" api:"nullable"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State UsState `json:"state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address1    respjson.Field
		City        respjson.Field
		PostalCode  respjson.Field
		Address2    respjson.Field
		State       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AddressData) RawJSON

func (r AddressData) RawJSON() string

Returns the unmodified JSON received from the API

func (AddressData) ToParam

func (r AddressData) ToParam() AddressDataParam

ToParam converts this AddressData to a AddressDataParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AddressDataParam.Overrides()

func (*AddressData) UnmarshalJSON

func (r *AddressData) UnmarshalJSON(data []byte) error

type AddressDataParam

type AddressDataParam struct {
	Address1   string            `json:"address1" api:"required"`
	City       string            `json:"city" api:"required"`
	PostalCode string            `json:"postalCode" api:"required"`
	Address2   param.Opt[string] `json:"address2,omitzero"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	State UsState `json:"state,omitzero"`
	// contains filtered or unexported fields
}

The properties Address1, City, PostalCode are required.

func (AddressDataParam) MarshalJSON

func (r AddressDataParam) MarshalJSON() (data []byte, err error)

func (*AddressDataParam) UnmarshalJSON

func (r *AddressDataParam) UnmarshalJSON(data []byte) error

type AddressInputParam

type AddressInputParam struct {
	// Primary street address line.
	Address1 string `json:"address1" api:"required"`
	// City name.
	City string `json:"city" api:"required"`
	// Two-letter country code (ISO 3166-1 alpha-2).
	Country string `json:"country" api:"required"`
	// The mailing name of the address.
	Name string `json:"name" api:"required"`
	// Postal or ZIP code.
	PostalCode string `json:"postalCode" api:"required"`
	// Either a two-letter US state code i.e. "CA" for California or a free-form
	// identification of a particular region worldwide.
	Region string `json:"region" api:"required"`
	// Secondary street address line (optional).
	Address2 param.Opt[string] `json:"address2,omitzero"`
	// contains filtered or unexported fields
}

Address input for creating or updating customers

The properties Address1, City, Country, Name, PostalCode, Region are required.

func (AddressInputParam) MarshalJSON

func (r AddressInputParam) MarshalJSON() (data []byte, err error)

func (*AddressInputParam) UnmarshalJSON

func (r *AddressInputParam) UnmarshalJSON(data []byte) error

type AddressWithoutName

type AddressWithoutName struct {
	Address1   string `json:"address1" api:"required"`
	City       string `json:"city" api:"required"`
	Country    string `json:"country" api:"required"`
	PostalCode string `json:"postalCode" api:"required"`
	Region     string `json:"region" api:"required"`
	Address2   string `json:"address2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address1    respjson.Field
		City        respjson.Field
		Country     respjson.Field
		PostalCode  respjson.Field
		Region      respjson.Field
		Address2    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AddressWithoutName) RawJSON

func (r AddressWithoutName) RawJSON() string

Returns the unmodified JSON received from the API

func (AddressWithoutName) ToParam

ToParam converts this AddressWithoutName to a AddressWithoutNameParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AddressWithoutNameParam.Overrides()

func (*AddressWithoutName) UnmarshalJSON

func (r *AddressWithoutName) UnmarshalJSON(data []byte) error

type AddressWithoutNameParam

type AddressWithoutNameParam struct {
	Address1   string            `json:"address1" api:"required"`
	City       string            `json:"city" api:"required"`
	Country    string            `json:"country" api:"required"`
	PostalCode string            `json:"postalCode" api:"required"`
	Region     string            `json:"region" api:"required"`
	Address2   param.Opt[string] `json:"address2,omitzero"`
	// contains filtered or unexported fields
}

The properties Address1, City, Country, PostalCode, Region are required.

func (AddressWithoutNameParam) MarshalJSON

func (r AddressWithoutNameParam) MarshalJSON() (data []byte, err error)

func (*AddressWithoutNameParam) UnmarshalJSON

func (r *AddressWithoutNameParam) UnmarshalJSON(data []byte) error

type Attachment

type Attachment struct {
	// ID for the attachment.
	ID string `json:"id" api:"required" format:"uuid"`
	// The filename for the file.
	FileName string `json:"fileName" api:"required"`
	// The signed download URL for the file itself.
	URL string `json:"url" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		FileName    respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The object representing a file attachment for an invoice. The file is not a part of this object itself but information for where to download it will be in this object.

func (Attachment) RawJSON

func (r Attachment) RawJSON() string

Returns the unmodified JSON received from the API

func (*Attachment) UnmarshalJSON

func (r *Attachment) UnmarshalJSON(data []byte) error

type CardListResponse added in v0.3.3

type CardListResponse struct {
	Cards []CardListResponseCard `json:"cards" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cards       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CardListResponse) RawJSON added in v0.3.3

func (r CardListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CardListResponse) UnmarshalJSON added in v0.3.3

func (r *CardListResponse) UnmarshalJSON(data []byte) error

type CardListResponseCard added in v0.3.3

type CardListResponseCard struct {
	CardID         string `json:"cardId" api:"required"`
	CreatedAt      string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	LastFourDigits string `json:"lastFourDigits" api:"required"`
	NameOnCard     string `json:"nameOnCard" api:"required"`
	// Any of "visa", "mastercard".
	Network string `json:"network" api:"required"`
	// Any of "active", "frozen", "cancelled", "inactive", "expired", "suspended".
	Status string `json:"status" api:"required"`
	// Any of "inactive", "active", "locked".
	PhysicalCardStatus string `json:"physicalCardStatus" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CardID             respjson.Field
		CreatedAt          respjson.Field
		LastFourDigits     respjson.Field
		NameOnCard         respjson.Field
		Network            respjson.Field
		Status             respjson.Field
		PhysicalCardStatus respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CardListResponseCard) RawJSON added in v0.3.3

func (r CardListResponseCard) RawJSON() string

Returns the unmodified JSON received from the API

func (*CardListResponseCard) UnmarshalJSON added in v0.3.3

func (r *CardListResponseCard) UnmarshalJSON(data []byte) error

type CardService added in v0.3.3

type CardService struct {
	Options []option.RequestOption
}

Manage bank accounts

CardService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCardService method instead.

func NewCardService added in v0.3.3

func NewCardService(opts ...option.RequestOption) (r CardService)

NewCardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CardService) List added in v0.3.3

func (r *CardService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *CardListResponse, err error)

Retrieve all debit and credit cards associated with a specific account.

type CategoryData

type CategoryData struct {
	// ID for the category
	ID string `json:"id" api:"required" format:"uuid"`
	// The name of the category
	Name string `json:"name" api:"required"`
	// Whether this category is applicable to card transactions
	VisibleForCardSpend bool `json:"visibleForCardSpend" api:"required"`
	// Whether this category is applicable to all other transaction kinds
	VisibleForOther bool `json:"visibleForOther" api:"required"`
	// Whether this category is applicable to expense reimbursement transactions
	VisibleForReimbursements bool `json:"visibleForReimbursements" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                       respjson.Field
		Name                     respjson.Field
		VisibleForCardSpend      respjson.Field
		VisibleForOther          respjson.Field
		VisibleForReimbursements respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents an expense category for transaction classification.

func (CategoryData) RawJSON

func (r CategoryData) RawJSON() string

Returns the unmodified JSON received from the API

func (*CategoryData) UnmarshalJSON

func (r *CategoryData) UnmarshalJSON(data []byte) error

type CategoryListParams

type CategoryListParams struct {
	// The ID of the category to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the category to start the page after (exclusive). When provided,
	// results will begin with the category immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order CategoryListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CategoryListParams) URLQuery

func (r CategoryListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CategoryListParams's query parameters as `url.Values`.

type CategoryListParamsOrder

type CategoryListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	CategoryListParamsOrderAsc  CategoryListParamsOrder = "asc"
	CategoryListParamsOrderDesc CategoryListParamsOrder = "desc"
)

type CategoryService

type CategoryService struct {
	Options []option.RequestOption
}

Manage expense categories

CategoryService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCategoryService method instead.

func NewCategoryService

func NewCategoryService(opts ...option.RequestOption) (r CategoryService)

NewCategoryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CategoryService) List

Retrieve a paginated list of all available custom expense categories for the organization. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*CategoryService) ListAutoPaging

Retrieve a paginated list of all available custom expense categories for the organization. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

type CheckInfo

type CheckInfo struct {
	Address AddressWithoutName `json:"address" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CheckInfo) RawJSON

func (r CheckInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*CheckInfo) UnmarshalJSON

func (r *CheckInfo) UnmarshalJSON(data []byte) error

type CheckInfoRawParam

type CheckInfoRawParam struct {
	// Mailing address for sending a physical check.
	Address AddressWithoutNameParam `json:"address,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The property Address is required.

func (CheckInfoRawParam) MarshalJSON

func (r CheckInfoRawParam) MarshalJSON() (data []byte, err error)

func (*CheckInfoRawParam) UnmarshalJSON

func (r *CheckInfoRawParam) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options []option.RequestOption
	// Manage customers
	Customers CustomerService
	// Manage invoices
	Invoices InvoiceService
	// Manage bank accounts
	Cards CardService
	// Manage expense categories
	Categories CategoryService
	// Manage credit accounts
	Credit CreditService
	// Manage API events
	Events EventService
	// Organization information
	Org      OrgService
	Payments PaymentService
	// Manage SAFE (Simple Agreement for Future Equity) requests
	Safes SafeService
	// Download account statements
	Statements StatementService
	// Manage treasury accounts and transactions
	Treasury TreasuryService
	// Manage organization team members
	Users UserService
	// Manage webhooks
	Webhooks WebhookService
	// Manage bank accounts
	Accounts AccountService
	// Manage payment recipients
	Recipients RecipientService
	// Manage transactions
	Transactions TransactionService
}

Client creates a struct with services and top level methods that help with interacting with the mercury API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (MERCURY_API_KEY, MERCURY_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CreditListResponse

type CreditListResponse struct {
	Accounts []CreditListResponseAccount `json:"accounts" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accounts    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreditListResponse) RawJSON

func (r CreditListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreditListResponse) UnmarshalJSON

func (r *CreditListResponse) UnmarshalJSON(data []byte) error

type CreditListResponseAccount

type CreditListResponseAccount struct {
	// ID for a Mercury account.
	ID               string  `json:"id" api:"required" format:"uuid"`
	AvailableBalance float64 `json:"availableBalance" api:"required"`
	CreatedAt        string  `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	CurrentBalance   float64 `json:"currentBalance" api:"required"`
	// Any of "active", "deleted", "pending", "archived".
	Status AccountStatus `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		AvailableBalance respjson.Field
		CreatedAt        respjson.Field
		CurrentBalance   respjson.Field
		Status           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreditListResponseAccount) RawJSON

func (r CreditListResponseAccount) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreditListResponseAccount) UnmarshalJSON

func (r *CreditListResponseAccount) UnmarshalJSON(data []byte) error

type CreditService

type CreditService struct {
	Options []option.RequestOption
}

Manage credit accounts

CreditService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCreditService method instead.

func NewCreditService

func NewCreditService(opts ...option.RequestOption) (r CreditService)

NewCreditService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CreditService) List

func (r *CreditService) List(ctx context.Context, opts ...option.RequestOption) (res *CreditListResponse, err error)

Retrieve a list of all credit accounts for the organization.

type CurrencyExchangeInfo

type CurrencyExchangeInfo struct {
	ConvertedFromAmount   float64 `json:"convertedFromAmount" api:"required"`
	ConvertedFromCurrency string  `json:"convertedFromCurrency" api:"required"`
	ConvertedToAmount     float64 `json:"convertedToAmount" api:"required"`
	ConvertedToCurrency   string  `json:"convertedToCurrency" api:"required"`
	// Exchange rate goes from "from currency" to "to currency" (ie from currency \*
	// exchange rate = to currency)
	ExchangeRate  float64 `json:"exchangeRate" api:"required"`
	FeeAmount     float64 `json:"feeAmount" api:"required"`
	FeePercentage float64 `json:"feePercentage" api:"required"`
	// ID for this transaction
	FeeTransactionID string `json:"feeTransactionId" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConvertedFromAmount   respjson.Field
		ConvertedFromCurrency respjson.Field
		ConvertedToAmount     respjson.Field
		ConvertedToCurrency   respjson.Field
		ExchangeRate          respjson.Field
		FeeAmount             respjson.Field
		FeePercentage         respjson.Field
		FeeTransactionID      respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CurrencyExchangeInfo) RawJSON

func (r CurrencyExchangeInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*CurrencyExchangeInfo) UnmarshalJSON

func (r *CurrencyExchangeInfo) UnmarshalJSON(data []byte) error

type Customer

type Customer struct {
	// The customer who will receive the invoice. Use the /api/v1/ar/customers endpoint
	// to list your customers and find the corresponding id, or create a new customer
	// first.
	ID string `json:"id" api:"required" format:"uuid"`
	// Email of customer.
	Email string `json:"email" api:"required"`
	// Name of customer.
	Name string `json:"name" api:"required"`
	// Customer address information for Accounts Receivable API
	Address CustomerAddress `json:"address" api:"nullable"`
	// The time the customer was deleted, if it was deleted.
	DeletedAt string `json:"deletedAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Email       respjson.Field
		Name        respjson.Field
		Address     respjson.Field
		DeletedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response data for Accounts Receivable customer API endpoints

func (Customer) RawJSON

func (r Customer) RawJSON() string

Returns the unmodified JSON received from the API

func (*Customer) UnmarshalJSON

func (r *Customer) UnmarshalJSON(data []byte) error

type CustomerAddress

type CustomerAddress struct {
	// Primary street address line.
	Address1 string `json:"address1" api:"required"`
	// City name.
	City string `json:"city" api:"required"`
	// Two-letter country code (ISO 3166-1 alpha-2).
	Country string `json:"country" api:"required"`
	// Postal or ZIP code
	PostalCode string `json:"postalCode" api:"required"`
	// State, province, or region.
	Region string `json:"region" api:"required"`
	// Secondary street address line (optional).
	Address2 string `json:"address2" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address1    respjson.Field
		City        respjson.Field
		Country     respjson.Field
		PostalCode  respjson.Field
		Region      respjson.Field
		Address2    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Customer address information for Accounts Receivable API

func (CustomerAddress) RawJSON

func (r CustomerAddress) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomerAddress) UnmarshalJSON

func (r *CustomerAddress) UnmarshalJSON(data []byte) error

type CustomerListParams added in v0.3.3

type CustomerListParams struct {
	// The ID of the customer to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the customer to start the page after (exclusive). When provided,
	// results will begin with the customer immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order CustomerListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CustomerListParams) URLQuery added in v0.3.3

func (r CustomerListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CustomerListParams's query parameters as `url.Values`.

type CustomerListParamsOrder added in v0.3.3

type CustomerListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	CustomerListParamsOrderAsc  CustomerListParamsOrder = "asc"
	CustomerListParamsOrderDesc CustomerListParamsOrder = "desc"
)

type CustomerNewParams added in v0.3.3

type CustomerNewParams struct {
	// The email address for the customer.
	Email string `json:"email" api:"required"`
	// The name of the customer.
	Name string `json:"name" api:"required"`
	// Address input for creating or updating customers
	Address AddressInputParam `json:"address,omitzero"`
	// contains filtered or unexported fields
}

func (CustomerNewParams) MarshalJSON added in v0.3.3

func (r CustomerNewParams) MarshalJSON() (data []byte, err error)

func (*CustomerNewParams) UnmarshalJSON added in v0.3.3

func (r *CustomerNewParams) UnmarshalJSON(data []byte) error

type CustomerService added in v0.3.3

type CustomerService struct {
	Options []option.RequestOption
}

Manage customers

CustomerService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerService method instead.

func NewCustomerService added in v0.3.3

func NewCustomerService(opts ...option.RequestOption) (r CustomerService)

NewCustomerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerService) Delete added in v0.3.3

func (r *CustomerService) Delete(ctx context.Context, customerID string, opts ...option.RequestOption) (err error)

Delete a customer. This action cannot be undone.

func (*CustomerService) Get added in v0.3.3

func (r *CustomerService) Get(ctx context.Context, customerID string, opts ...option.RequestOption) (res *Customer, err error)

Retrieve details of a specific customer by their ID

func (*CustomerService) List added in v0.3.3

Retrieve a paginated list of customers. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*CustomerService) ListAutoPaging added in v0.3.3

Retrieve a paginated list of customers. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*CustomerService) New added in v0.3.3

func (r *CustomerService) New(ctx context.Context, body CustomerNewParams, opts ...option.RequestOption) (res *Customer, err error)

Create a new customer for the organization

func (*CustomerService) Update added in v0.3.3

func (r *CustomerService) Update(ctx context.Context, customerID string, body CustomerUpdateParams, opts ...option.RequestOption) (res *Customer, err error)

Update an existing customer

type CustomerUpdateParams added in v0.3.3

type CustomerUpdateParams struct {
	// The email address for the customer.
	Email string `json:"email" api:"required"`
	// The name of the customer.
	Name string `json:"name" api:"required"`
	// Open invoices for the customer will be resent with updated data when this is
	// true.
	ResendOpenInvoices bool `json:"resendOpenInvoices" api:"required"`
	// Address input for creating or updating customers
	Address AddressInputParam `json:"address,omitzero"`
	// contains filtered or unexported fields
}

func (CustomerUpdateParams) MarshalJSON added in v0.3.3

func (r CustomerUpdateParams) MarshalJSON() (data []byte, err error)

func (*CustomerUpdateParams) UnmarshalJSON added in v0.3.3

func (r *CustomerUpdateParams) UnmarshalJSON(data []byte) error

type DomesticWireRoutingInfo

type DomesticWireRoutingInfo struct {
	AccountNumber string             `json:"accountNumber" api:"required"`
	RoutingNumber string             `json:"routingNumber" api:"required"`
	Address       AddressWithoutName `json:"address" api:"nullable"`
	BankName      string             `json:"bankName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountNumber respjson.Field
		RoutingNumber respjson.Field
		Address       respjson.Field
		BankName      respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DomesticWireRoutingInfo) RawJSON

func (r DomesticWireRoutingInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*DomesticWireRoutingInfo) UnmarshalJSON

func (r *DomesticWireRoutingInfo) UnmarshalJSON(data []byte) error

type DomesticWireRoutingInfoRawParam

type DomesticWireRoutingInfoRawParam struct {
	// The account number of the bank account to use for domestic wire payments.
	AccountNumber string `json:"accountNumber" api:"required"`
	// The address of the bank account to use for domestic wire payments. This has to
	// be the recipient's legal address.
	Address AddressWithoutNameParam `json:"address,omitzero" api:"required"`
	// The routing number of the bank account to use for domestic wire payments.
	RoutingNumber string `json:"routingNumber" api:"required"`
	// The name of the beneficiary of the domestic wire. This is the name of the entity
	// that will receive the domestic wire.
	DefaultForBenefitOf param.Opt[string] `json:"defaultForBenefitOf,omitzero"`
	// contains filtered or unexported fields
}

The properties AccountNumber, Address, RoutingNumber are required.

func (DomesticWireRoutingInfoRawParam) MarshalJSON

func (r DomesticWireRoutingInfoRawParam) MarshalJSON() (data []byte, err error)

func (*DomesticWireRoutingInfoRawParam) UnmarshalJSON

func (r *DomesticWireRoutingInfoRawParam) UnmarshalJSON(data []byte) error

type ElectronicAccountType

type ElectronicAccountType string
const (
	ElectronicAccountTypeBusinessChecking ElectronicAccountType = "businessChecking"
	ElectronicAccountTypeBusinessSavings  ElectronicAccountType = "businessSavings"
	ElectronicAccountTypePersonalChecking ElectronicAccountType = "personalChecking"
	ElectronicAccountTypePersonalSavings  ElectronicAccountType = "personalSavings"
)

type ElectronicRoutingInfo

type ElectronicRoutingInfo struct {
	AccountNumber string `json:"accountNumber" api:"required"`
	// Any of "businessChecking", "businessSavings", "personalChecking",
	// "personalSavings".
	ElectronicAccountType ElectronicAccountType `json:"electronicAccountType" api:"required"`
	RoutingNumber         string                `json:"routingNumber" api:"required"`
	Address               AddressWithoutName    `json:"address" api:"nullable"`
	BankName              string                `json:"bankName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountNumber         respjson.Field
		ElectronicAccountType respjson.Field
		RoutingNumber         respjson.Field
		Address               respjson.Field
		BankName              respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ElectronicRoutingInfo) RawJSON

func (r ElectronicRoutingInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*ElectronicRoutingInfo) UnmarshalJSON

func (r *ElectronicRoutingInfo) UnmarshalJSON(data []byte) error

type ElectronicRoutingInfoRawParam

type ElectronicRoutingInfoRawParam struct {
	// The account number of the bank account to use for ACH payments.
	AccountNumber string `json:"accountNumber" api:"required"`
	// The address of the bank account to use for ACH payments. This has to be the
	// recipient's legal address.
	Address AddressWithoutNameParam `json:"address,omitzero" api:"required"`
	// The type of bank account to use for ACH payments.
	//
	// Any of "businessChecking", "businessSavings", "personalChecking",
	// "personalSavings".
	ElectronicAccountType ElectronicAccountType `json:"electronicAccountType,omitzero" api:"required"`
	// The routing number of the bank account to use for ACH payments.
	RoutingNumber string `json:"routingNumber" api:"required"`
	// contains filtered or unexported fields
}

The properties AccountNumber, Address, ElectronicAccountType, RoutingNumber are required.

func (ElectronicRoutingInfoRawParam) MarshalJSON

func (r ElectronicRoutingInfoRawParam) MarshalJSON() (data []byte, err error)

func (*ElectronicRoutingInfoRawParam) UnmarshalJSON

func (r *ElectronicRoutingInfoRawParam) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type Event

type Event struct {
	// ID for the API event
	ID string `json:"id" api:"required" format:"uuid"`
	// List of JSON paths that were modified in this event
	ChangedPaths []string `json:"changedPaths" api:"required"`
	// JSON object containing the fields that were changed and their new values
	MergePatch any `json:"mergePatch" api:"required"`
	// Timestamp when the event occurred
	OccurredAt string `json:"occurredAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// The type of operation performed (e.g., create, update, delete)
	//
	// Any of "create", "update", "delete".
	OperationType EventOperationType `json:"operationType" api:"required"`
	// The ID of the resource that was affected
	ResourceID string `json:"resourceId" api:"required" format:"uuid"`
	// The type of resource that was affected (e.g., transaction, account)
	//
	// Any of "transaction", "checkingAccount", "savingsAccount", "treasuryAccount",
	// "investmentAccount", "creditAccount".
	ResourceType EventResourceType `json:"resourceType" api:"required"`
	// Version number of the resource after this change
	ResourceVersion int64 `json:"resourceVersion" api:"required"`
	// JSON object containing the fields that were changed and their previous values
	// before the update
	PreviousValues any `json:"previousValues" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		ChangedPaths    respjson.Field
		MergePatch      respjson.Field
		OccurredAt      respjson.Field
		OperationType   respjson.Field
		ResourceID      respjson.Field
		ResourceType    respjson.Field
		ResourceVersion respjson.Field
		PreviousValues  respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a single event in the Mercury API event stream. | Events track changes to resources over time, providing an audit trail | of all modifications with before/after values and metadata about what changed.

func (Event) RawJSON

func (r Event) RawJSON() string

Returns the unmodified JSON received from the API

func (*Event) UnmarshalJSON

func (r *Event) UnmarshalJSON(data []byte) error

type EventListParams

type EventListParams struct {
	// The ID of the event to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit      param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	ResourceID param.Opt[string] `query:"resourceId,omitzero" format:"uuid" json:"-"`
	// The ID of the event to start the page after (exclusive). When provided, results
	// will begin with the event immediately following this ID. Use this for standard
	// forward pagination to get the next page of results. Cannot be combined with
	// end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order EventListParamsOrder `query:"order,omitzero" json:"-"`
	// Any of "transaction", "checkingAccount", "savingsAccount", "treasuryAccount",
	// "investmentAccount", "creditAccount".
	ResourceType EventListParamsResourceType `query:"resourceType,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EventListParams) URLQuery

func (r EventListParams) URLQuery() (v url.Values, err error)

URLQuery serializes EventListParams's query parameters as `url.Values`.

type EventListParamsOrder

type EventListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	EventListParamsOrderAsc  EventListParamsOrder = "asc"
	EventListParamsOrderDesc EventListParamsOrder = "desc"
)

type EventListParamsResourceType

type EventListParamsResourceType string
const (
	EventListParamsResourceTypeTransaction       EventListParamsResourceType = "transaction"
	EventListParamsResourceTypeCheckingAccount   EventListParamsResourceType = "checkingAccount"
	EventListParamsResourceTypeSavingsAccount    EventListParamsResourceType = "savingsAccount"
	EventListParamsResourceTypeTreasuryAccount   EventListParamsResourceType = "treasuryAccount"
	EventListParamsResourceTypeInvestmentAccount EventListParamsResourceType = "investmentAccount"
	EventListParamsResourceTypeCreditAccount     EventListParamsResourceType = "creditAccount"
)

type EventOperationType

type EventOperationType string

The type of operation performed (e.g., create, update, delete)

const (
	EventOperationTypeCreate EventOperationType = "create"
	EventOperationTypeUpdate EventOperationType = "update"
	EventOperationTypeDelete EventOperationType = "delete"
)

type EventResourceType

type EventResourceType string

The type of resource that was affected (e.g., transaction, account)

const (
	EventResourceTypeTransaction       EventResourceType = "transaction"
	EventResourceTypeCheckingAccount   EventResourceType = "checkingAccount"
	EventResourceTypeSavingsAccount    EventResourceType = "savingsAccount"
	EventResourceTypeTreasuryAccount   EventResourceType = "treasuryAccount"
	EventResourceTypeInvestmentAccount EventResourceType = "investmentAccount"
	EventResourceTypeCreditAccount     EventResourceType = "creditAccount"
)

type EventService

type EventService struct {
	Options []option.RequestOption
}

Manage API events

EventService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) Get

func (r *EventService) Get(ctx context.Context, eventID string, opts ...option.RequestOption) (res *Event, err error)

Get event by ID

func (*EventService) List

Get all events

func (*EventService) ListAutoPaging

Get all events

type GlAllocation

type GlAllocation struct {
	// The amount allocated to this GL code
	Amount float64 `json:"amount" api:"required"`
	// The name of the GL code from the connected accounting integration
	GlCodeName string `json:"glCodeName" api:"required"`
	// Optional user-provided description for this allocation
	Description string `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		GlCodeName  respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A GL code allocation on a transaction — a GL code name paired with the amount allocated to it. When a transaction is fully categorized, the amounts across all allocations sum to the transaction total.

func (GlAllocation) RawJSON

func (r GlAllocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*GlAllocation) UnmarshalJSON

func (r *GlAllocation) UnmarshalJSON(data []byte) error

type InternationalWireRoutingInfo

type InternationalWireRoutingInfo struct {
	CountrySpecific   InternationalWireRoutingInfoCountrySpecific   `json:"countrySpecific" api:"required"`
	Iban              string                                        `json:"iban" api:"required"`
	SwiftCode         string                                        `json:"swiftCode" api:"required"`
	Address           AddressWithoutName                            `json:"address" api:"nullable"`
	BankDetails       InternationalWireRoutingInfoBankDetails       `json:"bankDetails" api:"nullable"`
	CorrespondentInfo InternationalWireRoutingInfoCorrespondentInfo `json:"correspondentInfo" api:"nullable"`
	EmailAddress      string                                        `json:"emailAddress" api:"nullable"`
	PhoneNumber       string                                        `json:"phoneNumber" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CountrySpecific   respjson.Field
		Iban              respjson.Field
		SwiftCode         respjson.Field
		Address           respjson.Field
		BankDetails       respjson.Field
		CorrespondentInfo respjson.Field
		EmailAddress      respjson.Field
		PhoneNumber       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfo) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfo) UnmarshalJSON

func (r *InternationalWireRoutingInfo) UnmarshalJSON(data []byte) error

type InternationalWireRoutingInfoBankDetails

type InternationalWireRoutingInfoBankDetails struct {
	BankCityState string `json:"bankCityState" api:"required"`
	BankCountry   string `json:"bankCountry" api:"required"`
	BankName      string `json:"bankName" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BankCityState respjson.Field
		BankCountry   respjson.Field
		BankName      respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoBankDetails) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoBankDetails) UnmarshalJSON

func (r *InternationalWireRoutingInfoBankDetails) UnmarshalJSON(data []byte) error

type InternationalWireRoutingInfoCorrespondentInfo

type InternationalWireRoutingInfoCorrespondentInfo struct {
	BankName      string `json:"bankName" api:"nullable"`
	RoutingNumber string `json:"routingNumber" api:"nullable"`
	SwiftCode     string `json:"swiftCode" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BankName      respjson.Field
		RoutingNumber respjson.Field
		SwiftCode     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCorrespondentInfo) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCorrespondentInfo) UnmarshalJSON

func (r *InternationalWireRoutingInfoCorrespondentInfo) UnmarshalJSON(data []byte) error

type InternationalWireRoutingInfoCountrySpecific

type InternationalWireRoutingInfoCountrySpecific struct {
	Australia         InternationalWireRoutingInfoCountrySpecificAustralia         `json:"australia" api:"nullable"`
	Brazil            InternationalWireRoutingInfoCountrySpecificBrazil            `json:"brazil" api:"nullable"`
	Canada            InternationalWireRoutingInfoCountrySpecificCanada            `json:"canada" api:"nullable"`
	Chile             InternationalWireRoutingInfoCountrySpecificChile             `json:"chile" api:"nullable"`
	Colombia          InternationalWireRoutingInfoCountrySpecificColombia          `json:"colombia" api:"nullable"`
	DominicanRepublic InternationalWireRoutingInfoCountrySpecificDominicanRepublic `json:"dominicanRepublic" api:"nullable"`
	Honduras          InternationalWireRoutingInfoCountrySpecificHonduras          `json:"honduras" api:"nullable"`
	India             InternationalWireRoutingInfoCountrySpecificIndia             `json:"india" api:"nullable"`
	Kazakhstan        InternationalWireRoutingInfoCountrySpecificKazakhstan        `json:"kazakhstan" api:"nullable"`
	Pakistan          InternationalWireRoutingInfoCountrySpecificPakistan          `json:"pakistan" api:"nullable"`
	Paraguay          InternationalWireRoutingInfoCountrySpecificParaguay          `json:"paraguay" api:"nullable"`
	Philippines       InternationalWireRoutingInfoCountrySpecificPhilippines       `json:"philippines" api:"nullable"`
	Russia            InternationalWireRoutingInfoCountrySpecificRussia            `json:"russia" api:"nullable"`
	SouthAfrica       InternationalWireRoutingInfoCountrySpecificSouthAfrica       `json:"southAfrica" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Australia         respjson.Field
		Brazil            respjson.Field
		Canada            respjson.Field
		Chile             respjson.Field
		Colombia          respjson.Field
		DominicanRepublic respjson.Field
		Honduras          respjson.Field
		India             respjson.Field
		Kazakhstan        respjson.Field
		Pakistan          respjson.Field
		Paraguay          respjson.Field
		Philippines       respjson.Field
		Russia            respjson.Field
		SouthAfrica       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecific) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecific) UnmarshalJSON

func (r *InternationalWireRoutingInfoCountrySpecific) UnmarshalJSON(data []byte) error

type InternationalWireRoutingInfoCountrySpecificAustralia

type InternationalWireRoutingInfoCountrySpecificAustralia struct {
	BsbCode string `json:"bsbCode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BsbCode     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificAustralia) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificAustralia) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificBrazil

type InternationalWireRoutingInfoCountrySpecificBrazil struct {
	LegalID string `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificBrazil) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificBrazil) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificCanada

type InternationalWireRoutingInfoCountrySpecificCanada struct {
	BankCode      string `json:"bankCode" api:"required"`
	TransitNumber string `json:"transitNumber" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BankCode      respjson.Field
		TransitNumber respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificCanada) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificCanada) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificChile

type InternationalWireRoutingInfoCountrySpecificChile struct {
	LegalID string `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificChile) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificChile) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificColombia

type InternationalWireRoutingInfoCountrySpecificColombia struct {
	LegalID string `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificColombia) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificColombia) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificDominicanRepublic

type InternationalWireRoutingInfoCountrySpecificDominicanRepublic struct {
	// Any of "checking", "savings".
	AccountType SwiftBankAccountType `json:"accountType" api:"required"`
	LegalID     string               `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountType respjson.Field
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificDominicanRepublic) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificDominicanRepublic) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificHonduras

type InternationalWireRoutingInfoCountrySpecificHonduras struct {
	// Any of "checking", "savings".
	AccountType SwiftBankAccountType `json:"accountType" api:"required"`
	LegalID     string               `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountType respjson.Field
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificHonduras) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificHonduras) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificIndia

type InternationalWireRoutingInfoCountrySpecificIndia struct {
	IfscCode string `json:"ifscCode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IfscCode    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificIndia) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificIndia) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificKazakhstan

type InternationalWireRoutingInfoCountrySpecificKazakhstan struct {
	LegalID string `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificKazakhstan) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificKazakhstan) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificPakistan

type InternationalWireRoutingInfoCountrySpecificPakistan struct {
	LegalID string `json:"legalId" api:"required"`
	// Any of "CNIC", "SNIC", "Passport", "NTN".
	LegalIDType string `json:"legalIdType" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		LegalIDType respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificPakistan) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificPakistan) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificParaguay

type InternationalWireRoutingInfoCountrySpecificParaguay struct {
	LegalID string `json:"legalId" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificParaguay) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificParaguay) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificPhilippines

type InternationalWireRoutingInfoCountrySpecificPhilippines struct {
	RoutingNumber string `json:"routingNumber" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RoutingNumber respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificPhilippines) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificPhilippines) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificRussia

type InternationalWireRoutingInfoCountrySpecificRussia struct {
	Inn string `json:"inn" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Inn         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificRussia) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificRussia) UnmarshalJSON

type InternationalWireRoutingInfoCountrySpecificSouthAfrica

type InternationalWireRoutingInfoCountrySpecificSouthAfrica struct {
	BranchCode string `json:"branchCode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BranchCode  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InternationalWireRoutingInfoCountrySpecificSouthAfrica) RawJSON

Returns the unmodified JSON received from the API

func (*InternationalWireRoutingInfoCountrySpecificSouthAfrica) UnmarshalJSON

type Invoice

type Invoice struct {
	// ID for the invoice.
	ID string `json:"id" api:"required" format:"uuid"`
	// Whether or not the invoice can be paid via ach debit.
	ACHDebitEnabled bool `json:"achDebitEnabled" api:"required"`
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// Emails to be CCed on invoice notifications/reminders.
	CcEmails []string `json:"ccEmails" api:"required"`
	// The timestamp when the invoice was created.
	CreatedAt string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Whether or not the invoice can be paid via credit card. Requires stripe to be
	// setup for the Mercury account.
	CreditCardEnabled bool `json:"creditCardEnabled" api:"required"`
	// The customer who will receive the invoice. Use the /api/v1/ar/customers endpoint
	// to list your customers and find the corresponding id, or create a new customer
	// first.
	CustomerID string `json:"customerId" api:"required" format:"uuid"`
	// ID for a Mercury account.
	DestinationAccountID string `json:"destinationAccountId" api:"required" format:"uuid"`
	// The due date the invoice should be paid by.
	DueDate time.Time `json:"dueDate" api:"required" format:"date"`
	// The date of the invoice, set by the invoice creator and likely to be context
	// specific to the type of transaction. i.e. it could be a date a service was
	// performed, it does not need to be the date the invoice was created.
	InvoiceDate time.Time `json:"invoiceDate" api:"required" format:"date"`
	// The payer facing invoice number/identifier.
	InvoiceNumber string `json:"invoiceNumber" api:"required"`
	// The line items for the invoice.
	LineItems []LineItemData `json:"lineItems" api:"required"`
	// Public slug for an invoice. Used to construct the pay page URL as well as the
	// URL to retrieve the PDF of the invoice.
	Slug string `json:"slug" api:"required"`
	// The status of the invoice.
	//
	// Any of "Unpaid", "Paid", "Cancelled", "Processing".
	Status PaymentLinkStatus `json:"status" api:"required"`
	// The timestamp when the invoice was updated.
	UpdatedAt string `json:"updatedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Whether or not the invoice payment instructions will show the real account and
	// routing number for the destination account or use virtual account numbers
	// instead.
	UseRealAccountNumber bool `json:"useRealAccountNumber" api:"required"`
	// The time when the invoice was canceled.
	CanceledAt string `json:"canceledAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Internal note for the invoice, visible by users in the mercury organization but
	// not visible to payers.
	InternalNote string `json:"internalNote" api:"nullable"`
	// Memo for the payer of the invoice.
	PayerMemo string `json:"payerMemo" api:"nullable"`
	// Purchase order number for the invoice if applicable.
	PoNumber string `json:"poNumber" api:"nullable"`
	// The end date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodEndDate time.Time `json:"servicePeriodEndDate" api:"nullable" format:"date"`
	// The start date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodStartDate time.Time `json:"servicePeriodStartDate" api:"nullable" format:"date"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		ACHDebitEnabled        respjson.Field
		Amount                 respjson.Field
		CcEmails               respjson.Field
		CreatedAt              respjson.Field
		CreditCardEnabled      respjson.Field
		CustomerID             respjson.Field
		DestinationAccountID   respjson.Field
		DueDate                respjson.Field
		InvoiceDate            respjson.Field
		InvoiceNumber          respjson.Field
		LineItems              respjson.Field
		Slug                   respjson.Field
		Status                 respjson.Field
		UpdatedAt              respjson.Field
		UseRealAccountNumber   respjson.Field
		CanceledAt             respjson.Field
		InternalNote           respjson.Field
		PayerMemo              respjson.Field
		PoNumber               respjson.Field
		ServicePeriodEndDate   respjson.Field
		ServicePeriodStartDate respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response type for an invoice in the api.

func (Invoice) RawJSON

func (r Invoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*Invoice) UnmarshalJSON

func (r *Invoice) UnmarshalJSON(data []byte) error

type InvoiceAttachmentListResponse added in v0.4.1

type InvoiceAttachmentListResponse struct {
	// The list of attachments
	Attachments []Attachment `json:"attachments" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Attachments respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response type for fetching attachments related to an AR Invoice.

func (InvoiceAttachmentListResponse) RawJSON added in v0.4.1

Returns the unmodified JSON received from the API

func (*InvoiceAttachmentListResponse) UnmarshalJSON added in v0.4.1

func (r *InvoiceAttachmentListResponse) UnmarshalJSON(data []byte) error

type InvoiceAttachmentService added in v0.4.1

type InvoiceAttachmentService struct {
	Options []option.RequestOption
}

Manage invoices

InvoiceAttachmentService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInvoiceAttachmentService method instead.

func NewInvoiceAttachmentService added in v0.4.1

func NewInvoiceAttachmentService(opts ...option.RequestOption) (r InvoiceAttachmentService)

NewInvoiceAttachmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InvoiceAttachmentService) Get added in v0.4.1

func (r *InvoiceAttachmentService) Get(ctx context.Context, attachmentID string, opts ...option.RequestOption) (res *Attachment, err error)

Retrieve attachment details including download URL

func (*InvoiceAttachmentService) List added in v0.4.1

Retrieve a list of all attachments for a specific invoice

type InvoiceListParams added in v0.3.3

type InvoiceListParams struct {
	// The ID of the invoice to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the invoice to start the page after (exclusive). When provided,
	// results will begin with the invoice immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order InvoiceListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InvoiceListParams) URLQuery added in v0.3.3

func (r InvoiceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes InvoiceListParams's query parameters as `url.Values`.

type InvoiceListParamsOrder added in v0.3.3

type InvoiceListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	InvoiceListParamsOrderAsc  InvoiceListParamsOrder = "asc"
	InvoiceListParamsOrderDesc InvoiceListParamsOrder = "desc"
)

type InvoiceListResponse added in v0.3.3

type InvoiceListResponse struct {
	// ID for the invoice.
	ID string `json:"id" api:"required" format:"uuid"`
	// Whether or not the invoice can be paid via ach debit.
	ACHDebitEnabled bool `json:"achDebitEnabled" api:"required"`
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// Emails to be CCed on invoice notifications/reminders.
	CcEmails []string `json:"ccEmails" api:"required"`
	// The timestamp when the invoice was created.
	CreatedAt string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Whether or not the invoice can be paid via credit card. Requires stripe to be
	// setup for the Mercury account.
	CreditCardEnabled bool `json:"creditCardEnabled" api:"required"`
	// The customer who will receive the invoice. Use the /api/v1/ar/customers endpoint
	// to list your customers and find the corresponding id, or create a new customer
	// first.
	CustomerID string `json:"customerId" api:"required" format:"uuid"`
	// ID for a Mercury account.
	DestinationAccountID string `json:"destinationAccountId" api:"required" format:"uuid"`
	// The due date the invoice should be paid by.
	DueDate time.Time `json:"dueDate" api:"required" format:"date"`
	// The date of the invoice, set by the invoice creator and likely to be context
	// specific to the type of transaction. i.e. it could be a date a service was
	// performed, it does not need to be the date the invoice was created.
	InvoiceDate time.Time `json:"invoiceDate" api:"required" format:"date"`
	// The payer facing invoice number/identifier.
	InvoiceNumber string `json:"invoiceNumber" api:"required"`
	// A unique identifier used to build public URLs for this invoice. Use it to
	// construct the payment page URL (https://app.mercury.com/pay/{slug}) or fetch the
	// invoice PDF via /api/v1/ar/invoices/{slug}/pdf.
	Slug string `json:"slug" api:"required"`
	// The status of the invoice.
	//
	// Any of "Unpaid", "Paid", "Cancelled", "Processing".
	Status PaymentLinkStatus `json:"status" api:"required"`
	// The timestamp when the invoice was updated.
	UpdatedAt string `json:"updatedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Whether or not the invoice payment instructions will show the real account and
	// routing number for the destination account or use virtual account numbers
	// instead.
	UseRealAccountNumber bool `json:"useRealAccountNumber" api:"required"`
	// The time when the invoice was canceled.
	CanceledAt string `json:"canceledAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Internal note for the invoice, visible by users in the mercury organization but
	// not visible to payers.
	InternalNote string `json:"internalNote" api:"nullable"`
	// Memo for the payer of the invoice.
	PayerMemo string `json:"payerMemo" api:"nullable"`
	// Purchase order number for the invoice if applicable.
	PoNumber string `json:"poNumber" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		ACHDebitEnabled      respjson.Field
		Amount               respjson.Field
		CcEmails             respjson.Field
		CreatedAt            respjson.Field
		CreditCardEnabled    respjson.Field
		CustomerID           respjson.Field
		DestinationAccountID respjson.Field
		DueDate              respjson.Field
		InvoiceDate          respjson.Field
		InvoiceNumber        respjson.Field
		Slug                 respjson.Field
		Status               respjson.Field
		UpdatedAt            respjson.Field
		UseRealAccountNumber respjson.Field
		CanceledAt           respjson.Field
		InternalNote         respjson.Field
		PayerMemo            respjson.Field
		PoNumber             respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response data for Accounts Receivable invoices API Endpoint

func (InvoiceListResponse) RawJSON added in v0.3.3

func (r InvoiceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceListResponse) UnmarshalJSON added in v0.3.3

func (r *InvoiceListResponse) UnmarshalJSON(data []byte) error

type InvoiceNewParams added in v0.3.3

type InvoiceNewParams struct {
	// Whether or not the invoice can be paid via ACH debit.
	ACHDebitEnabled bool `json:"achDebitEnabled" api:"required"`
	// Emails to be CCed on invoice notifications/reminders.
	CcEmails []string `json:"ccEmails,omitzero" api:"required"`
	// Whether or not the invoice can be paid via credit card. Requires Stripe to be
	// setup for the Mercury account.
	CreditCardEnabled bool `json:"creditCardEnabled" api:"required"`
	// The customer who will receive the invoice. Use the /api/v1/ar/customers endpoint
	// to list your customers and find the corresponding id, or create a new customer
	// first.
	CustomerID string `json:"customerId" api:"required" format:"uuid"`
	// ID for a Mercury account.
	DestinationAccountID string `json:"destinationAccountId" api:"required" format:"uuid"`
	// The due date the invoice should be paid by. YYYY-MM-DD
	DueDate time.Time `json:"dueDate" api:"required" format:"date"`
	// The date of the invoice, set by the invoice creator and likely to be context
	// specific to the type of transaction. For example, it could be a date a service
	// was performed. YYYY-MM-DD
	InvoiceDate time.Time `json:"invoiceDate" api:"required" format:"date"`
	// The line items for the invoice
	LineItems []LineItemDataParam `json:"lineItems,omitzero" api:"required"`
	// Whether or not the invoice payment instructions will show the real account and
	// routing number for the destination account or use virtual account numbers
	// instead. Virtual accounts are safer and are preferred in most cases.
	UseRealAccountNumber bool `json:"useRealAccountNumber" api:"required"`
	// Internal note for the invoice, visible by users in the organization but not
	// visible to payers.
	InternalNote param.Opt[string] `json:"internalNote,omitzero"`
	// The payer facing invoice number/identifier.
	InvoiceNumber param.Opt[string] `json:"invoiceNumber,omitzero"`
	// Memo for the payer of the invoice.
	PayerMemo param.Opt[string] `json:"payerMemo,omitzero"`
	// Purchase order number for the invoice, if applicable.
	PoNumber param.Opt[string] `json:"poNumber,omitzero"`
	// The end date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodEndDate param.Opt[time.Time] `json:"servicePeriodEndDate,omitzero" format:"date"`
	// The start date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodStartDate param.Opt[time.Time] `json:"servicePeriodStartDate,omitzero" format:"date"`
	// Rules for emailing the new invoice to payers. Can be "DontSend" to skip sending
	// or "SendNow" to send immediately. If omitted, defaults to sending immediately.
	//
	// Any of "DontSend", "SendNow".
	SendEmailOption InvoiceNewParamsSendEmailOption `json:"sendEmailOption,omitzero"`
	// contains filtered or unexported fields
}

func (InvoiceNewParams) MarshalJSON added in v0.3.3

func (r InvoiceNewParams) MarshalJSON() (data []byte, err error)

func (*InvoiceNewParams) UnmarshalJSON added in v0.3.3

func (r *InvoiceNewParams) UnmarshalJSON(data []byte) error

type InvoiceNewParamsSendEmailOption added in v0.3.3

type InvoiceNewParamsSendEmailOption string

Rules for emailing the new invoice to payers. Can be "DontSend" to skip sending or "SendNow" to send immediately. If omitted, defaults to sending immediately.

const (
	InvoiceNewParamsSendEmailOptionDontSend InvoiceNewParamsSendEmailOption = "DontSend"
	InvoiceNewParamsSendEmailOptionSendNow  InvoiceNewParamsSendEmailOption = "SendNow"
)

type InvoiceService added in v0.3.3

type InvoiceService struct {
	Options []option.RequestOption
	// Manage invoices
	Attachments InvoiceAttachmentService
}

Manage invoices

InvoiceService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInvoiceService method instead.

func NewInvoiceService added in v0.3.3

func NewInvoiceService(opts ...option.RequestOption) (r InvoiceService)

NewInvoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InvoiceService) Cancel added in v0.3.3

func (r *InvoiceService) Cancel(ctx context.Context, invoiceID string, opts ...option.RequestOption) (err error)

Cancel an invoice. This action cannot be undone.

func (*InvoiceService) Download added in v0.3.3

func (r *InvoiceService) Download(ctx context.Context, invoiceID string, opts ...option.RequestOption) (res *http.Response, err error)

Downloads a PDF file for the specified invoice. The response includes a Content-Disposition header set to 'attachment' with the filename.

func (*InvoiceService) Get added in v0.3.3

func (r *InvoiceService) Get(ctx context.Context, invoiceID string, opts ...option.RequestOption) (res *Invoice, err error)

Retrieve details of an invoice by its ID

func (*InvoiceService) List added in v0.3.3

Retrieve a paginated list of invoices. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*InvoiceService) ListAutoPaging added in v0.3.3

Retrieve a paginated list of invoices. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters.

func (*InvoiceService) New added in v0.3.3

func (r *InvoiceService) New(ctx context.Context, body InvoiceNewParams, opts ...option.RequestOption) (res *Invoice, err error)

Create a new invoice for the organization

func (*InvoiceService) Update added in v0.3.3

func (r *InvoiceService) Update(ctx context.Context, invoiceID string, body InvoiceUpdateParams, opts ...option.RequestOption) (res *Invoice, err error)

Update an existing invoice

type InvoiceUpdateParams added in v0.3.3

type InvoiceUpdateParams struct {
	// Whether or not the invoice can be paid via ACH debit.
	ACHDebitEnabled bool `json:"achDebitEnabled" api:"required"`
	// List of emails to be CCed on notifications/reminders.
	CcEmails []string `json:"ccEmails,omitzero" api:"required"`
	// Whether or not the invoice can be paid via credit card. Requires Stripe to be
	// setup for the Mercury account.
	CreditCardEnabled bool `json:"creditCardEnabled" api:"required"`
	// The date the invoice should be paid by. YYYY-MM-DD
	DueDate time.Time `json:"dueDate" api:"required" format:"date"`
	// The date of the invoice, set by the invoice creator. Does not have to be the day
	// the invoice was created. It can be business specific i.e. service/sale date.
	// YYYY-MM-DD
	InvoiceDate time.Time `json:"invoiceDate" api:"required" format:"date"`
	// The invoice number.
	InvoiceNumber string `json:"invoiceNumber" api:"required"`
	// The line items for the invoice
	LineItems []LineItemDataParam `json:"lineItems,omitzero" api:"required"`
	// Whether or not the invoice payment instructions will show the real account and
	// routing number for the destination account or use virtual account numbers
	// instead.
	UseRealAccountNumber bool `json:"useRealAccountNumber" api:"required"`
	// Internal note for the invoice, visible by users in the organization but not
	// visible to payers.
	InternalNote param.Opt[string] `json:"internalNote,omitzero"`
	// Memo for the payer of the invoice.
	PayerMemo param.Opt[string] `json:"payerMemo,omitzero"`
	// The purchase order number for the invoice if applicable.
	PoNumber param.Opt[string] `json:"poNumber,omitzero"`
	// The end date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodEndDate param.Opt[time.Time] `json:"servicePeriodEndDate,omitzero" format:"date"`
	// The start date for the service period this invoice covers, if applicable.
	// YYYY-MM-DD
	ServicePeriodStartDate param.Opt[time.Time] `json:"servicePeriodStartDate,omitzero" format:"date"`
	// contains filtered or unexported fields
}

func (InvoiceUpdateParams) MarshalJSON added in v0.3.3

func (r InvoiceUpdateParams) MarshalJSON() (data []byte, err error)

func (*InvoiceUpdateParams) UnmarshalJSON added in v0.3.3

func (r *InvoiceUpdateParams) UnmarshalJSON(data []byte) error

type LineItemData

type LineItemData struct {
	// the name of the line item
	Name string `json:"name" api:"required"`
	// the quantity of this item
	Quantity float64 `json:"quantity" api:"required"`
	// A dollar amount
	UnitPrice float64 `json:"unitPrice" api:"required"`
	// the sales tax applied to this item
	SalesTaxRate float64 `json:"salesTaxRate" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name         respjson.Field
		Quantity     respjson.Field
		UnitPrice    respjson.Field
		SalesTaxRate respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Data for an invoice line item

func (LineItemData) RawJSON

func (r LineItemData) RawJSON() string

Returns the unmodified JSON received from the API

func (LineItemData) ToParam

func (r LineItemData) ToParam() LineItemDataParam

ToParam converts this LineItemData to a LineItemDataParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with LineItemDataParam.Overrides()

func (*LineItemData) UnmarshalJSON

func (r *LineItemData) UnmarshalJSON(data []byte) error

type LineItemDataParam

type LineItemDataParam struct {
	// the name of the line item
	Name string `json:"name" api:"required"`
	// the quantity of this item
	Quantity float64 `json:"quantity" api:"required"`
	// A dollar amount
	UnitPrice float64 `json:"unitPrice" api:"required"`
	// the sales tax applied to this item
	SalesTaxRate param.Opt[float64] `json:"salesTaxRate,omitzero"`
	// contains filtered or unexported fields
}

Data for an invoice line item

The properties Name, Quantity, UnitPrice are required.

func (LineItemDataParam) MarshalJSON

func (r LineItemDataParam) MarshalJSON() (data []byte, err error)

func (*LineItemDataParam) UnmarshalJSON

func (r *LineItemDataParam) UnmarshalJSON(data []byte) error

type MerchantData

type MerchantData struct {
	// Merchant ID for card transactions
	ID string `json:"id" api:"nullable"`
	// Mercury category for the merchant (e.g., "Restaurants", "Software")
	//
	// Any of "Other", "Advertising", "Airlines", "AlcoholAndBars",
	// "BooksAndNewspaper", "CarRental", "Charity", "Clothing", "Conferences",
	// "Education", "Electronics", "Entertainment", "FacilitiesExpenses", "Fees",
	// "FoodDelivery", "FuelAndGas", "Gambling", "GovernmentServices", "Grocery",
	// "GroundTransportation", "Insurance", "InternetAndTelephone", "Legal", "Lodging",
	// "Medical", "Memberships", "OfficeSupplies", "OtherTravel", "Parking",
	// "Political", "ProfessionalServices", "Restaurants", "Retail",
	// "RideshareAndTaxis", "Shipping", "Software", "Taxes", "Utilities",
	// "VehicleExpenses".
	Category MercuryCategory `json:"category" api:"nullable"`
	// 4-digit merchant category code (MCC) for card transactions
	CategoryCode string `json:"categoryCode" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Category     respjson.Field
		CategoryCode respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Merchant information for card transactions

func (MerchantData) RawJSON

func (r MerchantData) RawJSON() string

Returns the unmodified JSON received from the API

func (*MerchantData) UnmarshalJSON

func (r *MerchantData) UnmarshalJSON(data []byte) error

type MercuryCategory

type MercuryCategory string
const (
	MercuryCategoryOther                MercuryCategory = "Other"
	MercuryCategoryAdvertising          MercuryCategory = "Advertising"
	MercuryCategoryAirlines             MercuryCategory = "Airlines"
	MercuryCategoryAlcoholAndBars       MercuryCategory = "AlcoholAndBars"
	MercuryCategoryBooksAndNewspaper    MercuryCategory = "BooksAndNewspaper"
	MercuryCategoryCarRental            MercuryCategory = "CarRental"
	MercuryCategoryCharity              MercuryCategory = "Charity"
	MercuryCategoryClothing             MercuryCategory = "Clothing"
	MercuryCategoryConferences          MercuryCategory = "Conferences"
	MercuryCategoryEducation            MercuryCategory = "Education"
	MercuryCategoryElectronics          MercuryCategory = "Electronics"
	MercuryCategoryEntertainment        MercuryCategory = "Entertainment"
	MercuryCategoryFacilitiesExpenses   MercuryCategory = "FacilitiesExpenses"
	MercuryCategoryFees                 MercuryCategory = "Fees"
	MercuryCategoryFoodDelivery         MercuryCategory = "FoodDelivery"
	MercuryCategoryFuelAndGas           MercuryCategory = "FuelAndGas"
	MercuryCategoryGambling             MercuryCategory = "Gambling"
	MercuryCategoryGovernmentServices   MercuryCategory = "GovernmentServices"
	MercuryCategoryGrocery              MercuryCategory = "Grocery"
	MercuryCategoryGroundTransportation MercuryCategory = "GroundTransportation"
	MercuryCategoryInsurance            MercuryCategory = "Insurance"
	MercuryCategoryInternetAndTelephone MercuryCategory = "InternetAndTelephone"
	MercuryCategoryLegal                MercuryCategory = "Legal"
	MercuryCategoryLodging              MercuryCategory = "Lodging"
	MercuryCategoryMedical              MercuryCategory = "Medical"
	MercuryCategoryMemberships          MercuryCategory = "Memberships"
	MercuryCategoryOfficeSupplies       MercuryCategory = "OfficeSupplies"
	MercuryCategoryOtherTravel          MercuryCategory = "OtherTravel"
	MercuryCategoryParking              MercuryCategory = "Parking"
	MercuryCategoryPolitical            MercuryCategory = "Political"
	MercuryCategoryProfessionalServices MercuryCategory = "ProfessionalServices"
	MercuryCategoryRestaurants          MercuryCategory = "Restaurants"
	MercuryCategoryRetail               MercuryCategory = "Retail"
	MercuryCategoryRideshareAndTaxis    MercuryCategory = "RideshareAndTaxis"
	MercuryCategoryShipping             MercuryCategory = "Shipping"
	MercuryCategorySoftware             MercuryCategory = "Software"
	MercuryCategoryTaxes                MercuryCategory = "Taxes"
	MercuryCategoryUtilities            MercuryCategory = "Utilities"
	MercuryCategoryVehicleExpenses      MercuryCategory = "VehicleExpenses"
)

type OrgGetResponse added in v0.3.3

type OrgGetResponse struct {
	// Organization information
	Organization OrgGetResponseOrganization `json:"organization" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Organization respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing organization details.

func (OrgGetResponse) RawJSON added in v0.3.3

func (r OrgGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrgGetResponse) UnmarshalJSON added in v0.3.3

func (r *OrgGetResponse) UnmarshalJSON(data []byte) error

type OrgGetResponseOrganization added in v0.3.3

type OrgGetResponseOrganization struct {
	// Unique identifier for the organization
	ID string `json:"id" api:"required" format:"uuid"`
	// List of DBAs (Doing Business As names) for this organization
	Dbas []OrgGetResponseOrganizationDba `json:"dbas" api:"required"`
	// Whether this is a personal or business organization
	//
	// Any of "personal", "business".
	Kind string `json:"kind" api:"required"`
	// Legal business name as registered
	LegalBusinessName string `json:"legalBusinessName" api:"required"`
	// Employer Identification Number (EIN), if available
	Ein string `json:"ein" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		Dbas              respjson.Field
		Kind              respjson.Field
		LegalBusinessName respjson.Field
		Ein               respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Organization information

func (OrgGetResponseOrganization) RawJSON added in v0.3.3

func (r OrgGetResponseOrganization) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrgGetResponseOrganization) UnmarshalJSON added in v0.3.3

func (r *OrgGetResponseOrganization) UnmarshalJSON(data []byte) error

type OrgGetResponseOrganizationDba added in v0.3.3

type OrgGetResponseOrganizationDba struct {
	// Whether this DBA is set as the default for payments
	DbaIsDefault bool `json:"dbaIsDefault" api:"required"`
	// The DBA name
	DbaName string `json:"dbaName" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DbaIsDefault respjson.Field
		DbaName      respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

DBA (Doing Business As) information

func (OrgGetResponseOrganizationDba) RawJSON added in v0.3.3

Returns the unmodified JSON received from the API

func (*OrgGetResponseOrganizationDba) UnmarshalJSON added in v0.3.3

func (r *OrgGetResponseOrganizationDba) UnmarshalJSON(data []byte) error

type OrgService added in v0.3.3

type OrgService struct {
	Options []option.RequestOption
}

Organization information

OrgService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrgService method instead.

func NewOrgService added in v0.3.3

func NewOrgService(opts ...option.RequestOption) (r OrgService)

NewOrgService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrgService) Get added in v0.3.3

func (r *OrgService) Get(ctx context.Context, opts ...option.RequestOption) (res *OrgGetResponse, err error)

Retrieve information about your organization including EIN, legal business name, and DBAs.

type PaymentLinkStatus

type PaymentLinkStatus string
const (
	PaymentLinkStatusUnpaid     PaymentLinkStatus = "Unpaid"
	PaymentLinkStatusPaid       PaymentLinkStatus = "Paid"
	PaymentLinkStatusCancelled  PaymentLinkStatus = "Cancelled"
	PaymentLinkStatusProcessing PaymentLinkStatus = "Processing"
)

type PaymentListParams added in v0.4.1

type PaymentListParams struct {
	// ID for a Mercury account.
	AccountID param.Opt[string] `query:"accountId,omitzero" format:"uuid" json:"-"`
	// The ID of the send money approval request to end the page before (exclusive).
	// When provided, results will end just before this ID and work backwards. Use this
	// for reverse pagination or to retrieve previous pages. Cannot be combined with
	// start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the send money approval request to start the page after (exclusive).
	// When provided, results will begin with the send money approval request
	// immediately following this ID. Use this for standard forward pagination to get
	// the next page of results. Cannot be combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Any of "pendingApproval", "approved", "rejected", "cancelled".
	Status PaymentListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PaymentListParams) URLQuery added in v0.4.1

func (r PaymentListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PaymentListParams's query parameters as `url.Values`.

type PaymentListParamsStatus added in v0.4.1

type PaymentListParamsStatus string
const (
	PaymentListParamsStatusPendingApproval PaymentListParamsStatus = "pendingApproval"
	PaymentListParamsStatusApproved        PaymentListParamsStatus = "approved"
	PaymentListParamsStatusRejected        PaymentListParamsStatus = "rejected"
	PaymentListParamsStatusCancelled       PaymentListParamsStatus = "cancelled"
)

type PaymentNewParams added in v0.4.1

type PaymentNewParams struct {
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// Unique string identifying the transaction
	IdempotencyKey string `json:"idempotencyKey" api:"required"`
	// If domesticWire is used, then the purpose field is required.
	//
	// Any of "ach", "check", "domesticWire".
	PaymentMethod PaymentNewParamsPaymentMethod `json:"paymentMethod,omitzero" api:"required"`
	// ID for a Mercury account.
	RecipientID string `json:"recipientId" api:"required" format:"uuid"`
	// Optional external memo
	ExternalMemo param.Opt[string] `json:"externalMemo,omitzero"`
	// Optional note
	Note param.Opt[string] `json:"note,omitzero"`
	// External API representation of SendMoneyPurpose. Only exposes the 'simple' field
	// to decouple internal implementation from external API.
	Purpose PaymentNewParamsPurpose `json:"purpose,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentNewParams) MarshalJSON added in v0.4.1

func (r PaymentNewParams) MarshalJSON() (data []byte, err error)

func (*PaymentNewParams) UnmarshalJSON added in v0.4.1

func (r *PaymentNewParams) UnmarshalJSON(data []byte) error

type PaymentNewParamsPaymentMethod added in v0.4.1

type PaymentNewParamsPaymentMethod string

If domesticWire is used, then the purpose field is required.

const (
	PaymentNewParamsPaymentMethodACH          PaymentNewParamsPaymentMethod = "ach"
	PaymentNewParamsPaymentMethodCheck        PaymentNewParamsPaymentMethod = "check"
	PaymentNewParamsPaymentMethodDomesticWire PaymentNewParamsPaymentMethod = "domesticWire"
)

type PaymentNewParamsPurpose added in v0.4.1

type PaymentNewParamsPurpose struct {
	Simple PaymentNewParamsPurposeSimple `json:"simple,omitzero"`
	// contains filtered or unexported fields
}

External API representation of SendMoneyPurpose. Only exposes the 'simple' field to decouple internal implementation from external API.

func (PaymentNewParamsPurpose) MarshalJSON added in v0.4.1

func (r PaymentNewParamsPurpose) MarshalJSON() (data []byte, err error)

func (*PaymentNewParamsPurpose) UnmarshalJSON added in v0.4.1

func (r *PaymentNewParamsPurpose) UnmarshalJSON(data []byte) error

type PaymentNewParamsPurposeSimple added in v0.4.1

type PaymentNewParamsPurposeSimple struct {
	// Payment category.
	//
	// Any of "Employee", "Landlord", "Vendor", "Contractor", "Subsidiary",
	// "TransferToMyExternalAccount", "FamilyMemberOrFriend", "ForGoodsOrServices",
	// "AngelInvestment", "SavingsOrInvestments", "Expenses", "Travel", "Other".
	Category string `json:"category,omitzero" api:"required"`
	// Additional information. Required for: Vendor (vendor name), Contractor
	// (contractor name), Other (payment description). Optional for Subsidiary
	// (subsidiary name). Not accepted for any other categories.
	AdditionalInfo param.Opt[string] `json:"additionalInfo,omitzero"`
	// contains filtered or unexported fields
}

The property Category is required.

func (PaymentNewParamsPurposeSimple) MarshalJSON added in v0.4.1

func (r PaymentNewParamsPurposeSimple) MarshalJSON() (data []byte, err error)

func (*PaymentNewParamsPurposeSimple) UnmarshalJSON added in v0.4.1

func (r *PaymentNewParamsPurposeSimple) UnmarshalJSON(data []byte) error

type PaymentRequestParams added in v0.4.1

type PaymentRequestParams struct {
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// Unique string identifying the transaction
	IdempotencyKey string `json:"idempotencyKey" api:"required"`
	// Payment method to use.
	//
	// Any of "ach", "check", "domesticWire", "internationalWire".
	PaymentMethod SendMoneyPaymentMethod `json:"paymentMethod,omitzero" api:"required"`
	// ID for a Mercury account.
	RecipientID string `json:"recipientId" api:"required" format:"uuid"`
	// Optional external memo
	ExternalMemo param.Opt[string] `json:"externalMemo,omitzero"`
	// Optional note
	Note param.Opt[string] `json:"note,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentRequestParams) MarshalJSON added in v0.4.1

func (r PaymentRequestParams) MarshalJSON() (data []byte, err error)

func (*PaymentRequestParams) UnmarshalJSON added in v0.4.1

func (r *PaymentRequestParams) UnmarshalJSON(data []byte) error

type PaymentService added in v0.4.1

type PaymentService struct {
	Options []option.RequestOption
}

PaymentService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentService method instead.

func NewPaymentService added in v0.4.1

func NewPaymentService(opts ...option.RequestOption) (r PaymentService)

NewPaymentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PaymentService) Get added in v0.4.1

func (r *PaymentService) Get(ctx context.Context, requestID string, opts ...option.RequestOption) (res *SendMoneyApproval, err error)

Get send money approval request by ID

func (*PaymentService) List added in v0.4.1

Retrieve a paginated list of send money approval requests for the authenticated organization. Supports filtering by account and status.

func (*PaymentService) ListAutoPaging added in v0.4.1

Retrieve a paginated list of send money approval requests for the authenticated organization. Supports filtering by account and status.

func (*PaymentService) New added in v0.4.1

func (r *PaymentService) New(ctx context.Context, accountID string, body PaymentNewParams, opts ...option.RequestOption) (res *Transaction, err error)

Send money from an account to a recipient. Creates a transaction that will be processed immediately or may require approval.

func (*PaymentService) Request added in v0.4.1

func (r *PaymentService) Request(ctx context.Context, accountID string, body PaymentRequestParams, opts ...option.RequestOption) (res *SendMoneyApproval, err error)

Create a "request to send money" that will require approval based on your organization's approval policies.

func (*PaymentService) Transfer added in v0.4.1

Transfer funds between two accounts within the same organization. Supports transfers between depository accounts (checking/savings), from a depository account to a treasury/investment account, and from a treasury/investment account to a depository account. Creates paired debit and credit transactions.

type PaymentTransferParams added in v0.4.1

type PaymentTransferParams struct {
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// ID for a Mercury account.
	DestinationAccountID string `json:"destinationAccountId" api:"required" format:"uuid"`
	IdempotencyKey       string `json:"idempotencyKey" api:"required"`
	// ID for a Mercury account.
	SourceAccountID string            `json:"sourceAccountId" api:"required" format:"uuid"`
	Note            param.Opt[string] `json:"note,omitzero"`
	// contains filtered or unexported fields
}

func (PaymentTransferParams) MarshalJSON added in v0.4.1

func (r PaymentTransferParams) MarshalJSON() (data []byte, err error)

func (*PaymentTransferParams) UnmarshalJSON added in v0.4.1

func (r *PaymentTransferParams) UnmarshalJSON(data []byte) error

type PaymentTransferResponse added in v0.4.1

type PaymentTransferResponse struct {
	CreditTransaction Transaction `json:"creditTransaction" api:"required"`
	DebitTransaction  Transaction `json:"debitTransaction" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTransaction respjson.Field
		DebitTransaction  respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response for POST /api/v1/transfer endpoint. Returns both the credit and debit transactions for the transfer (depository, treasury, or investment).

func (PaymentTransferResponse) RawJSON added in v0.4.1

func (r PaymentTransferResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PaymentTransferResponse) UnmarshalJSON added in v0.4.1

func (r *PaymentTransferResponse) UnmarshalJSON(data []byte) error

type RealTimePaymentRoutingInfo

type RealTimePaymentRoutingInfo struct {
	AccountNumber string             `json:"accountNumber" api:"required"`
	RoutingNumber string             `json:"routingNumber" api:"required"`
	Address       AddressWithoutName `json:"address" api:"nullable"`
	BankName      string             `json:"bankName" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountNumber respjson.Field
		RoutingNumber respjson.Field
		Address       respjson.Field
		BankName      respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RealTimePaymentRoutingInfo) RawJSON

func (r RealTimePaymentRoutingInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*RealTimePaymentRoutingInfo) UnmarshalJSON

func (r *RealTimePaymentRoutingInfo) UnmarshalJSON(data []byte) error

type Recipient

type Recipient struct {
	// ID for a Mercury account.
	ID          string                `json:"id" api:"required" format:"uuid"`
	Attachments []RecipientAttachment `json:"attachments" api:"required"`
	// Any of "ach", "check", "domesticWire", "internationalWire", "realTimePayment".
	DefaultPaymentMethod RecipientDefaultPaymentMethod `json:"defaultPaymentMethod" api:"required"`
	Emails               []string                      `json:"emails" api:"required"`
	Name                 string                        `json:"name" api:"required"`
	// Any of "active", "deleted".
	Status                       RecipientStatus              `json:"status" api:"required"`
	Address                      Address                      `json:"address" api:"nullable"`
	CheckInfo                    CheckInfo                    `json:"checkInfo" api:"nullable"`
	ContactEmail                 string                       `json:"contactEmail" api:"nullable"`
	DateLastPaid                 string                       `json:"dateLastPaid" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	DefaultAddress               AddressWithoutName           `json:"defaultAddress" api:"nullable"`
	DomesticWireRoutingInfo      DomesticWireRoutingInfo      `json:"domesticWireRoutingInfo" api:"nullable"`
	ElectronicRoutingInfo        ElectronicRoutingInfo        `json:"electronicRoutingInfo" api:"nullable"`
	InternationalWireRoutingInfo InternationalWireRoutingInfo `json:"internationalWireRoutingInfo" api:"nullable"`
	IsBusiness                   bool                         `json:"isBusiness" api:"nullable"`
	Nickname                     string                       `json:"nickname" api:"nullable"`
	RealTimePaymentRoutingInfo   RealTimePaymentRoutingInfo   `json:"realTimePaymentRoutingInfo" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                           respjson.Field
		Attachments                  respjson.Field
		DefaultPaymentMethod         respjson.Field
		Emails                       respjson.Field
		Name                         respjson.Field
		Status                       respjson.Field
		Address                      respjson.Field
		CheckInfo                    respjson.Field
		ContactEmail                 respjson.Field
		DateLastPaid                 respjson.Field
		DefaultAddress               respjson.Field
		DomesticWireRoutingInfo      respjson.Field
		ElectronicRoutingInfo        respjson.Field
		InternationalWireRoutingInfo respjson.Field
		IsBusiness                   respjson.Field
		Nickname                     respjson.Field
		RealTimePaymentRoutingInfo   respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Recipient) RawJSON

func (r Recipient) RawJSON() string

Returns the unmodified JSON received from the API

func (*Recipient) UnmarshalJSON

func (r *Recipient) UnmarshalJSON(data []byte) error

type RecipientAttachment

type RecipientAttachment struct {
	// Name of the uploaded file
	FileName string `json:"fileName" api:"required"`
	// Timestamp when the attachment was uploaded
	UploadedAt string `json:"uploadedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Presigned URL to download the attachment (valid for 12 hours)
	URL string `json:"url" api:"required"`
	// The tax form type (W-9 for US persons, W-8BEN for foreign individuals, W-8BEN-E
	// for foreign entities)
	//
	// Any of "w9", "w8BEN", "w8BENE", "unknown".
	FormType TaxFormType `json:"formType" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileName    respjson.Field
		UploadedAt  respjson.Field
		URL         respjson.Field
		FormType    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RecipientAttachment) RawJSON

func (r RecipientAttachment) RawJSON() string

Returns the unmodified JSON received from the API

func (*RecipientAttachment) UnmarshalJSON

func (r *RecipientAttachment) UnmarshalJSON(data []byte) error

type RecipientAttachmentAttachParams added in v0.4.2

type RecipientAttachmentAttachParams struct {
	// The file to upload (tax form document)
	File io.Reader `json:"file,omitzero" api:"required" format:"binary"`
	// contains filtered or unexported fields
}

func (RecipientAttachmentAttachParams) MarshalMultipart added in v0.4.2

func (r RecipientAttachmentAttachParams) MarshalMultipart() (data []byte, contentType string, err error)

type RecipientAttachmentListParams added in v0.4.2

type RecipientAttachmentListParams struct {
	// The ID of the recipient attachment to end the page before (exclusive). When
	// provided, results will end just before this ID and work backwards. Use this for
	// reverse pagination or to retrieve previous pages. Cannot be combined with
	// start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the recipient attachment to start the page after (exclusive). When
	// provided, results will begin with the recipient attachment immediately following
	// this ID. Use this for standard forward pagination to get the next page of
	// results. Cannot be combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order RecipientAttachmentListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RecipientAttachmentListParams) URLQuery added in v0.4.2

func (r RecipientAttachmentListParams) URLQuery() (v url.Values, err error)

URLQuery serializes RecipientAttachmentListParams's query parameters as `url.Values`.

type RecipientAttachmentListParamsOrder added in v0.4.2

type RecipientAttachmentListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	RecipientAttachmentListParamsOrderAsc  RecipientAttachmentListParamsOrder = "asc"
	RecipientAttachmentListParamsOrderDesc RecipientAttachmentListParamsOrder = "desc"
)

type RecipientAttachmentListResponse added in v0.4.2

type RecipientAttachmentListResponse struct {
	// ID for the recipient tax form attachment
	ID string `json:"id" api:"required" format:"uuid"`
	// Name of the uploaded file
	FileName string `json:"fileName" api:"required"`
	// ID for a Mercury account.
	RecipientID string `json:"recipientId" api:"required" format:"uuid"`
	// Timestamp when the attachment was uploaded
	UploadedAt string `json:"uploadedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Presigned URL to download the attachment (valid for 12 hours)
	URL string `json:"url" api:"required"`
	// The tax form type (W-9, W-8BEN, W-8BEN-E, or Unknown)
	//
	// Any of "w9", "w8BEN", "w8BENE", "unknown".
	FormType TaxFormType `json:"formType" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		FileName    respjson.Field
		RecipientID respjson.Field
		UploadedAt  respjson.Field
		URL         respjson.Field
		FormType    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RecipientAttachmentListResponse) RawJSON added in v0.4.2

Returns the unmodified JSON received from the API

func (*RecipientAttachmentListResponse) UnmarshalJSON added in v0.4.2

func (r *RecipientAttachmentListResponse) UnmarshalJSON(data []byte) error

type RecipientAttachmentService added in v0.4.2

type RecipientAttachmentService struct {
	Options []option.RequestOption
}

Manage payment recipients

RecipientAttachmentService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRecipientAttachmentService method instead.

func NewRecipientAttachmentService added in v0.4.2

func NewRecipientAttachmentService(opts ...option.RequestOption) (r RecipientAttachmentService)

NewRecipientAttachmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RecipientAttachmentService) Attach added in v0.4.2

Upload a tax form attachment for a recipient. The file is uploaded via multipart/form-data. Supported file types include PDF, images (PNG, JPG, GIF), and common document formats. The attachment will be associated as a tax document for the recipient.

func (*RecipientAttachmentService) List added in v0.4.2

Retrieve a paginated list of all recipient tax form attachments across all recipients in the organization. Use cursor parameters (start_after, end_before) for pagination.

func (*RecipientAttachmentService) ListAutoPaging added in v0.4.2

Retrieve a paginated list of all recipient tax form attachments across all recipients in the organization. Use cursor parameters (start_after, end_before) for pagination.

type RecipientDefaultPaymentMethod

type RecipientDefaultPaymentMethod string
const (
	RecipientDefaultPaymentMethodACH               RecipientDefaultPaymentMethod = "ach"
	RecipientDefaultPaymentMethodCheck             RecipientDefaultPaymentMethod = "check"
	RecipientDefaultPaymentMethodDomesticWire      RecipientDefaultPaymentMethod = "domesticWire"
	RecipientDefaultPaymentMethodInternationalWire RecipientDefaultPaymentMethod = "internationalWire"
	RecipientDefaultPaymentMethodRealTimePayment   RecipientDefaultPaymentMethod = "realTimePayment"
)

type RecipientListParams

type RecipientListParams struct {
	// The ID of the recipient to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the recipient to start the page after (exclusive). When provided,
	// results will begin with the recipient immediately following this ID. Use this
	// for standard forward pagination to get the next page of results. Cannot be
	// combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order RecipientListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RecipientListParams) URLQuery

func (r RecipientListParams) URLQuery() (v url.Values, err error)

URLQuery serializes RecipientListParams's query parameters as `url.Values`.

type RecipientListParamsOrder

type RecipientListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	RecipientListParamsOrderAsc  RecipientListParamsOrder = "asc"
	RecipientListParamsOrderDesc RecipientListParamsOrder = "desc"
)

type RecipientNewParams

type RecipientNewParams struct {
	Emails []string `json:"emails,omitzero" api:"required"`
	Name   string   `json:"name" api:"required"`
	// Contact email address of the recipient
	ContactEmail param.Opt[string] `json:"contactEmail,omitzero"`
	Nickname     param.Opt[string] `json:"nickname,omitzero"`
	// Deprecated. Use checkInfo instead.
	Address AddressDataParam `json:"address,omitzero"`
	// Information needed to send a physical check.
	CheckInfo CheckInfoRawParam `json:"checkInfo,omitzero"`
	// Information needed to send a domestic wire.
	DomesticWireRoutingInfo DomesticWireRoutingInfoRawParam `json:"domesticWireRoutingInfo,omitzero"`
	// Information needed to send an ACH.
	ElectronicRoutingInfo ElectronicRoutingInfoRawParam `json:"electronicRoutingInfo,omitzero"`
	// contains filtered or unexported fields
}

func (RecipientNewParams) MarshalJSON

func (r RecipientNewParams) MarshalJSON() (data []byte, err error)

func (*RecipientNewParams) UnmarshalJSON

func (r *RecipientNewParams) UnmarshalJSON(data []byte) error

type RecipientService

type RecipientService struct {
	Options []option.RequestOption
	// Manage payment recipients
	Attachments RecipientAttachmentService
}

Manage payment recipients

RecipientService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRecipientService method instead.

func NewRecipientService

func NewRecipientService(opts ...option.RequestOption) (r RecipientService)

NewRecipientService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RecipientService) Get

func (r *RecipientService) Get(ctx context.Context, recipientID string, opts ...option.RequestOption) (res *Recipient, err error)

Retrieve details of a specific recipient by ID

func (*RecipientService) List

Retrieve a paginated list of all recipients. Use cursor parameters (start_after, end_before) for pagination.

func (*RecipientService) ListAutoPaging

Retrieve a paginated list of all recipients. Use cursor parameters (start_after, end_before) for pagination.

func (*RecipientService) New

func (r *RecipientService) New(ctx context.Context, body RecipientNewParams, opts ...option.RequestOption) (res *Recipient, err error)

Create a new recipient for making payments

func (*RecipientService) Update

func (r *RecipientService) Update(ctx context.Context, recipientID string, body RecipientUpdateParams, opts ...option.RequestOption) (res *Recipient, err error)

Update an existing recipient's information

type RecipientStatus

type RecipientStatus string
const (
	RecipientStatusActive  RecipientStatus = "active"
	RecipientStatusDeleted RecipientStatus = "deleted"
)

type RecipientUpdateParams

type RecipientUpdateParams struct {
	// Contact email address of the recipient
	ContactEmail param.Opt[string] `json:"contactEmail,omitzero"`
	Name         param.Opt[string] `json:"name,omitzero"`
	Nickname     param.Opt[string] `json:"nickname,omitzero"`
	// Deprecated. Use checkInfo instead.
	Address AddressDataParam `json:"address,omitzero"`
	// Information needed to send a check.
	CheckInfo CheckInfoRawParam `json:"checkInfo,omitzero"`
	// Information needed to send a domestic wire.
	DomesticWireRoutingInfo DomesticWireRoutingInfoRawParam `json:"domesticWireRoutingInfo,omitzero"`
	// Information needed to send an ACH.
	ElectronicRoutingInfo ElectronicRoutingInfoRawParam `json:"electronicRoutingInfo,omitzero"`
	Emails                []string                      `json:"emails,omitzero"`
	// contains filtered or unexported fields
}

func (RecipientUpdateParams) MarshalJSON

func (r RecipientUpdateParams) MarshalJSON() (data []byte, err error)

func (*RecipientUpdateParams) UnmarshalJSON

func (r *RecipientUpdateParams) UnmarshalJSON(data []byte) error

type RelatedTransactionData

type RelatedTransactionData struct {
	// ID for this transaction
	ID string `json:"id" api:"required" format:"uuid"`
	// ID for a Mercury account.
	AccountID string  `json:"accountId" api:"required" format:"uuid"`
	Amount    float64 `json:"amount" api:"required"`
	// Any of "ProvisionalCreditReversalToMerchantRefund",
	// "MerchantRefundToProvisionalCreditReversal", "MerchantRefundToFraudulentCharge",
	// "FraudulentChargeToMerchantRefund", "PaymentRefundToFailedPayment",
	// "FailedPaymentToPaymentRefund", "GiftCompensationToOriginalTransaction",
	// "FeePaymentToOriginalTransaction", "OriginalTransactionToFeePayment",
	// "FeePaymentToFeeRebate", "FeeRebateToFeePayment", "FeePaymentToFeeReversal",
	// "FeeReversalToFeePayment", "FeeRebateToFeeRebateReversal",
	// "FeeRebateReversalToFeeRebate", "TreasurySplitLiquidation",
	// "ProvisionalCreditToOriginalCharge", "OriginalChargeToProvisionalCredit",
	// "FeeAtmReimbursementToAtmTransaction", "AtmTransactionToFeeAtmReimbursement",
	// "AtmTransactionToAtmReimbursementReversal",
	// "AtmReimbursementReversalToAtmTransaction", "ReturnToOriginalTransaction",
	// "OriginalTransactionToReturn", "ProvisionalCreditToReversal",
	// "ReversalToProvisionalCredit".
	RelationKind RelatedTransactionDataRelationKind `json:"relationKind" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		AccountID    respjson.Field
		Amount       respjson.Field
		RelationKind respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Public API version of RelatedTransactionData.

func (RelatedTransactionData) RawJSON

func (r RelatedTransactionData) RawJSON() string

Returns the unmodified JSON received from the API

func (*RelatedTransactionData) UnmarshalJSON

func (r *RelatedTransactionData) UnmarshalJSON(data []byte) error

type RelatedTransactionDataRelationKind

type RelatedTransactionDataRelationKind string
const (
	RelatedTransactionDataRelationKindProvisionalCreditReversalToMerchantRefund RelatedTransactionDataRelationKind = "ProvisionalCreditReversalToMerchantRefund"
	RelatedTransactionDataRelationKindMerchantRefundToProvisionalCreditReversal RelatedTransactionDataRelationKind = "MerchantRefundToProvisionalCreditReversal"
	RelatedTransactionDataRelationKindMerchantRefundToFraudulentCharge          RelatedTransactionDataRelationKind = "MerchantRefundToFraudulentCharge"
	RelatedTransactionDataRelationKindFraudulentChargeToMerchantRefund          RelatedTransactionDataRelationKind = "FraudulentChargeToMerchantRefund"
	RelatedTransactionDataRelationKindPaymentRefundToFailedPayment              RelatedTransactionDataRelationKind = "PaymentRefundToFailedPayment"
	RelatedTransactionDataRelationKindFailedPaymentToPaymentRefund              RelatedTransactionDataRelationKind = "FailedPaymentToPaymentRefund"
	RelatedTransactionDataRelationKindGiftCompensationToOriginalTransaction     RelatedTransactionDataRelationKind = "GiftCompensationToOriginalTransaction"
	RelatedTransactionDataRelationKindFeePaymentToOriginalTransaction           RelatedTransactionDataRelationKind = "FeePaymentToOriginalTransaction"
	RelatedTransactionDataRelationKindOriginalTransactionToFeePayment           RelatedTransactionDataRelationKind = "OriginalTransactionToFeePayment"
	RelatedTransactionDataRelationKindFeePaymentToFeeRebate                     RelatedTransactionDataRelationKind = "FeePaymentToFeeRebate"
	RelatedTransactionDataRelationKindFeeRebateToFeePayment                     RelatedTransactionDataRelationKind = "FeeRebateToFeePayment"
	RelatedTransactionDataRelationKindFeePaymentToFeeReversal                   RelatedTransactionDataRelationKind = "FeePaymentToFeeReversal"
	RelatedTransactionDataRelationKindFeeReversalToFeePayment                   RelatedTransactionDataRelationKind = "FeeReversalToFeePayment"
	RelatedTransactionDataRelationKindFeeRebateToFeeRebateReversal              RelatedTransactionDataRelationKind = "FeeRebateToFeeRebateReversal"
	RelatedTransactionDataRelationKindFeeRebateReversalToFeeRebate              RelatedTransactionDataRelationKind = "FeeRebateReversalToFeeRebate"
	RelatedTransactionDataRelationKindTreasurySplitLiquidation                  RelatedTransactionDataRelationKind = "TreasurySplitLiquidation"
	RelatedTransactionDataRelationKindProvisionalCreditToOriginalCharge         RelatedTransactionDataRelationKind = "ProvisionalCreditToOriginalCharge"
	RelatedTransactionDataRelationKindOriginalChargeToProvisionalCredit         RelatedTransactionDataRelationKind = "OriginalChargeToProvisionalCredit"
	RelatedTransactionDataRelationKindFeeAtmReimbursementToAtmTransaction       RelatedTransactionDataRelationKind = "FeeAtmReimbursementToAtmTransaction"
	RelatedTransactionDataRelationKindAtmTransactionToFeeAtmReimbursement       RelatedTransactionDataRelationKind = "AtmTransactionToFeeAtmReimbursement"
	RelatedTransactionDataRelationKindAtmTransactionToAtmReimbursementReversal  RelatedTransactionDataRelationKind = "AtmTransactionToAtmReimbursementReversal"
	RelatedTransactionDataRelationKindAtmReimbursementReversalToAtmTransaction  RelatedTransactionDataRelationKind = "AtmReimbursementReversalToAtmTransaction"
	RelatedTransactionDataRelationKindReturnToOriginalTransaction               RelatedTransactionDataRelationKind = "ReturnToOriginalTransaction"
	RelatedTransactionDataRelationKindOriginalTransactionToReturn               RelatedTransactionDataRelationKind = "OriginalTransactionToReturn"
	RelatedTransactionDataRelationKindProvisionalCreditToReversal               RelatedTransactionDataRelationKind = "ProvisionalCreditToReversal"
	RelatedTransactionDataRelationKindReversalToProvisionalCredit               RelatedTransactionDataRelationKind = "ReversalToProvisionalCredit"
)

type SafeRequest

type SafeRequest struct {
	// ID for the SAFE request
	ID                              string `json:"id" api:"required" format:"uuid"`
	DocumentURL                     string `json:"documentUrl" api:"required"`
	ExpiresAt                       string `json:"expiresAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	IncludesMostFavoredNationClause bool   `json:"includesMostFavoredNationClause" api:"required"`
	IncludesProRataRightsLetter     bool   `json:"includesProRataRightsLetter" api:"required"`
	// A positive dollar amount with at least 1 cent.
	InvestmentAmount float64   `json:"investmentAmount" api:"required"`
	InvestmentDate   time.Time `json:"investmentDate" api:"required" format:"date"`
	// Details about the investor buying the equity.
	Investor SafeRequestInvestor `json:"investor" api:"required"`
	// Details about the organization selling the equity
	Organization SafeRequestOrganization `json:"organization" api:"required"`
	// Any of "PreMoney", "PostMoney", "NoValuation".
	ValuationType SafeRequestValuationType `json:"valuationType" api:"required"`
	CanceledAt    string                   `json:"canceledAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	DiscountRate  float64                  `json:"discountRate" api:"nullable"`
	// Any of "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI",
	// "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS",
	// "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR",
	// "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY".
	GoverningState     UsState `json:"governingState" api:"nullable"`
	PaidAt             string  `json:"paidAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	SignedByInvestorAt string  `json:"signedByInvestorAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	SignedByOwnerAt    string  `json:"signedByOwnerAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// A positive dollar amount with at least 1 cent.
	ValuationCap float64 `json:"valuationCap" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                              respjson.Field
		DocumentURL                     respjson.Field
		ExpiresAt                       respjson.Field
		IncludesMostFavoredNationClause respjson.Field
		IncludesProRataRightsLetter     respjson.Field
		InvestmentAmount                respjson.Field
		InvestmentDate                  respjson.Field
		Investor                        respjson.Field
		Organization                    respjson.Field
		ValuationType                   respjson.Field
		CanceledAt                      respjson.Field
		DiscountRate                    respjson.Field
		GoverningState                  respjson.Field
		PaidAt                          respjson.Field
		SignedByInvestorAt              respjson.Field
		SignedByOwnerAt                 respjson.Field
		ValuationCap                    respjson.Field
		ExtraFields                     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A summary of a SAFE request.

func (SafeRequest) RawJSON

func (r SafeRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (*SafeRequest) UnmarshalJSON

func (r *SafeRequest) UnmarshalJSON(data []byte) error

type SafeRequestInvestor

type SafeRequestInvestor struct {
	// Any of "SafeRequestInvestorTypeIndividual",
	// "SafeRequestInvestorTypeVentureFund", "SafeRequestInvestorTypeOther".
	InvestorType      string `json:"investorType" api:"required"`
	LegalEntityName   string `json:"legalEntityName" api:"required"`
	SignatoryEmail    string `json:"signatoryEmail" api:"required"`
	SignatoryName     string `json:"signatoryName" api:"required"`
	AdditionalBylines string `json:"additionalBylines" api:"nullable"`
	Address           string `json:"address" api:"nullable"`
	SignatoryTitle    string `json:"signatoryTitle" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InvestorType      respjson.Field
		LegalEntityName   respjson.Field
		SignatoryEmail    respjson.Field
		SignatoryName     respjson.Field
		AdditionalBylines respjson.Field
		Address           respjson.Field
		SignatoryTitle    respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about the investor buying the equity.

func (SafeRequestInvestor) RawJSON

func (r SafeRequestInvestor) RawJSON() string

Returns the unmodified JSON received from the API

func (*SafeRequestInvestor) UnmarshalJSON

func (r *SafeRequestInvestor) UnmarshalJSON(data []byte) error

type SafeRequestOrganization

type SafeRequestOrganization struct {
	LegalEntityName string `json:"legalEntityName" api:"required"`
	SignatoryEmail  string `json:"signatoryEmail" api:"required"`
	SignatoryName   string `json:"signatoryName" api:"required"`
	SignatoryTitle  string `json:"signatoryTitle" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LegalEntityName respjson.Field
		SignatoryEmail  respjson.Field
		SignatoryName   respjson.Field
		SignatoryTitle  respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about the organization selling the equity

func (SafeRequestOrganization) RawJSON

func (r SafeRequestOrganization) RawJSON() string

Returns the unmodified JSON received from the API

func (*SafeRequestOrganization) UnmarshalJSON

func (r *SafeRequestOrganization) UnmarshalJSON(data []byte) error

type SafeRequestValuationType

type SafeRequestValuationType string
const (
	SafeRequestValuationTypePreMoney    SafeRequestValuationType = "PreMoney"
	SafeRequestValuationTypePostMoney   SafeRequestValuationType = "PostMoney"
	SafeRequestValuationTypeNoValuation SafeRequestValuationType = "NoValuation"
)

type SafeService

type SafeService struct {
	Options []option.RequestOption
}

Manage SAFE (Simple Agreement for Future Equity) requests

SafeService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSafeService method instead.

func NewSafeService

func NewSafeService(opts ...option.RequestOption) (r SafeService)

NewSafeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SafeService) Download added in v0.4.0

func (r *SafeService) Download(ctx context.Context, safeRequestID string, opts ...option.RequestOption) (res *http.Response, err error)

Download the PDF document for a specific SAFE request. Returns binary PDF data with a Content-Disposition header.

func (*SafeService) Get

func (r *SafeService) Get(ctx context.Context, safeRequestID string, opts ...option.RequestOption) (res *SafeRequest, err error)

Retrieve a specific SAFE request by its ID.

func (*SafeService) List

func (r *SafeService) List(ctx context.Context, opts ...option.RequestOption) (res *[]SafeRequest, err error)

Retrieve all SAFE (Simple Agreement for Future Equity) requests for your organization.

type SendMoneyApproval

type SendMoneyApproval struct {
	// ID for a Mercury account.
	AccountID string `json:"accountId" api:"required" format:"uuid"`
	// A positive dollar amount with at least 1 cent.
	Amount float64 `json:"amount" api:"required"`
	// Any of "ach", "check", "domesticWire", "internationalWire".
	PaymentMethod SendMoneyPaymentMethod `json:"paymentMethod" api:"required"`
	// ID for a Mercury account.
	RecipientID string `json:"recipientId" api:"required" format:"uuid"`
	RequestID   string `json:"requestId" api:"required"`
	// Any of "pendingApproval", "approved", "rejected", "cancelled".
	Status SendMoneyApprovalStatus `json:"status" api:"required"`
	Memo   string                  `json:"memo" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountID     respjson.Field
		Amount        respjson.Field
		PaymentMethod respjson.Field
		RecipientID   respjson.Field
		RequestID     respjson.Field
		Status        respjson.Field
		Memo          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Extremely close to the internal type, but strips out potentially unwanted fields

func (SendMoneyApproval) RawJSON

func (r SendMoneyApproval) RawJSON() string

Returns the unmodified JSON received from the API

func (*SendMoneyApproval) UnmarshalJSON

func (r *SendMoneyApproval) UnmarshalJSON(data []byte) error

type SendMoneyApprovalStatus

type SendMoneyApprovalStatus string
const (
	SendMoneyApprovalStatusPendingApproval SendMoneyApprovalStatus = "pendingApproval"
	SendMoneyApprovalStatusApproved        SendMoneyApprovalStatus = "approved"
	SendMoneyApprovalStatusRejected        SendMoneyApprovalStatus = "rejected"
	SendMoneyApprovalStatusCancelled       SendMoneyApprovalStatus = "cancelled"
)

type SendMoneyPaymentMethod

type SendMoneyPaymentMethod string
const (
	SendMoneyPaymentMethodACH               SendMoneyPaymentMethod = "ach"
	SendMoneyPaymentMethodCheck             SendMoneyPaymentMethod = "check"
	SendMoneyPaymentMethodDomesticWire      SendMoneyPaymentMethod = "domesticWire"
	SendMoneyPaymentMethodInternationalWire SendMoneyPaymentMethod = "internationalWire"
)

type StatementAccountListParams added in v0.4.1

type StatementAccountListParams struct {
	// Filter statements where the period start date is on or before this date. If the
	// date is in the future, defaults to the current date. Format: YYYY-MM-DD
	End param.Opt[string] `query:"end,omitzero" json:"-"`
	// The ID of the statement to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Filter statements where the period start date is on or after this date. Format:
	// YYYY-MM-DD
	Start param.Opt[string] `query:"start,omitzero" json:"-"`
	// The ID of the statement to start the page after (exclusive). When provided,
	// results will begin with the statement immediately following this ID. Use this
	// for standard forward pagination to get the next page of results. Cannot be
	// combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'desc'
	//
	// Any of "asc", "desc".
	Order StatementAccountListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (StatementAccountListParams) URLQuery added in v0.4.1

func (r StatementAccountListParams) URLQuery() (v url.Values, err error)

URLQuery serializes StatementAccountListParams's query parameters as `url.Values`.

type StatementAccountListParamsOrder added in v0.4.1

type StatementAccountListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'desc'

const (
	StatementAccountListParamsOrderAsc  StatementAccountListParamsOrder = "asc"
	StatementAccountListParamsOrderDesc StatementAccountListParamsOrder = "desc"
)

type StatementAccountListResponse added in v0.4.1

type StatementAccountListResponse struct {
	// ID for the account statement
	ID                  string  `json:"id" api:"required" format:"uuid"`
	AccountNumber       string  `json:"accountNumber" api:"required"`
	CompanyLegalAddress Address `json:"companyLegalAddress" api:"required"`
	CompanyLegalName    string  `json:"companyLegalName" api:"required"`
	DownloadURL         string  `json:"downloadUrl" api:"required"`
	EndDate             string  `json:"endDate" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// A dollar amount
	EndingBalance float64                                   `json:"endingBalance" api:"required"`
	RoutingNumber string                                    `json:"routingNumber" api:"required"`
	StartDate     string                                    `json:"startDate" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	Transactions  []StatementAccountListResponseTransaction `json:"transactions" api:"required"`
	Ein           string                                    `json:"ein" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		AccountNumber       respjson.Field
		CompanyLegalAddress respjson.Field
		CompanyLegalName    respjson.Field
		DownloadURL         respjson.Field
		EndDate             respjson.Field
		EndingBalance       respjson.Field
		RoutingNumber       respjson.Field
		StartDate           respjson.Field
		Transactions        respjson.Field
		Ein                 respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (StatementAccountListResponse) RawJSON added in v0.4.1

Returns the unmodified JSON received from the API

func (*StatementAccountListResponse) UnmarshalJSON added in v0.4.1

func (r *StatementAccountListResponse) UnmarshalJSON(data []byte) error

type StatementAccountListResponseTransaction added in v0.4.1

type StatementAccountListResponseTransaction struct {
	// ID for this transaction
	ID        string `json:"id" api:"required" format:"uuid"`
	CreatedAt string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	PostedAt  string `json:"postedAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		PostedAt    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (StatementAccountListResponseTransaction) RawJSON added in v0.4.1

Returns the unmodified JSON received from the API

func (*StatementAccountListResponseTransaction) UnmarshalJSON added in v0.4.1

func (r *StatementAccountListResponseTransaction) UnmarshalJSON(data []byte) error

type StatementAccountService added in v0.4.1

type StatementAccountService struct {
	Options []option.RequestOption
}

Manage bank accounts

StatementAccountService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewStatementAccountService method instead.

func NewStatementAccountService added in v0.4.1

func NewStatementAccountService(opts ...option.RequestOption) (r StatementAccountService)

NewStatementAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*StatementAccountService) List added in v0.4.1

Retrieve a paginated list of monthly statements for a specific account. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters, as well as date range filtering with start and end parameters.

func (*StatementAccountService) ListAutoPaging added in v0.4.1

Retrieve a paginated list of monthly statements for a specific account. Supports cursor-based pagination with limit, order, start_after, and end_before query parameters, as well as date range filtering with start and end parameters.

type StatementService

type StatementService struct {
	Options []option.RequestOption
	// Manage bank accounts
	Accounts StatementAccountService
	// Manage treasury accounts and transactions
	Treasury StatementTreasuryService
}

Download account statements

StatementService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewStatementService method instead.

func NewStatementService

func NewStatementService(opts ...option.RequestOption) (r StatementService)

NewStatementService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*StatementService) Download added in v0.4.0

func (r *StatementService) Download(ctx context.Context, statementID string, opts ...option.RequestOption) (res *http.Response, err error)

Downloads a PDF file for the specified account statement. The response includes a Content-Disposition header for proper file download handling. Returns binary PDF data.

type StatementTreasuryListParams added in v0.4.1

type StatementTreasuryListParams struct {
	// The ID of the statement to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the statement to start the page after (exclusive). When provided,
	// results will begin with the statement immediately following this ID. Use this
	// for standard forward pagination to get the next page of results. Cannot be
	// combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Filter statements by document type.
	//
	// Any of "MonthlyStatement", "TradeConfirmation", "1099", "1099R", "1042S",
	// "5498", "5498ESA", "1099Q", "FMV", "SDIRA".
	DocumentType StatementTreasuryListParamsDocumentType `query:"documentType,omitzero" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order StatementTreasuryListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (StatementTreasuryListParams) URLQuery added in v0.4.1

func (r StatementTreasuryListParams) URLQuery() (v url.Values, err error)

URLQuery serializes StatementTreasuryListParams's query parameters as `url.Values`.

type StatementTreasuryListParamsDocumentType added in v0.4.1

type StatementTreasuryListParamsDocumentType string

Filter statements by document type.

const (
	StatementTreasuryListParamsDocumentTypeMonthlyStatement  StatementTreasuryListParamsDocumentType = "MonthlyStatement"
	StatementTreasuryListParamsDocumentTypeTradeConfirmation StatementTreasuryListParamsDocumentType = "TradeConfirmation"
	StatementTreasuryListParamsDocumentType1099              StatementTreasuryListParamsDocumentType = "1099"
	StatementTreasuryListParamsDocumentType1099R             StatementTreasuryListParamsDocumentType = "1099R"
	StatementTreasuryListParamsDocumentType1042S             StatementTreasuryListParamsDocumentType = "1042S"
	StatementTreasuryListParamsDocumentType5498              StatementTreasuryListParamsDocumentType = "5498"
	StatementTreasuryListParamsDocumentType5498Esa           StatementTreasuryListParamsDocumentType = "5498ESA"
	StatementTreasuryListParamsDocumentType1099Q             StatementTreasuryListParamsDocumentType = "1099Q"
	StatementTreasuryListParamsDocumentTypeFmv               StatementTreasuryListParamsDocumentType = "FMV"
	StatementTreasuryListParamsDocumentTypeSdira             StatementTreasuryListParamsDocumentType = "SDIRA"
)

type StatementTreasuryListParamsOrder added in v0.4.1

type StatementTreasuryListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	StatementTreasuryListParamsOrderAsc  StatementTreasuryListParamsOrder = "asc"
	StatementTreasuryListParamsOrderDesc StatementTreasuryListParamsOrder = "desc"
)

type StatementTreasuryListResponse added in v0.4.1

type StatementTreasuryListResponse struct {
	// ID for the account statement
	ID string `json:"id" api:"required" format:"uuid"`
	// ID for a Mercury account.
	AccountID string `json:"accountId" api:"required" format:"uuid"`
	// Timestamp when the record was created
	CreatedAt string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Date the statement was created by the custodian
	CreationDate string `json:"creationDate" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// Human-readable description of the statement
	Description string `json:"description" api:"required"`
	// Type of document (e.g. monthly statement, trade confirmation, tax form)
	//
	// Any of "MonthlyStatement", "TradeConfirmation", "1099", "1099R", "1042S",
	// "5498", "5498ESA", "1099Q", "FMV", "SDIRA".
	DocumentType StatementTreasuryListResponseDocumentType `json:"documentType" api:"required"`
	// URL to download the statement PDF
	DownloadURL string `json:"downloadUrl" api:"required"`
	// End of the period covered by the statement
	PeriodEnd time.Time `json:"periodEnd" api:"required" format:"date"`
	// Start of the period covered by the statement
	PeriodStart time.Time `json:"periodStart" api:"required" format:"date"`
	// Timestamp when the record was last updated
	UpdatedAt string `json:"updatedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		AccountID    respjson.Field
		CreatedAt    respjson.Field
		CreationDate respjson.Field
		Description  respjson.Field
		DocumentType respjson.Field
		DownloadURL  respjson.Field
		PeriodEnd    respjson.Field
		PeriodStart  respjson.Field
		UpdatedAt    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Individual treasury statement in the response

func (StatementTreasuryListResponse) RawJSON added in v0.4.1

Returns the unmodified JSON received from the API

func (*StatementTreasuryListResponse) UnmarshalJSON added in v0.4.1

func (r *StatementTreasuryListResponse) UnmarshalJSON(data []byte) error

type StatementTreasuryListResponseDocumentType added in v0.4.1

type StatementTreasuryListResponseDocumentType string

Type of document (e.g. monthly statement, trade confirmation, tax form)

const (
	StatementTreasuryListResponseDocumentTypeMonthlyStatement  StatementTreasuryListResponseDocumentType = "MonthlyStatement"
	StatementTreasuryListResponseDocumentTypeTradeConfirmation StatementTreasuryListResponseDocumentType = "TradeConfirmation"
	StatementTreasuryListResponseDocumentType1099              StatementTreasuryListResponseDocumentType = "1099"
	StatementTreasuryListResponseDocumentType1099R             StatementTreasuryListResponseDocumentType = "1099R"
	StatementTreasuryListResponseDocumentType1042S             StatementTreasuryListResponseDocumentType = "1042S"
	StatementTreasuryListResponseDocumentType5498              StatementTreasuryListResponseDocumentType = "5498"
	StatementTreasuryListResponseDocumentType5498Esa           StatementTreasuryListResponseDocumentType = "5498ESA"
	StatementTreasuryListResponseDocumentType1099Q             StatementTreasuryListResponseDocumentType = "1099Q"
	StatementTreasuryListResponseDocumentTypeFmv               StatementTreasuryListResponseDocumentType = "FMV"
	StatementTreasuryListResponseDocumentTypeSdira             StatementTreasuryListResponseDocumentType = "SDIRA"
)

type StatementTreasuryService added in v0.4.1

type StatementTreasuryService struct {
	Options []option.RequestOption
}

Manage treasury accounts and transactions

StatementTreasuryService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewStatementTreasuryService method instead.

func NewStatementTreasuryService added in v0.4.1

func NewStatementTreasuryService(opts ...option.RequestOption) (r StatementTreasuryService)

NewStatementTreasuryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*StatementTreasuryService) List added in v0.4.1

Retrieve a paginated list of statements for a specific treasury account. Supports cursor-based pagination and filtering by document type.

func (*StatementTreasuryService) ListAutoPaging added in v0.4.1

Retrieve a paginated list of statements for a specific treasury account. Supports cursor-based pagination and filtering by document type.

type SwiftBankAccountType

type SwiftBankAccountType string
const (
	SwiftBankAccountTypeChecking SwiftBankAccountType = "checking"
	SwiftBankAccountTypeSavings  SwiftBankAccountType = "savings"
)

type TaxFormType

type TaxFormType string
const (
	TaxFormTypeW9      TaxFormType = "w9"
	TaxFormTypeW8Ben   TaxFormType = "w8BEN"
	TaxFormTypeW8Bene  TaxFormType = "w8BENE"
	TaxFormTypeUnknown TaxFormType = "unknown"
)

type Transaction

type Transaction struct {
	// ID for this transaction
	ID string `json:"id" api:"required" format:"uuid"`
	// ID for a Mercury account.
	AccountID                  string                  `json:"accountId" api:"required" format:"uuid"`
	Amount                     float64                 `json:"amount" api:"required"`
	Attachments                []TransactionAttachment `json:"attachments" api:"required"`
	CompliantWithReceiptPolicy bool                    `json:"compliantWithReceiptPolicy" api:"required"`
	// ID for a Mercury account.
	CounterpartyID        string `json:"counterpartyId" api:"required" format:"uuid"`
	CounterpartyName      string `json:"counterpartyName" api:"required"`
	CreatedAt             string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	DashboardLink         string `json:"dashboardLink" api:"required"`
	EstimatedDeliveryDate string `json:"estimatedDeliveryDate" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// GL code allocations assigned to this transaction via a connected accounting
	// software integration (e.g. QuickBooks, Xero, NetSuite). Each allocation has a GL
	// code name and the amount allocated to it; amounts sum to the transaction total
	// when the transaction is fully categorized. Empty if no GL codes have been
	// assigned. Distinct from Mercury custom categories (see transactionCategoryData).
	GlAllocations       []GlAllocation `json:"glAllocations" api:"required"`
	HasGeneratedReceipt bool           `json:"hasGeneratedReceipt" api:"required"`
	// Any of "externalTransfer", "internalTransfer", "outgoingPayment",
	// "creditCardCredit", "creditCardTransaction", "debitCardCredit",
	// "debitCardTransaction", "cardInternationalTransactionFee",
	// "cardInternationalTransactionFeeRebate",
	// "cardInternationalTransactionFeeReversal",
	// "cardInternationalTransactionFeeRebateReversal", "incomingDomesticWire",
	// "checkDeposit", "incomingInternationalWire", "treasuryTransfer",
	// "currencyCloudReturn", "wireFee", "personalBankingSubscriptionFee",
	// "billingEngineSubscriptionFee", "expenseReimbursement", "exogenousWireDrawdown",
	// "other".
	Kind                TransactionKind          `json:"kind" api:"required"`
	RelatedTransactions []RelatedTransactionData `json:"relatedTransactions" api:"required"`
	// Any of "pending", "sent", "cancelled", "failed", "reversed", "blocked".
	Status          TransactionStatus `json:"status" api:"required"`
	BankDescription string            `json:"bankDescription" api:"nullable"`
	// Represents an expense category for transaction classification.
	CategoryData CategoryData `json:"categoryData" api:"nullable"`
	// Present for check deposits and mailed checks; Nothing otherwise.
	CheckNumber          string `json:"checkNumber" api:"nullable"`
	CounterpartyNickname string `json:"counterpartyNickname" api:"nullable"`
	// ID for the credit statement period
	CreditAccountPeriodID string                `json:"creditAccountPeriodId" api:"nullable" format:"uuid"`
	CurrencyExchangeInfo  CurrencyExchangeInfo  `json:"currencyExchangeInfo" api:"nullable"`
	Details               TransactionMethodData `json:"details" api:"nullable"`
	ExternalMemo          string                `json:"externalMemo" api:"nullable"`
	FailedAt              string                `json:"failedAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	// ID for this transaction
	FeeID string `json:"feeId" api:"nullable" format:"uuid"`
	// Deprecated: use transactionGlAllocations instead. This field does not reflect GL
	// codes assigned via Mercury auto-categorization rules. Preserved for backwards
	// compatibility.
	GeneralLedgerCodeName string `json:"generalLedgerCodeName" api:"nullable"`
	// Merchant information for card transactions
	Merchant MerchantData `json:"merchant" api:"nullable"`
	// Any of "Other", "Advertising", "Airlines", "AlcoholAndBars",
	// "BooksAndNewspaper", "CarRental", "Charity", "Clothing", "Conferences",
	// "Education", "Electronics", "Entertainment", "FacilitiesExpenses", "Fees",
	// "FoodDelivery", "FuelAndGas", "Gambling", "GovernmentServices", "Grocery",
	// "GroundTransportation", "Insurance", "InternetAndTelephone", "Legal", "Lodging",
	// "Medical", "Memberships", "OfficeSupplies", "OtherTravel", "Parking",
	// "Political", "ProfessionalServices", "Restaurants", "Retail",
	// "RideshareAndTaxis", "Shipping", "Software", "Taxes", "Utilities",
	// "VehicleExpenses".
	MercuryCategory  MercuryCategory `json:"mercuryCategory" api:"nullable"`
	Note             string          `json:"note" api:"nullable"`
	PostedAt         string          `json:"postedAt" api:"nullable" format:"yyyy-mm-ddThh:MM:ssZ"`
	ReasonForFailure string          `json:"reasonForFailure" api:"nullable"`
	RequestID        string          `json:"requestId" api:"nullable"`
	// Present for transactions that have tracking numbers (e.g., RTP, ACH, wires);
	// Nothing otherwise.
	TrackingNumber string `json:"trackingNumber" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                         respjson.Field
		AccountID                  respjson.Field
		Amount                     respjson.Field
		Attachments                respjson.Field
		CompliantWithReceiptPolicy respjson.Field
		CounterpartyID             respjson.Field
		CounterpartyName           respjson.Field
		CreatedAt                  respjson.Field
		DashboardLink              respjson.Field
		EstimatedDeliveryDate      respjson.Field
		GlAllocations              respjson.Field
		HasGeneratedReceipt        respjson.Field
		Kind                       respjson.Field
		RelatedTransactions        respjson.Field
		Status                     respjson.Field
		BankDescription            respjson.Field
		CategoryData               respjson.Field
		CheckNumber                respjson.Field
		CounterpartyNickname       respjson.Field
		CreditAccountPeriodID      respjson.Field
		CurrencyExchangeInfo       respjson.Field
		Details                    respjson.Field
		ExternalMemo               respjson.Field
		FailedAt                   respjson.Field
		FeeID                      respjson.Field
		GeneralLedgerCodeName      respjson.Field
		Merchant                   respjson.Field
		MercuryCategory            respjson.Field
		Note                       respjson.Field
		PostedAt                   respjson.Field
		ReasonForFailure           respjson.Field
		RequestID                  respjson.Field
		TrackingNumber             respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Transaction) RawJSON

func (r Transaction) RawJSON() string

Returns the unmodified JSON received from the API

func (*Transaction) UnmarshalJSON

func (r *Transaction) UnmarshalJSON(data []byte) error

type TransactionAttachment

type TransactionAttachment struct {
	// Any of "checkImage", "receipt", "other".
	AttachmentType TransactionAttachmentAttachmentType `json:"attachmentType" api:"required"`
	FileName       string                              `json:"fileName" api:"required"`
	URL            string                              `json:"url" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AttachmentType respjson.Field
		FileName       respjson.Field
		URL            respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TransactionAttachment) RawJSON

func (r TransactionAttachment) RawJSON() string

Returns the unmodified JSON received from the API

func (*TransactionAttachment) UnmarshalJSON

func (r *TransactionAttachment) UnmarshalJSON(data []byte) error

type TransactionAttachmentAttachParams added in v0.4.2

type TransactionAttachmentAttachParams struct {
	// The file to upload
	File io.Reader `json:"file,omitzero" api:"required" format:"binary"`
	// Type of attachment: 'receipt', 'bill', or 'other'. Defaults to 'other'.
	//
	// Any of "receipt", "bill", "other".
	AttachmentType TransactionAttachmentAttachParamsAttachmentType `json:"attachmentType,omitzero"`
	// contains filtered or unexported fields
}

func (TransactionAttachmentAttachParams) MarshalMultipart added in v0.4.2

func (r TransactionAttachmentAttachParams) MarshalMultipart() (data []byte, contentType string, err error)

type TransactionAttachmentAttachParamsAttachmentType added in v0.4.2

type TransactionAttachmentAttachParamsAttachmentType string

Type of attachment: 'receipt', 'bill', or 'other'. Defaults to 'other'.

const (
	TransactionAttachmentAttachParamsAttachmentTypeReceipt TransactionAttachmentAttachParamsAttachmentType = "receipt"
	TransactionAttachmentAttachParamsAttachmentTypeBill    TransactionAttachmentAttachParamsAttachmentType = "bill"
	TransactionAttachmentAttachParamsAttachmentTypeOther   TransactionAttachmentAttachParamsAttachmentType = "other"
)

type TransactionAttachmentAttachmentType

type TransactionAttachmentAttachmentType string
const (
	TransactionAttachmentAttachmentTypeCheckImage TransactionAttachmentAttachmentType = "checkImage"
	TransactionAttachmentAttachmentTypeReceipt    TransactionAttachmentAttachmentType = "receipt"
	TransactionAttachmentAttachmentTypeOther      TransactionAttachmentAttachmentType = "other"
)

type TransactionAttachmentService added in v0.4.2

type TransactionAttachmentService struct {
	Options []option.RequestOption
}

Manage transactions

TransactionAttachmentService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTransactionAttachmentService method instead.

func NewTransactionAttachmentService added in v0.4.2

func NewTransactionAttachmentService(opts ...option.RequestOption) (r TransactionAttachmentService)

NewTransactionAttachmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TransactionAttachmentService) Attach added in v0.4.2

Upload a file attachment to a transaction. The file is uploaded via multipart/form-data. Supported file types include PDF, images (PNG, JPG, GIF), and common document formats.

type TransactionKind

type TransactionKind string
const (
	TransactionKindExternalTransfer                              TransactionKind = "externalTransfer"
	TransactionKindInternalTransfer                              TransactionKind = "internalTransfer"
	TransactionKindOutgoingPayment                               TransactionKind = "outgoingPayment"
	TransactionKindCreditCardCredit                              TransactionKind = "creditCardCredit"
	TransactionKindCreditCardTransaction                         TransactionKind = "creditCardTransaction"
	TransactionKindDebitCardCredit                               TransactionKind = "debitCardCredit"
	TransactionKindDebitCardTransaction                          TransactionKind = "debitCardTransaction"
	TransactionKindCardInternationalTransactionFee               TransactionKind = "cardInternationalTransactionFee"
	TransactionKindCardInternationalTransactionFeeRebate         TransactionKind = "cardInternationalTransactionFeeRebate"
	TransactionKindCardInternationalTransactionFeeReversal       TransactionKind = "cardInternationalTransactionFeeReversal"
	TransactionKindCardInternationalTransactionFeeRebateReversal TransactionKind = "cardInternationalTransactionFeeRebateReversal"
	TransactionKindIncomingDomesticWire                          TransactionKind = "incomingDomesticWire"
	TransactionKindCheckDeposit                                  TransactionKind = "checkDeposit"
	TransactionKindIncomingInternationalWire                     TransactionKind = "incomingInternationalWire"
	TransactionKindTreasuryTransfer                              TransactionKind = "treasuryTransfer"
	TransactionKindCurrencyCloudReturn                           TransactionKind = "currencyCloudReturn"
	TransactionKindWireFee                                       TransactionKind = "wireFee"
	TransactionKindPersonalBankingSubscriptionFee                TransactionKind = "personalBankingSubscriptionFee"
	TransactionKindBillingEngineSubscriptionFee                  TransactionKind = "billingEngineSubscriptionFee"
	TransactionKindExpenseReimbursement                          TransactionKind = "expenseReimbursement"
	TransactionKindExogenousWireDrawdown                         TransactionKind = "exogenousWireDrawdown"
	TransactionKindOther                                         TransactionKind = "other"
)

type TransactionListParams

type TransactionListParams struct {
	// UUID of a custom category. Can be returned from /categories endpoint.
	CategoryID param.Opt[string] `query:"categoryId,omitzero" json:"-"`
	// Latest createdAt date to filter for. If it’s not provided, it defaults to
	// current day. Format: YYYY-MM-DD or an ISO 8601 string. Please note that your
	// Mercury transactions on your Dashboard might have their postedAt date displayed,
	// as opposed to createdAt
	End param.Opt[string] `query:"end,omitzero" json:"-"`
	// The ID of the transaction to end the page before (exclusive). When provided,
	// results will end just before this ID and work backwards. Use this for reverse
	// pagination or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Name of mercuryCategory you want to filter on. Merchant Type in the UI.
	MercuryCategory param.Opt[string] `query:"mercuryCategory,omitzero" json:"-"`
	// Latest postedAt date to filter for. Format: YYYY-MM-DD or an ISO 8601 string
	PostedEnd param.Opt[string] `query:"postedEnd,omitzero" json:"-"`
	// Earliest postedAt date to filter for. Format: YYYY-MM-DD or an ISO 8601 string
	PostedStart param.Opt[string] `query:"postedStart,omitzero" json:"-"`
	// Search term to look for in transaction descriptions.
	Search param.Opt[string] `query:"search,omitzero" json:"-"`
	// Earliest createdAt date to filter for. If not provided, it defaults to the date
	// of your first transaction. Format: YYYY-MM-DD or an ISO 8601 string. Please note
	// that your Mercury transactions on your Dashboard might have their postedAt date
	// displayed, as opposed to createdAt
	Start param.Opt[string] `query:"start,omitzero" json:"-"`
	// The ID of the transaction to start the page after (exclusive). When provided,
	// results will begin with the transaction immediately following this ID. Use this
	// for standard forward pagination to get the next page of results. Cannot be
	// combined with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// The ID of the resource to start the page at (inclusive). When provided, results
	// will begin with and include the resource with this ID. Use this to retrieve a
	// specific page when you know the exact starting point. Cannot be combined with
	// start_after or end_before.
	StartAt   param.Opt[string] `query:"start_at,omitzero" json:"-"`
	AccountID []string          `query:"accountId,omitzero" format:"uuid" json:"-"`
	CardID    []string          `query:"cardId,omitzero" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order TransactionListParamsOrder `query:"order,omitzero" json:"-"`
	// Any of "pending", "sent", "cancelled", "failed", "reversed", "blocked".
	Status []string `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TransactionListParams) URLQuery

func (r TransactionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TransactionListParams's query parameters as `url.Values`.

type TransactionListParamsOrder

type TransactionListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	TransactionListParamsOrderAsc  TransactionListParamsOrder = "asc"
	TransactionListParamsOrderDesc TransactionListParamsOrder = "desc"
)

type TransactionMethodData

type TransactionMethodData struct {
	Address                      AddressData                         `json:"address" api:"nullable"`
	CreditCardInfo               TransactionMethodDataCreditCardInfo `json:"creditCardInfo" api:"nullable"`
	DebitCardInfo                TransactionMethodDataDebitCardInfo  `json:"debitCardInfo" api:"nullable"`
	DomesticWireRoutingInfo      DomesticWireRoutingInfo             `json:"domesticWireRoutingInfo" api:"nullable"`
	ElectronicRoutingInfo        ElectronicRoutingInfo               `json:"electronicRoutingInfo" api:"nullable"`
	InternationalWireRoutingInfo InternationalWireRoutingInfo        `json:"internationalWireRoutingInfo" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address                      respjson.Field
		CreditCardInfo               respjson.Field
		DebitCardInfo                respjson.Field
		DomesticWireRoutingInfo      respjson.Field
		ElectronicRoutingInfo        respjson.Field
		InternationalWireRoutingInfo respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TransactionMethodData) RawJSON

func (r TransactionMethodData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TransactionMethodData) UnmarshalJSON

func (r *TransactionMethodData) UnmarshalJSON(data []byte) error

type TransactionMethodDataCreditCardInfo

type TransactionMethodDataCreditCardInfo struct {
	ID            string `json:"id" api:"required" format:"uuid"`
	PaymentMethod string `json:"paymentMethod" api:"required"`
	Email         string `json:"email" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		PaymentMethod respjson.Field
		Email         respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TransactionMethodDataCreditCardInfo) RawJSON

Returns the unmodified JSON received from the API

func (*TransactionMethodDataCreditCardInfo) UnmarshalJSON

func (r *TransactionMethodDataCreditCardInfo) UnmarshalJSON(data []byte) error

type TransactionMethodDataDebitCardInfo

type TransactionMethodDataDebitCardInfo struct {
	ID string `json:"id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TransactionMethodDataDebitCardInfo) RawJSON

Returns the unmodified JSON received from the API

func (*TransactionMethodDataDebitCardInfo) UnmarshalJSON

func (r *TransactionMethodDataDebitCardInfo) UnmarshalJSON(data []byte) error

type TransactionService

type TransactionService struct {
	Options []option.RequestOption
	// Manage transactions
	Attachments TransactionAttachmentService
}

Manage transactions

TransactionService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTransactionService method instead.

func NewTransactionService

func NewTransactionService(opts ...option.RequestOption) (r TransactionService)

NewTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TransactionService) Get

func (r *TransactionService) Get(ctx context.Context, transactionID string, opts ...option.RequestOption) (res *Transaction, err error)

Retrieve a single transaction by its ID. Returns full transaction details including attachments, check images, and related metadata.

func (*TransactionService) List

Retrieve a paginated list of all transactions across all accounts. Supports advanced filtering by date ranges, status, categories, and cursor-based pagination.

func (*TransactionService) ListAutoPaging

Retrieve a paginated list of all transactions across all accounts. Supports advanced filtering by date ranges, status, categories, and cursor-based pagination.

func (*TransactionService) Update

func (r *TransactionService) Update(ctx context.Context, transactionID string, body TransactionUpdateParams, opts ...option.RequestOption) (res *Transaction, err error)

Update the note and/or category of an existing transaction. Use null values to clear existing data.

type TransactionStatus

type TransactionStatus string
const (
	TransactionStatusPending   TransactionStatus = "pending"
	TransactionStatusSent      TransactionStatus = "sent"
	TransactionStatusCancelled TransactionStatus = "cancelled"
	TransactionStatusFailed    TransactionStatus = "failed"
	TransactionStatusReversed  TransactionStatus = "reversed"
	TransactionStatusBlocked   TransactionStatus = "blocked"
)

type TransactionUpdateParams

type TransactionUpdateParams struct {
	// Note update action. Omit field to keep current note, send null or empty string
	// to clear note, send text to set note.
	Note param.Opt[string] `json:"note,omitzero" api:"required"`
	// ID for the category
	CategoryID string `json:"categoryId" api:"required" format:"uuid"`
	// contains filtered or unexported fields
}

func (TransactionUpdateParams) MarshalJSON

func (r TransactionUpdateParams) MarshalJSON() (data []byte, err error)

func (*TransactionUpdateParams) UnmarshalJSON

func (r *TransactionUpdateParams) UnmarshalJSON(data []byte) error

type TreasuryListParams

type TreasuryListParams struct {
	// The ID of the account to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the account to start the page after (exclusive). When provided,
	// results will begin with the account immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order TreasuryListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TreasuryListParams) URLQuery

func (r TreasuryListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TreasuryListParams's query parameters as `url.Values`.

type TreasuryListParamsOrder

type TreasuryListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	TreasuryListParamsOrderAsc  TreasuryListParamsOrder = "asc"
	TreasuryListParamsOrderDesc TreasuryListParamsOrder = "desc"
)

type TreasuryListResponse

type TreasuryListResponse struct {
	// ID for a Mercury account.
	ID               string  `json:"id" api:"required" format:"uuid"`
	AvailableBalance float64 `json:"availableBalance" api:"required"`
	CreatedAt        string  `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	CurrentBalance   float64 `json:"currentBalance" api:"required"`
	// Monthly net return breakdown with dividend and fee details
	NetReturns []TreasuryListResponseNetReturn `json:"netReturns" api:"required"`
	// Any of "active", "deleted", "pending", "archived".
	Status AccountStatus `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		AvailableBalance respjson.Field
		CreatedAt        respjson.Field
		CurrentBalance   respjson.Field
		NetReturns       respjson.Field
		Status           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TreasuryListResponse) RawJSON

func (r TreasuryListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TreasuryListResponse) UnmarshalJSON

func (r *TreasuryListResponse) UnmarshalJSON(data []byte) error

type TreasuryListResponseNetReturn

type TreasuryListResponseNetReturn struct {
	// List of dividends received by security
	Dividends []TreasuryListResponseNetReturnDividend `json:"dividends" api:"required"`
	// First day of the month for this net return
	Month time.Time `json:"month" api:"required" format:"date"`
	// Net return amount (dividends minus fees)
	NetAmount float64 `json:"netAmount" api:"required"`
	// Status of this net return calculation
	//
	// Any of "processing", "pending", "charged", "error".
	Status string `json:"status" api:"required"`
	// Treasury fee charged for this period (positive value)
	TreasuryFee float64 `json:"treasuryFee" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dividends   respjson.Field
		Month       respjson.Field
		NetAmount   respjson.Field
		Status      respjson.Field
		TreasuryFee respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Monthly net return breakdown for a treasury account

func (TreasuryListResponseNetReturn) RawJSON

Returns the unmodified JSON received from the API

func (*TreasuryListResponseNetReturn) UnmarshalJSON

func (r *TreasuryListResponseNetReturn) UnmarshalJSON(data []byte) error

type TreasuryListResponseNetReturnDividend

type TreasuryListResponseNetReturnDividend struct {
	// Security identifier (e.g., "617455696")
	ID string `json:"id" api:"required"`
	// Dividend amount for this security
	Amount float64 `json:"amount" api:"required"`
	// Human-readable security name (e.g., "Morgan Stanley Ultra-Short Income Portfolio
	// Class IR")
	SecurityName string `json:"securityName" api:"required"`
	// Security identifier type
	//
	// Any of "cusip".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Amount       respjson.Field
		SecurityName respjson.Field
		Type         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Dividend information for a specific treasury security

func (TreasuryListResponseNetReturnDividend) RawJSON

Returns the unmodified JSON received from the API

func (*TreasuryListResponseNetReturnDividend) UnmarshalJSON

func (r *TreasuryListResponseNetReturnDividend) UnmarshalJSON(data []byte) error

type TreasuryService

type TreasuryService struct {
	Options []option.RequestOption
}

Manage treasury accounts and transactions

TreasuryService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTreasuryService method instead.

func NewTreasuryService

func NewTreasuryService(opts ...option.RequestOption) (r TreasuryService)

NewTreasuryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TreasuryService) List

Retrieve a paginated list of all treasury accounts associated with the authenticated organization. Use cursor parameters (start_after, end_before) for pagination.

func (*TreasuryService) ListAutoPaging

Retrieve a paginated list of all treasury accounts associated with the authenticated organization. Use cursor parameters (start_after, end_before) for pagination.

func (*TreasuryService) Transactions added in v0.4.3

func (r *TreasuryService) Transactions(ctx context.Context, treasuryID string, query TreasuryTransactionsParams, opts ...option.RequestOption) (res *TreasuryTransactionsResponse, err error)

Retrieve paginated treasury transactions for a specific treasury account.

type TreasuryTransactionsParams added in v0.4.3

type TreasuryTransactionsParams struct {
	// Pagination cursor for retrieving next batch of transactions. Must be an
	// integer >= 0
	Cursor param.Opt[int64] `query:"cursor,omitzero" json:"-"`
	// Maximum number of results to return. Defaults to 100
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Sort order for transactions. Can be 'asc' or 'desc'. Defaults to 'desc'
	//
	// Any of "asc", "desc".
	Order TreasuryTransactionsParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TreasuryTransactionsParams) URLQuery added in v0.4.3

func (r TreasuryTransactionsParams) URLQuery() (v url.Values, err error)

URLQuery serializes TreasuryTransactionsParams's query parameters as `url.Values`.

type TreasuryTransactionsParamsOrder added in v0.4.3

type TreasuryTransactionsParamsOrder string

Sort order for transactions. Can be 'asc' or 'desc'. Defaults to 'desc'

const (
	TreasuryTransactionsParamsOrderAsc  TreasuryTransactionsParamsOrder = "asc"
	TreasuryTransactionsParamsOrderDesc TreasuryTransactionsParamsOrder = "desc"
)

type TreasuryTransactionsResponse added in v0.4.3

type TreasuryTransactionsResponse struct {
	// List of treasury transactions in the response
	Transactions []TreasuryTransactionsResponseTransaction `json:"transactions" api:"required"`
	// Pagination cursor for retrieving next batch of transactions
	Cursor int64 `json:"cursor" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Transactions respjson.Field
		Cursor       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response type for treasury transactions API endpoint

func (TreasuryTransactionsResponse) RawJSON added in v0.4.3

Returns the unmodified JSON received from the API

func (*TreasuryTransactionsResponse) UnmarshalJSON added in v0.4.3

func (r *TreasuryTransactionsResponse) UnmarshalJSON(data []byte) error

type TreasuryTransactionsResponseTransaction added in v0.4.3

type TreasuryTransactionsResponseTransaction struct {
	// ID for this treasury transaction
	ID string `json:"id" api:"required" format:"uuid"`
	// ID for a Mercury account.
	AccountID    string    `json:"accountId" api:"required" format:"uuid"`
	Amount       float64   `json:"amount" api:"required"`
	Balance      float64   `json:"balance" api:"required"`
	CanonicalDay time.Time `json:"canonicalDay" api:"required" format:"date"`
	Description  string    `json:"description" api:"required"`
	// Any of "depositCanceled", "depositComplete", "depositFailed", "depositReturned",
	// "mercuryFeePosted", "mercuryFeeFailed", "mercuryFeeRefunded",
	// "mercuryFeeCanceled", "withdrawalPosted", "withdrawalFailed",
	// "withdrawalCanceled", "withdrawalReturned", "revertTxn", "interestPosted",
	// "interestCanceled", "manualAmendmentPosted", "mercuryCreditPosted",
	// "mercuryCreditFailed", "dividendPosted", "dividendCanceled",
	// "dividendReinvestmentPosted", "mutualFundTradeFailed", "mutualFundTradePosted",
	// "sweepInPosted", "sweepOutPosted", "sweepReconcilePosted",
	// "valuationChangePosted", "oemsMutualFundOrderSettled",
	// "oemsMutualFundOrderCanceled", "oemsMutualFundOrderRejected".
	Type              string                                         `json:"type" api:"required"`
	AdditionalDetails string                                         `json:"additionalDetails" api:"nullable"`
	Details           TreasuryTransactionsResponseTransactionDetails `json:"details" api:"nullable"`
	Security          string                                         `json:"security" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AccountID         respjson.Field
		Amount            respjson.Field
		Balance           respjson.Field
		CanonicalDay      respjson.Field
		Description       respjson.Field
		Type              respjson.Field
		AdditionalDetails respjson.Field
		Details           respjson.Field
		Security          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Treasury transaction data for external API consumption

func (TreasuryTransactionsResponseTransaction) RawJSON added in v0.4.3

Returns the unmodified JSON received from the API

func (*TreasuryTransactionsResponseTransaction) UnmarshalJSON added in v0.4.3

func (r *TreasuryTransactionsResponseTransaction) UnmarshalJSON(data []byte) error

type TreasuryTransactionsResponseTransactionDetails added in v0.4.3

type TreasuryTransactionsResponseTransactionDetails struct {
	CreditDescription string `json:"creditDescription" api:"nullable"`
	// ID for a Mercury account.
	DepositCounterpartyID      string `json:"depositCounterpartyId" api:"nullable" format:"uuid"`
	FeeDescription             string `json:"feeDescription" api:"nullable"`
	ManualAmendmentDescription string `json:"manualAmendmentDescription" api:"nullable"`
	Security                   string `json:"security" api:"nullable"`
	SweepDirection             string `json:"sweepDirection" api:"nullable"`
	TradeAction                string `json:"tradeAction" api:"nullable"`
	// ID for a Mercury account.
	WithdrawalCounterpartyID string `json:"withdrawalCounterpartyId" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditDescription          respjson.Field
		DepositCounterpartyID      respjson.Field
		FeeDescription             respjson.Field
		ManualAmendmentDescription respjson.Field
		Security                   respjson.Field
		SweepDirection             respjson.Field
		TradeAction                respjson.Field
		WithdrawalCounterpartyID   respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TreasuryTransactionsResponseTransactionDetails) RawJSON added in v0.4.3

Returns the unmodified JSON received from the API

func (*TreasuryTransactionsResponseTransactionDetails) UnmarshalJSON added in v0.4.3

type UsState

type UsState string
const (
	UsStateAl UsState = "AL"
	UsStateAk UsState = "AK"
	UsStateAz UsState = "AZ"
	UsStateAr UsState = "AR"
	UsStateCa UsState = "CA"
	UsStateCo UsState = "CO"
	UsStateCt UsState = "CT"
	UsStateDe UsState = "DE"
	UsStateDc UsState = "DC"
	UsStateFl UsState = "FL"
	UsStateGa UsState = "GA"
	UsStateHi UsState = "HI"
	UsStateID UsState = "ID"
	UsStateIl UsState = "IL"
	UsStateIn UsState = "IN"
	UsStateIa UsState = "IA"
	UsStateKs UsState = "KS"
	UsStateKy UsState = "KY"
	UsStateLa UsState = "LA"
	UsStateMe UsState = "ME"
	UsStateMd UsState = "MD"
	UsStateMa UsState = "MA"
	UsStateMi UsState = "MI"
	UsStateMn UsState = "MN"
	UsStateMs UsState = "MS"
	UsStateMo UsState = "MO"
	UsStateMt UsState = "MT"
	UsStateNe UsState = "NE"
	UsStateNv UsState = "NV"
	UsStateNh UsState = "NH"
	UsStateNj UsState = "NJ"
	UsStateNm UsState = "NM"
	UsStateNy UsState = "NY"
	UsStateNc UsState = "NC"
	UsStateNd UsState = "ND"
	UsStateOh UsState = "OH"
	UsStateOk UsState = "OK"
	UsStateOr UsState = "OR"
	UsStatePa UsState = "PA"
	UsStateRi UsState = "RI"
	UsStateSc UsState = "SC"
	UsStateSd UsState = "SD"
	UsStateTn UsState = "TN"
	UsStateTx UsState = "TX"
	UsStateUt UsState = "UT"
	UsStateVt UsState = "VT"
	UsStateVa UsState = "VA"
	UsStateWa UsState = "WA"
	UsStateWv UsState = "WV"
	UsStateWi UsState = "WI"
	UsStateWy UsState = "WY"
)

type User

type User struct {
	// User's email address
	Email string `json:"email" api:"required"`
	// User's first name
	FirstName string `json:"firstName" api:"required"`
	// User's last name
	LastName string `json:"lastName" api:"required"`
	// User's role within the organization
	//
	// Any of "administrator", "bookkeeper", "customUser", "cardOnlyUser", "employee".
	OrganizationRole UserOrganizationRole `json:"organizationRole" api:"required"`
	// ID for the user
	UserID string `json:"userId" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Email            respjson.Field
		FirstName        respjson.Field
		LastName         respjson.Field
		OrganizationRole respjson.Field
		UserID           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details of a user within an organization.

func (User) RawJSON

func (r User) RawJSON() string

Returns the unmodified JSON received from the API

func (*User) UnmarshalJSON

func (r *User) UnmarshalJSON(data []byte) error

type UserListParams

type UserListParams struct {
	// The ID of the user to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the user to start the page after (exclusive). When provided, results
	// will begin with the user immediately following this ID. Use this for standard
	// forward pagination to get the next page of results. Cannot be combined with
	// end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order UserListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (UserListParams) URLQuery

func (r UserListParams) URLQuery() (v url.Values, err error)

URLQuery serializes UserListParams's query parameters as `url.Values`.

type UserListParamsOrder

type UserListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	UserListParamsOrderAsc  UserListParamsOrder = "asc"
	UserListParamsOrderDesc UserListParamsOrder = "desc"
)

type UserOrganizationRole

type UserOrganizationRole string

User's role within the organization

const (
	UserOrganizationRoleAdministrator UserOrganizationRole = "administrator"
	UserOrganizationRoleBookkeeper    UserOrganizationRole = "bookkeeper"
	UserOrganizationRoleCustomUser    UserOrganizationRole = "customUser"
	UserOrganizationRoleCardOnlyUser  UserOrganizationRole = "cardOnlyUser"
	UserOrganizationRoleEmployee      UserOrganizationRole = "employee"
)

type UserService

type UserService struct {
	Options []option.RequestOption
}

Manage organization team members

UserService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.

func NewUserService

func NewUserService(opts ...option.RequestOption) (r UserService)

NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*UserService) Get

func (r *UserService) Get(ctx context.Context, userID string, opts ...option.RequestOption) (res *User, err error)

Get user by ID

func (*UserService) List

func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *pagination.CursorIDUsers[User], err error)

Get all users

func (*UserService) ListAutoPaging

Get all users

type Webhook

type Webhook struct {
	// ID for the webhook
	ID string `json:"id" api:"required" format:"uuid"`
	// When the webhook was created
	CreatedAt string `json:"createdAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// The status of the webhook endpoint. 'active': delivering events normally.
	// 'paused': paused by the user. 'disabled': automatically disabled by the system
	// due to consecutive delivery failures. A disabled webhook can be reactivated by
	// updating its status to 'active'.
	//
	// Any of "active", "paused", "disabled".
	Status WebhookStatus `json:"status" api:"required"`
	// When the webhook was last updated
	UpdatedAt string `json:"updatedAt" api:"required" format:"yyyy-mm-ddThh:MM:ssZ"`
	// The URL that will receive webhook POST requests
	URL string `json:"url" api:"required"`
	// Optional array of event types this webhook is subscribed to. Nothing means all
	// events.
	//
	// Any of "transaction.created", "transaction.updated",
	// "checkingAccount.balance.updated", "savingsAccount.balance.updated",
	// "treasuryAccount.balance.updated", "investmentAccount.balance.updated",
	// "creditAccount.balance.updated".
	EventTypes []string `json:"eventTypes" api:"nullable"`
	// Optional array of resource field paths to filter events by. Nothing means no
	// filtering.
	//
	// Any of "transaction.amount", "transaction.bankDescription",
	// "transaction.categoryData", "transaction.customCategory",
	// "transaction.customCategory.id", "transaction.customCategory.name",
	// "transaction.mercuryCategory", "transaction.estimatedDeliveryDate",
	// "transaction.externalMemo", "transaction.failedAt", "transaction.note",
	// "transaction.postedAt", "transaction.reasonForFailure", "transaction.status",
	// "checkingAccount.availableBalance", "checkingAccount.currentBalance",
	// "checkingAccount.inFlightBalance", "savingsAccount.availableBalance",
	// "savingsAccount.currentBalance", "savingsAccount.inFlightBalance",
	// "treasuryAccount.availableBalance", "treasuryAccount.currentBalance",
	// "treasuryAccount.inFlightBalance", "investmentAccount.availableBalance",
	// "investmentAccount.currentBalance", "investmentAccount.inFlightBalance",
	// "creditAccount.availableBalance", "creditAccount.currentBalance",
	// "creditAccount.inFlightBalance".
	FilterPaths []string `json:"filterPaths" api:"nullable"`
	// Webhook signing secret. Only returned on creation (POST), not on GET or UPDATE
	// operations.
	Secret string `json:"secret" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		URL         respjson.Field
		EventTypes  respjson.Field
		FilterPaths respjson.Field
		Secret      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Webhook configuration details

func (Webhook) RawJSON

func (r Webhook) RawJSON() string

Returns the unmodified JSON received from the API

func (*Webhook) UnmarshalJSON

func (r *Webhook) UnmarshalJSON(data []byte) error

type WebhookListParams

type WebhookListParams struct {
	// The ID of the webhook to end the page before (exclusive). When provided, results
	// will end just before this ID and work backwards. Use this for reverse pagination
	// or to retrieve previous pages. Cannot be combined with start_after.
	EndBefore param.Opt[string] `query:"end_before,omitzero" format:"uuid" json:"-"`
	// Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// The ID of the webhook to start the page after (exclusive). When provided,
	// results will begin with the webhook immediately following this ID. Use this for
	// standard forward pagination to get the next page of results. Cannot be combined
	// with end_before.
	StartAfter param.Opt[string] `query:"start_after,omitzero" format:"uuid" json:"-"`
	// Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'
	//
	// Any of "asc", "desc".
	Order WebhookListParamsOrder `query:"order,omitzero" json:"-"`
	// Any of "active", "paused", "disabled", "deleted".
	Status []string `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WebhookListParams) URLQuery

func (r WebhookListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WebhookListParams's query parameters as `url.Values`.

type WebhookListParamsOrder

type WebhookListParamsOrder string

Sort order. Can be 'asc' or 'desc'. Defaults to 'asc'

const (
	WebhookListParamsOrderAsc  WebhookListParamsOrder = "asc"
	WebhookListParamsOrderDesc WebhookListParamsOrder = "desc"
)

type WebhookNewParams

type WebhookNewParams struct {
	// The URL to which webhook events will be delivered
	URL string `json:"url" api:"required"`
	// Optional array of event types to subscribe to. Nothing means subscribe to all
	// event types.
	//
	// Any of "transaction.created", "transaction.updated",
	// "checkingAccount.balance.updated", "savingsAccount.balance.updated",
	// "treasuryAccount.balance.updated", "investmentAccount.balance.updated",
	// "creditAccount.balance.updated".
	EventTypes []string `json:"eventTypes,omitzero"`
	// Optional array of resource field paths to filter events by. When specified,
	// webhook events will only be sent when one of these fields changes. Nothing means
	// no filtering (all events are sent).
	//
	// Any of "transaction.amount", "transaction.bankDescription",
	// "transaction.categoryData", "transaction.customCategory",
	// "transaction.customCategory.id", "transaction.customCategory.name",
	// "transaction.mercuryCategory", "transaction.estimatedDeliveryDate",
	// "transaction.externalMemo", "transaction.failedAt", "transaction.note",
	// "transaction.postedAt", "transaction.reasonForFailure", "transaction.status",
	// "checkingAccount.availableBalance", "checkingAccount.currentBalance",
	// "checkingAccount.inFlightBalance", "savingsAccount.availableBalance",
	// "savingsAccount.currentBalance", "savingsAccount.inFlightBalance",
	// "treasuryAccount.availableBalance", "treasuryAccount.currentBalance",
	// "treasuryAccount.inFlightBalance", "investmentAccount.availableBalance",
	// "investmentAccount.currentBalance", "investmentAccount.inFlightBalance",
	// "creditAccount.availableBalance", "creditAccount.currentBalance",
	// "creditAccount.inFlightBalance".
	FilterPaths []string `json:"filterPaths,omitzero"`
	// contains filtered or unexported fields
}

func (WebhookNewParams) MarshalJSON

func (r WebhookNewParams) MarshalJSON() (data []byte, err error)

func (*WebhookNewParams) UnmarshalJSON

func (r *WebhookNewParams) UnmarshalJSON(data []byte) error

type WebhookService

type WebhookService struct {
	Options []option.RequestOption
}

Manage webhooks

WebhookService contains methods and other services that help with interacting with the mercury API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookService method instead.

func NewWebhookService

func NewWebhookService(opts ...option.RequestOption) (r WebhookService)

NewWebhookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WebhookService) Delete

func (r *WebhookService) Delete(ctx context.Context, webhookEndpointID string, opts ...option.RequestOption) (err error)

Delete a webhook endpoint

func (*WebhookService) Get

func (r *WebhookService) Get(ctx context.Context, webhookEndpointID string, opts ...option.RequestOption) (res *Webhook, err error)

Retrieve details of a specific webhook endpoint by ID

func (*WebhookService) List

Retrieve a paginated list of all webhook endpoints for your organization. Supports filtering by status.

func (*WebhookService) ListAutoPaging

Retrieve a paginated list of all webhook endpoints for your organization. Supports filtering by status.

func (*WebhookService) New

func (r *WebhookService) New(ctx context.Context, body WebhookNewParams, opts ...option.RequestOption) (res *Webhook, err error)

Register a new webhook endpoint to receive event notifications

func (*WebhookService) Update

func (r *WebhookService) Update(ctx context.Context, webhookEndpointID string, body WebhookUpdateParams, opts ...option.RequestOption) (res *Webhook, err error)

Update the configuration of an existing webhook endpoint. A webhook that has been disabled due to consecutive delivery failures can be reactivated by setting its status to 'active'.

func (*WebhookService) Verify

func (r *WebhookService) Verify(ctx context.Context, webhookEndpointID string, body WebhookVerifyParams, opts ...option.RequestOption) (err error)

Send a test event to verify the webhook endpoint is properly configured and reachable. The request body accepts an optional 'eventType' field to specify which event type to test (e.g., 'transaction.created', 'transaction.updated'). If omitted from the request body, defaults to 'transaction.created'.

type WebhookStatus

type WebhookStatus string

The status of the webhook endpoint. 'active': delivering events normally. 'paused': paused by the user. 'disabled': automatically disabled by the system due to consecutive delivery failures. A disabled webhook can be reactivated by updating its status to 'active'.

const (
	WebhookStatusActive   WebhookStatus = "active"
	WebhookStatusPaused   WebhookStatus = "paused"
	WebhookStatusDisabled WebhookStatus = "disabled"
)

type WebhookUpdateParams

type WebhookUpdateParams struct {
	// The URL to which webhook events will be delivered. Omit to leave unchanged.
	URL param.Opt[string] `json:"url,omitzero"`
	// Event types to subscribe to. Send null to subscribe to all event types. Send an
	// array to subscribe to specific types. Omit to leave unchanged.
	//
	// Any of "transaction.created", "transaction.updated",
	// "checkingAccount.balance.updated", "savingsAccount.balance.updated",
	// "treasuryAccount.balance.updated", "investmentAccount.balance.updated",
	// "creditAccount.balance.updated".
	EventTypes []string `json:"eventTypes,omitzero"`
	// Resource field paths to filter events by. When specified, webhook events will
	// only be sent when one of these fields changes. Send null for no filtering. Send
	// an array to filter by specific fields. Omit to leave unchanged.
	//
	// Any of "transaction.amount", "transaction.bankDescription",
	// "transaction.categoryData", "transaction.customCategory",
	// "transaction.customCategory.id", "transaction.customCategory.name",
	// "transaction.mercuryCategory", "transaction.estimatedDeliveryDate",
	// "transaction.externalMemo", "transaction.failedAt", "transaction.note",
	// "transaction.postedAt", "transaction.reasonForFailure", "transaction.status",
	// "checkingAccount.availableBalance", "checkingAccount.currentBalance",
	// "checkingAccount.inFlightBalance", "savingsAccount.availableBalance",
	// "savingsAccount.currentBalance", "savingsAccount.inFlightBalance",
	// "treasuryAccount.availableBalance", "treasuryAccount.currentBalance",
	// "treasuryAccount.inFlightBalance", "investmentAccount.availableBalance",
	// "investmentAccount.currentBalance", "investmentAccount.inFlightBalance",
	// "creditAccount.availableBalance", "creditAccount.currentBalance",
	// "creditAccount.inFlightBalance".
	FilterPaths []string `json:"filterPaths,omitzero"`
	// Webhook status. Only 'active' and 'paused' values are allowed. Omit to leave
	// unchanged.
	//
	// Any of "active", "paused".
	Status WebhookUpdateParamsStatus `json:"status,omitzero"`
	// contains filtered or unexported fields
}

func (WebhookUpdateParams) MarshalJSON

func (r WebhookUpdateParams) MarshalJSON() (data []byte, err error)

func (*WebhookUpdateParams) UnmarshalJSON

func (r *WebhookUpdateParams) UnmarshalJSON(data []byte) error

type WebhookUpdateParamsStatus

type WebhookUpdateParamsStatus string

Webhook status. Only 'active' and 'paused' values are allowed. Omit to leave unchanged.

const (
	WebhookUpdateParamsStatusActive WebhookUpdateParamsStatus = "active"
	WebhookUpdateParamsStatusPaused WebhookUpdateParamsStatus = "paused"
)

type WebhookVerifyParams

type WebhookVerifyParams struct {
	// Optional event type to test. If not specified, defaults to transaction.created.
	//
	// Any of "transaction.created", "transaction.updated",
	// "checkingAccount.balance.updated", "savingsAccount.balance.updated",
	// "treasuryAccount.balance.updated", "investmentAccount.balance.updated",
	// "creditAccount.balance.updated".
	EventType WebhookVerifyParamsEventType `json:"eventType,omitzero"`
	// contains filtered or unexported fields
}

func (WebhookVerifyParams) MarshalJSON

func (r WebhookVerifyParams) MarshalJSON() (data []byte, err error)

func (*WebhookVerifyParams) UnmarshalJSON

func (r *WebhookVerifyParams) UnmarshalJSON(data []byte) error

type WebhookVerifyParamsEventType

type WebhookVerifyParamsEventType string

Optional event type to test. If not specified, defaults to transaction.created.

const (
	WebhookVerifyParamsEventTypeTransactionCreated              WebhookVerifyParamsEventType = "transaction.created"
	WebhookVerifyParamsEventTypeTransactionUpdated              WebhookVerifyParamsEventType = "transaction.updated"
	WebhookVerifyParamsEventTypeCheckingAccountBalanceUpdated   WebhookVerifyParamsEventType = "checkingAccount.balance.updated"
	WebhookVerifyParamsEventTypeSavingsAccountBalanceUpdated    WebhookVerifyParamsEventType = "savingsAccount.balance.updated"
	WebhookVerifyParamsEventTypeTreasuryAccountBalanceUpdated   WebhookVerifyParamsEventType = "treasuryAccount.balance.updated"
	WebhookVerifyParamsEventTypeInvestmentAccountBalanceUpdated WebhookVerifyParamsEventType = "investmentAccount.balance.updated"
	WebhookVerifyParamsEventTypeCreditAccountBalanceUpdated     WebhookVerifyParamsEventType = "creditAccount.balance.updated"
)

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

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