Jump to
↵select↑↓navigateescclose

Configuration

Every field of Mercury Settings, the Mercury token each feature needs, the roles the app checks, and everything the app adds to a site.

Updated
On this page

Everything the app does is set in Mercury Settings (search for it in the awesome bar). This page describes each field in the order the form shows it, then the roles the app checks and everything it adds to your site.

Mercury Settings with sandbox credentials, automatic sync and auto journal entries turned on, and the Mercury menu open

Set up in order

  1. Set the Company and an API Token (or tick Use Sandbox and set a Sandbox API Token), tick Enabled and save. Saving checks the token against Mercury.

  2. Choose Mercury → Sync Accounts to create or adopt the Bank Accounts. See Bank sync.

  3. On production, choose Mercury → Register Webhook. Mercury's sandbox has no webhooks, so skip this there.

  4. Choose Mercury → Backfill Transactions for the history you want, and tick Automatic Transaction Sync for the hourly import.

  5. Turn on the parts you want: automatic journal entries, the invoicing gateway and payouts. Each page lists what it needs first.

  6. Put the people who should hear about failures in Alert Recipients.

The Mercury menu appears once Enabled is saved.

Mercury Settings

Credentials

FieldWhat it doesDefault
EnabledTurns the whole integration on. With it unticked, every scheduled job returns at once and the Mercury menu is hidden.Off
Use SandboxTalks to Mercury's sandbox instead of production, with the Sandbox API Token.Off
CompanyThe ERPNext company whose accounts the app books to. Required when Enabled is ticked.
API TokenThe production token, shown when Use Sandbox is unticked. Stored encrypted.
Sandbox API TokenThe sandbox token, shown when Use Sandbox is ticked. Stored encrypted.

Saving with Enabled ticked lists your Mercury accounts once to check the token. A token Mercury refuses stops the save with "Mercury API token validation failed", followed by Mercury's answer.

Transaction Sync

FieldWhat it doesDefault
Automatic Transaction SyncImports the transactions of every Mercury Bank Account each hour.Off
Sync Start DateHow far back the first sync of a Bank Account reaches. Later syncs start 3 days before the account's last imported date.12 months back
Create Pending TransactionsCreates a draft Bank Transaction for a pending Mercury transaction, and submits it once Mercury posts it. Unticked, pending transactions wait until they post.Off

Events & Webhook

These fields are read-only. Register Webhook fills them in.

FieldWhat it shows
Webhook Endpoint IDThe id of the endpoint registered in Mercury.
Webhook Signing SecretThe secret Mercury signs deliveries with. Mercury returns it only when the endpoint is created, so it is stored then.
Webhook StatusThe endpoint's status in Mercury, refreshed by the daily health check.
Events Last Polled AtWhen the 15-minute poll last ran.

GL Codes

This section has no fields. It explains that Mercury GL codes map to ERPNext accounts by exact Account Name, and that Mercury → Export GL Codes produces the file to upload. See Export your accounts as GL codes.

Auto Journal

FieldWhat it doesDefault
Enable Auto Journal EntriesBooks a Journal Entry for each GL-coded transaction and reconciles it.Off
Require AttachmentBooks only transactions that have a receipt attached in Mercury.On
Maximum AmountLeaves transactions above this amount for you to book by hand. Zero means no limit.0
Daily Backfill (Days)How many days back the daily sweep re-checks unreconciled transactions for a GL code added after the sync. Zero turns the sweep off.90
Auto Reconcile Internal TransfersBooks a Bank Entry for each transfer between two Mercury accounts and reconciles both sides. It works whether or not Enable Auto Journal Entries is ticked.On
Default Cost CenterThe cost center for income and expense lines. Only non-group cost centers of the company can be picked. Empty, the company's default cost center is used when it is not a group.

Require Attachment, Maximum Amount, Daily Backfill (Days) and Default Cost Center are shown only when Enable Auto Journal Entries is ticked.

Accounts Receivable Gateway

Shown fields depend on Enable AR Gateway.

