Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.invoiceIdstringRequired within parentID for the invoice.
Format: uuid

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get an invoice — response body

Referenced models: Get an invoice — response body

Get an invoice — response body
FieldTypePresenceDescription and constraints
$objectRootThe response type for an invoice in the api.
achDebitEnabledbooleanRequired within parentWhether or not the invoice can be paid via ach debit.
amountJSONRequired within parent
amount (anyOf 1)numberAlternativeThe total amount of the invoice line items plus taxes.
Multiple of: 0.01
amount (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
canceledAtJSONOptional
canceledAt (anyOf 1)JSONAlternative
canceledAt (anyOf 1) (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
canceledAt (anyOf 1) (allOf 2)JSONAll variants applyThe time when the invoice was canceled.
canceledAt (anyOf 2)nullAlternative
ccEmailsarrayRequired within parentEmails to be CCed on invoice notifications/reminders.
ccEmails[]stringEach item
createdAtJSONRequired within parent
createdAt (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
createdAt (allOf 2)JSONAll variants applyThe timestamp when the invoice was created.
creditCardEnabledbooleanRequired within parentWhether or not the invoice can be paid via credit card. Requires stripe to be
setup for the Mercury account.
currencyCodeJSONRequired within parent
currencyCode (allOf 1)stringAll variants apply
currencyCode (allOf 2)JSONAll variants applyISO 4217 currency code for the invoice (e.g. "USD", "EUR").
customerIdJSONRequired within parent
customerId (allOf 1)stringAll variants applyThe 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)JSONAll variants applyId of the customer the invoice was sent to.
destinationAccountIdJSONRequired within parent
destinationAccountId (allOf 1)stringAll variants applyID for a Mercury account.
Format: uuid
destinationAccountId (allOf 2)JSONAll variants applyThe 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.
dueDateJSONRequired within parent
dueDate (allOf 1)stringAll variants applyFormat: date
dueDate (allOf 2)JSONAll variants applyThe due date the invoice should be paid by.
idJSONRequired within parent
id (allOf 1)stringAll variants applyID for the invoice.
Format: uuid
id (allOf 2)JSONAll variants applyThe ID of the invoice.
internalNoteJSONOptional
internalNote (anyOf 1)stringAlternativeInternal 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)nullAlternative
invoiceDateJSONRequired within parent
invoiceDate (allOf 1)stringAll variants applyFormat: date
invoiceDate (allOf 2)JSONAll variants applyThe 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.
invoiceNumberstringRequired within parentThe payer facing invoice number/identifier.
Maximum length: 299
Minimum length: 1
lineItemsarrayRequired within parentThe line items for the invoice.
lineItems[]ModelEach itemExpand Get an invoice — response body — line Items item
payerMemoJSONOptional
payerMemo (anyOf 1)stringAlternativeMemo for the payer of the invoice.
Maximum length: 5000
Minimum length: 1
payerMemo (anyOf 2)nullAlternative
poNumberJSONOptional
poNumber (anyOf 1)stringAlternativePurchase order number for the invoice if applicable.
Maximum length: 299
Minimum length: 1
poNumber (anyOf 2)nullAlternative
servicePeriodEndDateJSONOptional
servicePeriodEndDate (anyOf 1)JSONAlternative
servicePeriodEndDate (anyOf 1) (allOf 1)stringAll variants applyFormat: date
servicePeriodEndDate (anyOf 1) (allOf 2)JSONAll variants applyThe end date for the service period this invoice covers, if applicable. YYYY-MM-DD
servicePeriodEndDate (anyOf 2)nullAlternative
servicePeriodStartDateJSONOptional
servicePeriodStartDate (anyOf 1)JSONAlternative
servicePeriodStartDate (anyOf 1) (allOf 1)stringAll variants applyFormat: date
servicePeriodStartDate (anyOf 1) (allOf 2)JSONAll variants applyThe start date for the service period this invoice covers, if applicable. YYYY-MM-DD
servicePeriodStartDate (anyOf 2)nullAlternative
slugstringRequired within parentPublic slug for an invoice. Used to construct the pay page URL
as well as the URL to retrieve the PDF of the invoice.
statusJSONRequired within parent
status (allOf 1)stringAll variants applyKnown values: Unpaid, Paid, Cancelled, Processing
status (allOf 2)JSONAll variants applyThe status of the invoice.
updatedAtJSONRequired within parent
updatedAt (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
updatedAt (allOf 2)JSONAll variants applyThe timestamp when the invoice was updated.
useRealAccountNumberbooleanRequired within parentWhether 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
FieldTypePresenceDescription and constraints
$objectRootData for an invoice line item
namestringRequired within parentthe name of the line item
Maximum length: 299
Minimum length: 1
quantityJSONRequired within parent
quantity (anyOf 1)numberAlternativethe quantity of this item
Format: double
quantity (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
salesTaxRateJSONOptional
salesTaxRate (anyOf 1)JSONAlternative
salesTaxRate (anyOf 1) (anyOf 1)numberAlternativethe sales tax applied to this item
Format: double
salesTaxRate (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
salesTaxRate (anyOf 2)nullAlternative
unitPriceJSONRequired within parent
unitPrice (anyOf 1)numberAlternativethe price of one unit of the item before sales tax
Multiple of: 0.01
unitPrice (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$

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.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.