Auto-send Adyen payment links for Airtable invoices

By General Input

Every 15 minutes, generate an Adyen payment link for every ready invoice in Airtable, save it to the row, and email the customer.

Integrations

  • Adyen
  • Airtable
  • Gmail

Type

Deterministic Code

Categories

  • Finance
  • Operations

Build a deterministic code workflow that sweeps my Airtable 'Invoices' table every 15 minutes and generates Adyen payment links for any new invoices that do not yet have one. Trigger: cron, every 15 minutes.

My Airtable 'Invoices' table has columns for customer name, customer email, amount, currency, description, Status, Payment Link, and Payment Link ID. Ready-to-send invoices have Status = 'Ready' and an empty Payment Link column.

Step 1: Call Airtable List Records on the 'Invoices' table with a filterByFormula that selects rows where {Payment Link} is empty and {Status} = 'Ready'. Handle Airtable pagination via the offset parameter until all matching rows have been fetched.

Step 2: For each returned row, skip it if the customer email field is missing or does not look like a valid email address. Then call Adyen Create Payment Link with the row's amount, currency, and description. The Adyen amount object must use minor units — multiply two-decimal currencies (USD, EUR, GBP, etc.) by 100 and round to an integer, use whole numbers for zero-decimal currencies like JPY, and multiply three-decimal currencies like BHD by 1000. Set the Adyen reference field to the Airtable record ID so a downstream reconciliation step can match paid links back to invoices. Include the merchantAccount from configuration in the request body.

Step 3: Call Airtable Update Record on the same row to write the returned Adyen payment URL into the Payment Link column, the returned Adyen link id into the Payment Link ID column, and flip Status to 'Sent'. Do this before sending the email so a downstream email failure never causes the same link to be generated twice on the next sweep.

Step 4: Call Gmail Send a Message to the customer's email with a short subject like 'Your invoice from {business name}' and a body that includes the customer name, the invoice description, the amount and currency, and the payment link URL. If the Gmail send fails for a single row, log the error and continue processing the rest of the batch rather than aborting the whole run.

The workflow should be idempotent: rows that already have a Payment Link or are not in Status 'Ready' must never be re-processed. Every step is a known node, so build this as deterministic code with no reasoning.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findCandidate rediscovery desk for your archived Lever applicantsLaytime and demurrage claim workspace for chartering opsKajabi customer support console for member access fixesRun your application review round on Jotform submissionsCreator roster board for rebook, test, or pause callsRun your nutrition clients' weekly meal plans from one consoleReplace the dispatch whiteboard with a live production board