FieldWhat it doesDefault
Enable AR GatewayRegisters Mercury as a payment gateway when you save, and turns on invoice creation, polling and funding.Off
Destination Bank AccountThe Mercury Bank Account that receives invoice payments. It must have been through Sync Accounts. Required when the gateway is on.
AR Clearing AccountThe account paid invoices are booked to until the money reaches the bank. It becomes the payment account of the Mercury Payment Gateway Account. Required when the gateway is on.
Invoice Email SenderERP sends ERPNext's Payment Request email with the pay link; Mercury asks Mercury to email its own invoice. See Who emails the customer.ERP
Accept ACH DebitOffers bank payment on the Mercury pay page.On
Accept Credit CardOffers card payment on the Mercury pay page.Off
Show Real Account NumberSent to Mercury as useRealAccountNumber when the invoice is created, so the invoice shows the account's real number.Off
Card Fees AccountThe expense account for the card fees Mercury takes off a card payment. Shown when Accept Credit Card is ticked.

Overdue Reminders

Shown when Enable AR Gateway is ticked. Reminder Interval (Days) and Maximum Reminders are shown only when Send Overdue Reminders is ticked.

FieldWhat it doesDefault
Send Overdue RemindersRe-sends the Payment Request email for overdue unpaid invoices daily.On
Reminder Interval (Days)The least number of days between two reminders. Zero means 7.7
Maximum RemindersHow many reminders a Payment Request gets in all. Zero means 3.3

Payouts

FieldWhat it doesDefault
Enable PayoutsTurns on Pay via Mercury, the approval poll, the daily invite check and payout reconciliation.Off
Payout ModeRequest Approval queues each payment in Mercury for a second user to approve. Direct Send sends it at once.Request Approval
Auto Reconcile PayoutsReconciles each payout's Bank Transaction with its Payment Entry or payroll Journal Entry.On
Payroll Funding Bank AccountThe Mercury Bank Account payroll is paid from.
Vendor Funding Bank AccountThe Mercury Bank Account supplier payments are paid from.

The other fields are shown only when Enable Payouts is ticked. The payee buttons on Employee and Supplier work without it: they need only Enabled.

Notifications

FieldWhat it does
Alert RecipientsEmail addresses, separated by commas or line breaks, that receive an alert when a sync, booking, invoice or payout fails. Empty, no alert is sent.

Alerts go out through the site's outgoing email with a subject that starts with [Mercury]. Failures are also written to the Error Log.

Mercury API tokens

  • A read-only token is enough for bank sync, automatic journal entries and invoice polling.

  • Creating invoices needs a read-write or custom-scoped token.

  • Direct Send needs a read-write token and the server's fixed outgoing IP address on Mercury's allow list. Request Approval needs neither, but a second Mercury user approves each payment in Mercury.

Token scopes are Mercury's own and can change; check them in Mercury's API token settings.

Roles the app checks

ActionWho may do it
Open and change Mercury Settings, Backfill TransactionsSystem Manager, Accounts Manager
Sync Accounts, Export GL CodesSystem Manager, Accounts Manager
Register Webhook, Replay EventsSystem Manager
Recreate Mercury Invoice on a Payment RequestSystem Manager, Accounts Manager
Pay via Mercury on a Payroll EntrySystem Manager, HR Manager, Payroll Manager, Accounts Manager
Pay via Mercury on a Payment EntrySystem Manager, Accounts Manager
The Mercury buttons on Employee and Supplier, link_existing_recipientsSystem Manager, HR Manager, Accounts Manager
Re-run a failed event (retry_event)System Manager, Accounts Manager

Anyone else who presses one of these buttons gets a permission error. The scheduled jobs and the webhook do their bookings as Administrator.

What the app adds to your site

DocTypes

DocTypeKindPurpose
Mercury SettingsSingleThe settings above. It is also the payment gateway controller ERPNext calls for the Mercury gateway.

Custom fields

All are read-only and are not copied when you duplicate a document.

