The Mercury Recipients API — payment recipients and their tax form attachments.
Summary
Functions
Creates a new recipient. attrs accepts snake_case keys, e.g.
Deletes a recipient. DELETE /recipients/{id}
Returns a single recipient by ID. GET /recipients/{id}
Returns one page of recipients. GET /recipients
Returns one page of org-wide recipient tax form attachments. GET /recipients/attachments
A lazy, auto-paginating stream of every recipient.
A lazy, auto-paginating stream of every org-wide recipient tax form attachment.
Updates an existing recipient. PUT /recipients/{id}
Uploads a tax form attachment for a recipient. POST /recipients/{id}/attachments
Functions
@spec create(client :: Mercury.Client.t(), attrs :: map() | keyword()) :: {:ok, Mercury.Recipient.t()} | {:error, Exception.t()}
Creates a new recipient. attrs accepts snake_case keys, e.g.:
Mercury.Recipients.create(client, %{
name: "Acme Inc",
emails: ["ap@acme.com"],
electronic_routing_info: %{
account_number: "000123456789",
routing_number: "021000021",
electronic_account_type: :businessChecking,
address: %{...}
}
})POST /recipients
@spec create!(client :: Mercury.Client.t(), attrs :: map() | keyword()) :: Mercury.Recipient.t()
@spec delete(client :: Mercury.Client.t(), recipient_id :: String.t()) :: :ok | {:error, Exception.t()}
Deletes a recipient. DELETE /recipients/{id}
@spec delete!(client :: Mercury.Client.t(), recipient_id :: String.t()) :: :ok
@spec get(client :: Mercury.Client.t(), recipient_id :: String.t()) :: {:ok, Mercury.Recipient.t()} | {:error, Exception.t()}
Returns a single recipient by ID. GET /recipients/{id}
@spec get!(client :: Mercury.Client.t(), recipient_id :: String.t()) :: Mercury.Recipient.t()
@spec list(client :: Mercury.Client.t(), opts :: keyword()) :: {:ok, Mercury.Page.t(Mercury.Recipient.t())} | {:error, Exception.t()}
Returns one page of recipients. GET /recipients
@spec list!(client :: Mercury.Client.t(), opts :: keyword()) :: Mercury.Page.t(Mercury.Recipient.t())
@spec list_attachments(client :: Mercury.Client.t(), opts :: keyword()) :: {:ok, Mercury.Page.t(Mercury.RecipientAttachment.t())} | {:error, Exception.t()}
Returns one page of org-wide recipient tax form attachments. GET /recipients/attachments
@spec list_attachments!(client :: Mercury.Client.t(), opts :: keyword()) :: Mercury.Page.t(Mercury.RecipientAttachment.t())
@spec stream(client :: Mercury.Client.t(), opts :: keyword()) :: Enumerable.t()
A lazy, auto-paginating stream of every recipient.
@spec stream_attachments(client :: Mercury.Client.t(), opts :: keyword()) :: Enumerable.t()
A lazy, auto-paginating stream of every org-wide recipient tax form attachment.
@spec update( client :: Mercury.Client.t(), recipient_id :: String.t(), attrs :: map() | keyword() ) :: {:ok, Mercury.Recipient.t()} | {:error, Exception.t()}
Updates an existing recipient. PUT /recipients/{id}
@spec update!( client :: Mercury.Client.t(), recipient_id :: String.t(), attrs :: map() | keyword() ) :: Mercury.Recipient.t()
@spec upload_attachment( client :: Mercury.Client.t(), recipient_id :: String.t(), filename :: String.t(), content :: binary() ) :: {:ok, Mercury.RecipientAttachment.t()} | {:error, Exception.t()}
Uploads a tax form attachment for a recipient. POST /recipients/{id}/attachments
@spec upload_attachment!( client :: Mercury.Client.t(), recipient_id :: String.t(), filename :: String.t(), content :: binary() ) :: Mercury.RecipientAttachment.t()