Mercury: Get an invoice
Mercury invoices.getInvoice: arguments, response, policy and SDK examples.
← Invoices operations · Get started
Operation mercury.getinvoice
Provider route: GET /ar/invoices/{invoiceId}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/mercury with npm, or alter-sdk-mercury with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { MercuryIntegration } from "@alter-ai/mercury";
async function execute(input: Parameters<MercuryIntegration["invoices"]["getInvoice"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new MercuryIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.invoices.getInvoice(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_mercury import MercuryIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = MercuryIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.invoices.get_invoice(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.invoiceId | string | Required within parent | ID for the invoice. Format: uuid |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Get an invoice — response body |
Referenced models: Get an invoice — response body
Schemas
Section titled “Schemas”Get an invoice — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The response type for an invoice in the api. |
achDebitEnabled | boolean | Required within parent | Whether or not the invoice can be paid via ach debit. |
amount | JSON | Required within parent | |
amount (anyOf 1) | number | Alternative | The total amount of the invoice line items plus taxes. Multiple of: 0.01 |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
canceledAt | JSON | Optional | |
canceledAt (anyOf 1) | JSON | Alternative | |
canceledAt (anyOf 1) (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
canceledAt (anyOf 1) (allOf 2) | JSON | All variants apply | The time when the invoice was canceled. |
canceledAt (anyOf 2) | null | Alternative | |
ccEmails | array | Required within parent | Emails to be CCed on invoice notifications/reminders. |
ccEmails[] | string | Each item | |
createdAt | JSON | Required within parent | |
createdAt (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
createdAt (allOf 2) | JSON | All variants apply | The timestamp when the invoice was created. |
creditCardEnabled | boolean | Required within parent | Whether or not the invoice can be paid via credit card. Requires stripe to be setup for the Mercury account. |
currencyCode | JSON | Required within parent | |
currencyCode (allOf 1) | string | All variants apply | |
currencyCode (allOf 2) | JSON | All variants apply | ISO 4217 currency code for the invoice (e.g. "USD", "EUR"). |
customerId | JSON | Required within parent | |
customerId (allOf 1) | string | All variants apply | 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. Format: uuid |
customerId (allOf 2) | JSON | All variants apply | Id of the customer the invoice was sent to. |
destinationAccountId | JSON | Required within parent | |
destinationAccountId (allOf 1) | string | All variants apply | ID for a Mercury account. Format: uuid |
destinationAccountId (allOf 2) | JSON | All variants apply | The Mercury account where invoice payments will be deposited. Use the /api/v1/accounts endpoint to list your accounts and find the corresponding id. Only checking and savings accounts are supported. |
dueDate | JSON | Required within parent | |
dueDate (allOf 1) | string | All variants apply | Format: date |
dueDate (allOf 2) | JSON | All variants apply | The due date the invoice should be paid by. |
id | JSON | Required within parent | |
id (allOf 1) | string | All variants apply | ID for the invoice. Format: uuid |
id (allOf 2) | JSON | All variants apply | The ID of the invoice. |
internalNote | JSON | Optional | |
internalNote (anyOf 1) | string | Alternative | Internal note for the invoice, visible by users in the mercury organization but not visible to payers. Maximum length: 5000 Minimum length: 1 |
internalNote (anyOf 2) | null | Alternative | |
invoiceDate | JSON | Required within parent | |
invoiceDate (allOf 1) | string | All variants apply | Format: date |
invoiceDate (allOf 2) | JSON | All variants apply | 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. |
invoiceNumber | string | Required within parent | The payer facing invoice number/identifier. Maximum length: 299 Minimum length: 1 |
lineItems | array | Required within parent | The line items for the invoice. |
lineItems[] | Model | Each item | Expand Get an invoice — response body — line Items item |
payerMemo | JSON | Optional | |
payerMemo (anyOf 1) | string | Alternative | Memo for the payer of the invoice. Maximum length: 5000 Minimum length: 1 |
payerMemo (anyOf 2) | null | Alternative | |
poNumber | JSON | Optional | |
poNumber (anyOf 1) | string | Alternative | Purchase order number for the invoice if applicable. Maximum length: 299 Minimum length: 1 |
poNumber (anyOf 2) | null | Alternative | |
servicePeriodEndDate | JSON | Optional | |
servicePeriodEndDate (anyOf 1) | JSON | Alternative | |
servicePeriodEndDate (anyOf 1) (allOf 1) | string | All variants apply | Format: date |
servicePeriodEndDate (anyOf 1) (allOf 2) | JSON | All variants apply | The end date for the service period this invoice covers, if applicable. YYYY-MM-DD |
servicePeriodEndDate (anyOf 2) | null | Alternative | |
servicePeriodStartDate | JSON | Optional | |
servicePeriodStartDate (anyOf 1) | JSON | Alternative | |
servicePeriodStartDate (anyOf 1) (allOf 1) | string | All variants apply | Format: date |
servicePeriodStartDate (anyOf 1) (allOf 2) | JSON | All variants apply | The start date for the service period this invoice covers, if applicable. YYYY-MM-DD |
servicePeriodStartDate (anyOf 2) | null | Alternative | |
slug | string | Required within parent | Public slug for an invoice. Used to construct the pay page URL as well as the URL to retrieve the PDF of the invoice. |
status | JSON | Required within parent | |
status (allOf 1) | string | All variants apply | Known values: Unpaid, Paid, Cancelled, Processing |
status (allOf 2) | JSON | All variants apply | The status of the invoice. |
updatedAt | JSON | Required within parent | |
updatedAt (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
updatedAt (allOf 2) | JSON | All variants apply | The timestamp when the invoice was updated. |
useRealAccountNumber | boolean | Required within parent | 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. |
Referenced models: Get an invoice — response body — line Items item
Get an invoice — response body — line Items item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Data for an invoice line item |
name | string | Required within parent | the name of the line item Maximum length: 299 Minimum length: 1 |
quantity | JSON | Required within parent | |
quantity (anyOf 1) | number | Alternative | the quantity of this item Format: double |
quantity (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
salesTaxRate | JSON | Optional | |
salesTaxRate (anyOf 1) | JSON | Alternative | |
salesTaxRate (anyOf 1) (anyOf 1) | number | Alternative | the sales tax applied to this item Format: double |
salesTaxRate (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
salesTaxRate (anyOf 2) | null | Alternative | |
unitPrice | JSON | Required within parent | |
unitPrice (anyOf 1) | number | Alternative | the price of one unit of the item before sales tax Multiple of: 0.01 |
unitPrice (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: mercury.getinvoice. Catalog operation: mercury:getInvoice. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.