DocTypeFieldsHolds
Bank AccountMercury Account IDThe Mercury account the Bank Account stands for. ERPNext's integration_id is left to Plaid.
CustomerMercury Customer IDThe Mercury invoicing customer.
EmployeeA Mercury Direct Deposit section with Mercury Recipient ID, Mercury Recipient Status and a hidden Mercury Invite IDThe Mercury payee and its state: Invite Sent, Active or Disabled.
SupplierA Mercury Payments section with the same three fieldsAs for Employee.
Payment RequestMercury Invoice ID, Mercury Reminders Sent, Mercury Last Reminder OnThe Mercury invoice and its reminders. The pay link is in ERPNext's Payment URL.
Payment Entry, Salary SlipMercury Transaction ID, Mercury Payment Status and a hidden Mercury Approval Request IDThe state of a payout. See Payout statuses.

Bank Transactions need no field of their own: the Mercury transaction id goes in ERPNext's Transaction ID.

Document events and form scripts

DocTypeWhat the app adds
Bank TransactionOn submit: books the funding Journal Entry for a paid invoice's deposit, and reconciles a payout's withdrawal.
Payment RequestOn cancel: cancels the unpaid Mercury invoice, or stops the cancel while its payment is processing or paid. Form: Mercury → Recreate Mercury Invoice.
Salary SlipOn cancel: stops the cancel while a Mercury payout is in flight.
Payroll EntryForm: Mercury → Pay via Mercury.
Payment EntryForm: Mercury → Pay via Mercury.
Employee, SupplierForm: Mercury → Send Mercury Invite, Match Mercury Contact, Refresh from Mercury, Enter Bank Details Directly.

The app does not override or extend any standard DocType class.

Scheduled jobs

Every job returns at once unless Enabled is ticked, and each checks its own switch too.

WhenJobAlso needs
Every 15 minutesPoll Mercury's events API
Every 15 minutesPoll open Mercury invoices and move their Payment Requests onEnable AR Gateway
Every 15 minutesPoll payments waiting for approval in MercuryEnable Payouts
HourlyRetry invoice creation for Payment Requests that have no Mercury invoiceEnable AR Gateway
Hourly (long)Sync the transactions of every Mercury Bank AccountAutomatic Transaction Sync
DailyRe-check unreconciled transactions for a late GL codeEnable Auto Journal Entries, Daily Backfill (Days) above zero
DailyCheck the webhook and reactivate it if Mercury turned it offA registered webhook
DailySend overdue invoice remindersEnable AR Gateway, Send Overdue Reminders
DailyPick up completed payee invitesEnable Payouts
DailyReconcile payouts whose Bank Transaction landed before their voucher existedEnable Payouts, Auto Reconcile Payouts

Records created on use

RecordCreated by
Bank Mercury, Bank Accounts, GL accountsSync Accounts
Payment Gateway Mercury and its Payment Gateway AccountSaving Mercury Settings with Enable AR Gateway ticked
Bank TransactionsThe transaction sync, the webhook and the poll
Journal Entries, Payment EntriesAutomatic journal entries, internal transfers, invoice settlement and funding
Integration Requests (service Mercury)Every inbound event and every payout attempt
FilesReceipts copied from Mercury, attached as private files

Whitelisted endpoints

EndpointUsed by
mercury_banking_integration.webhooks.webhookMercury. Guest, POST only, and refused without a valid Mercury-Signature.
sync.accounts.sync_mercury_accountsSync Accounts
sync.events.register_webhook_endpoint, sync.events.retry_eventRegister Webhook; re-running a failed event
sync.gl_codes.preview_gl_codes, sync.gl_codes.export_gl_codesExport GL Codes
ar.invoices.recreate_mercury_invoiceRecreate Mercury Invoice
payouts.payroll.get_payroll_payout_preview, payouts.payroll.initiate_payroll_payoutsPay via Mercury on a Payroll Entry
payouts.vendor.pay_payment_entry_via_mercuryPay via Mercury on a Payment Entry
payouts.recipients.send_invite, refresh_recipient, create_recipient_directly, list_unmatched_recipients, match_recipient, link_existing_recipientsThe Employee and Supplier buttons, and bulk matching

The paths in the first column after the first row are relative to mercury_banking_integration.. Mercury Settings also has four whitelisted document methods behind its menu: sync_accounts_now, backfill_transactions, register_webhook and replay_events.