Mercury: Unmatch a transaction from its bills or invoices
Mercury books.deleteBooksPaymentApplications: arguments, response, policy and SDK examples.
← Books operations · Get started
Operation mercury.deletebookspaymentapplications
Provider route: DELETE /books/line-entry/{lineEntryId}/payment-applications. 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["books"]["deleteBooksPaymentApplications"]>[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.books.deleteBooksPaymentApplications(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.books.delete_books_payment_applications(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.lineEntryId | string | Required within parent | unique id for a line entry; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
query | object | Optional | Additional keys: not allowed |
query.booksId | string | Optional | The Books instance to act on. Must be the token organization’s own instance, which it defaults to. 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 Match a transaction to bills or invoices — response body |
Referenced models: Match a transaction to bills or invoices — response body
Schemas
Section titled “Schemas”Match a transaction to bills or invoices — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The result of matching a line entry to bills or invoices, or of unmatching it. Both operations return this shape. |
bills | array | Required within parent | The bills the request matched or unmatched. Empty when it matched or unmatched invoices. |
bills[] | Model | Each item | Expand Match a transaction to bills or invoices — response body — bills item |
invoices | array | Required within parent | The invoices the request matched or unmatched. Empty when it matched or unmatched bills. |
invoices[] | Model | Each item | Expand Match a transaction to bills or invoices — response body — bills item |
lineEntry | JSON | Required within parent | |
lineEntry (allOf 1) | Model | All variants apply | Expand Match a transaction to bills or invoices — response body — line Entry The line entry after the match or unmatch |
lineEntry (allOf 2) | JSON | All variants apply | The line entry. |
Referenced models: Match a transaction to bills or invoices — response body — bills item, Match a transaction to bills or invoices — response body — line Entry The line entry after the match or unmatch
Match a transaction to bills or invoices — response body — bills item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A bill or invoice after the match or unmatch. |
amountAdjusted | JSON | Required within parent | |
amountAdjusted (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountAdjusted (allOf 2) | JSON | All variants apply | The total of the adjustments booked against it, in dollars. |
amountOutstanding | JSON | Required within parent | |
amountOutstanding (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountOutstanding (allOf 2) | JSON | All variants apply | The amount still owed, in dollars. |
amountPaid | JSON | Required within parent | |
amountPaid (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountPaid (allOf 2) | JSON | All variants apply | The total of the payments applied to it, in dollars. |
displayStatus | JSON | Required within parent | |
displayStatus (allOf 1) | string | All variants apply | Known values: open, paid, draft, cancelled, overdue, partiallyPaid, processing |
displayStatus (allOf 2) | JSON | All variants apply | The status shown in Mercury, which also tells overdue and partially paid ones apart. |
id | string | Required within parent | The ID of the bill or invoice. Format: base58 (max length 22) |
status | JSON | Required within parent | |
status (allOf 1) | string | All variants apply | Known values: open, paid, draft, cancelled, processing |
status (allOf 2) | JSON | All variants apply | The status of the bill or invoice. |
Referenced models: Create a product — response body — unit Price value
Match a transaction to bills or invoices — response body — line Entry The line entry after the match or unmatch
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The line entry after the match or unmatch. |
amount | JSON | Required within parent | |
amount (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amount (allOf 2) | JSON | All variants apply | The unsigned amount of the line entry, in dollars. |
amountAdjusted | JSON | Required within parent | |
amountAdjusted (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountAdjusted (allOf 2) | JSON | All variants apply | How much of the line entry is booked as line-level adjustments. 0 after an unmatch. |
amountApplied | JSON | Required within parent | |
amountApplied (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amountApplied (allOf 2) | JSON | All variants apply | How much of the line entry is applied to bills or invoices. 0 after an unmatch. |
id | string | Required within parent | The ID of the line entry, the one in the request path. Format: base58 (max length 22) |
journalEntryId | string | Required within parent | The ID of the line entry's journal entry. Format: base58 (max length 22) |
transactionId | JSON | Optional | |
transactionId (anyOf 1) | string | Alternative | The ID of the transaction the line entry belongs to, as `getBooksTransaction` takes it. Omitted when the line entry isn't a transaction's. |
transactionId (anyOf 2) | null | Alternative |
Referenced models: Create a product — response body — unit Price value
Create a product — response body — unit Price value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | number | Alternative | A dollar amount Format: double |
$ (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.deletebookspaymentapplications. Catalog operation: mercury:deleteBooksPaymentApplications. 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.