Mercury payment and transfer APIs: internal transfers between accounts in the same org, and send-money requests that require approval.
Summary
Functions
Transfers funds between two Mercury accounts in the same org, returning
both the debit and credit legs. POST /transfer
Returns a single send-money approval request by ID.
GET /send-money-approval-requests/{id}
Returns one page of send-money approval requests.
GET /send-money-approval-requests
Creates a send-money request that requires approval before execution.
POST /request-send-money
A lazy, auto-paginating stream of every send-money approval request.
Functions
@spec create_internal_transfer( client :: Mercury.Client.t(), attrs :: map() | keyword() ) :: {:ok, Mercury.InternalTransferResponse.t()} | {:error, Exception.t()}
Transfers funds between two Mercury accounts in the same org, returning
both the debit and credit legs. POST /transfer
Mercury.Payments.create_internal_transfer(client, %{
from_account_id: checking_id,
to_account_id: savings_id,
amount: 1_000.0
})
@spec create_internal_transfer!( client :: Mercury.Client.t(), attrs :: map() | keyword() ) :: Mercury.InternalTransferResponse.t()
@spec get_approval_request(client :: Mercury.Client.t(), request_id :: String.t()) :: {:ok, Mercury.SendMoneyApprovalRequest.t()} | {:error, Exception.t()}
Returns a single send-money approval request by ID.
GET /send-money-approval-requests/{id}
@spec get_approval_request!(client :: Mercury.Client.t(), request_id :: String.t()) :: Mercury.SendMoneyApprovalRequest.t()
@spec list_approval_requests(client :: Mercury.Client.t(), opts :: keyword()) :: {:ok, Mercury.Page.t(Mercury.SendMoneyApprovalRequest.t())} | {:error, Exception.t()}
Returns one page of send-money approval requests.
GET /send-money-approval-requests
Accepts :account_id and :status filters in addition to the common
list options.
@spec list_approval_requests!(client :: Mercury.Client.t(), opts :: keyword()) :: Mercury.Page.t(Mercury.SendMoneyApprovalRequest.t())
@spec request_send_money(client :: Mercury.Client.t(), attrs :: map() | keyword()) :: {:ok, Mercury.SendMoneyApprovalRequest.t()} | {:error, Exception.t()}
Creates a send-money request that requires approval before execution.
POST /request-send-money
@spec request_send_money!(client :: Mercury.Client.t(), attrs :: map() | keyword()) :: Mercury.SendMoneyApprovalRequest.t()
@spec stream_approval_requests(client :: Mercury.Client.t(), opts :: keyword()) :: Enumerable.t()
A lazy, auto-paginating stream of every send-money approval request.