{"product_id":"failed-payment-retry-automation-with-webhook-http-api-sheets-gmail","title":"Failed Payment Retry Automation with Webhook, HTTP API, Sheets \u0026 Gmail","description":"\u003ch3\u003eAutomatically handle failed payments: retry on schedule and email customers when action is needed\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives failed-payment webhooks, queues retryable cases in Google Sheets, retries due payments every 15 minutes via an HTTP payment API call, and sends Gmail notifications for success, required customer action, or exhausted retries.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives and normalizes webhook events\u003c\/strong\u003e: Accepts a \u003cem\u003ePOST\u003c\/em\u003e webhook payload for a failed payment and maps it into consistent fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevents duplicate processing\u003c\/strong\u003e: Checks the \u003cstrong\u003eRetryQueue\u003c\/strong\u003e tab in Google Sheets for an existing row with the same \u003cstrong\u003eevent_id\u003c\/strong\u003e. If already processed, it stops.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eClassifies the failure reason\u003c\/strong\u003e: Determines whether the failure is \u003cem\u003eretryable\u003c\/em\u003e (scheduled with delay and max retries) or requires \u003cem\u003ecustomer action\u003c\/em\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eQueues outcomes in Google Sheets\u003c\/strong\u003e: Appends the result to the \u003cstrong\u003eRetryQueue\u003c\/strong\u003e with the proper status and timing.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNotifies via Gmail\u003c\/strong\u003e:\n    \u003cul\u003e\n      \u003cli\u003eSends an email when \u003cstrong\u003ecustomer action is required\u003c\/strong\u003e (e.g., update payment method).\u003c\/li\u003e\n      \u003cli\u003eSends an email when a \u003cstrong\u003epayment succeeds\u003c\/strong\u003e.\u003c\/li\u003e\n      \u003cli\u003eSends an email when \u003cstrong\u003eretries are exhausted\u003c\/strong\u003e (max retries reached).\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns every 15 minutes\u003c\/strong\u003e: Loads the RetryQueue, filters rows that are \u003cstrong\u003eSCHEDULED\u003c\/strong\u003e, \u003cstrong\u003edue now\u003c\/strong\u003e, and below the max retry limit, then processes each due row.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRetries via HTTP API\u003c\/strong\u003e: Calls the payment provider’s retry endpoint using HTTP, interprets the response, and updates the same Sheets row to \u003cstrong\u003eSUCCESS\u003c\/strong\u003e, schedules the next retry time, or marks \u003cstrong\u003eMAX_RETRIES_REACHED\u003c\/strong\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eReduce lost revenue by automatically retrying retryable payment failures on a 15-minute cadence.\u003c\/li\u003e\n  \u003cli\u003eSend targeted Gmail messages when a payment needs customer updates instead of wasting retries.\u003c\/li\u003e\n  \u003cli\u003eMaintain an auditable retry log using Google Sheets’ RetryQueue with event_id de-duplication.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTrigger cadence\u003c\/strong\u003e: Executes every 15 minutes to process due retries.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook handling\u003c\/strong\u003e: Webhook node receives failed-payment events and normalizes payload fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eQueueing and idempotency\u003c\/strong\u003e: Google Sheets \u003cstrong\u003eRetryQueue\u003c\/strong\u003e tab, keyed by \u003cstrong\u003eevent_id\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eControl flow\u003c\/strong\u003e: \u003cstrong\u003eif\u003c\/strong\u003e conditions and Code nodes to classify failures and schedule retry timing.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePayment retry call\u003c\/strong\u003e: \u003cstrong\u003eHTTP\u003c\/strong\u003e request to the payment provider’s retry endpoint.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEmail notifications\u003c\/strong\u003e: \u003cstrong\u003eGmail\u003c\/strong\u003e for customer updates (action required, success, retries exhausted).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWorkflow notes\u003c\/strong\u003e: Includes \u003cstrong\u003esticky note\u003c\/strong\u003e guidance; uses \u003cstrong\u003eno op\u003c\/strong\u003e where appropriate.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46146414575795,"sku":"N8N-20221","price":11.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/HDdgCnXiqbb-J8q_O78u7_6zSBszxP.png?v=1790846758","url":"https:\/\/buyflowscripts.com\/products\/failed-payment-retry-automation-with-webhook-http-api-sheets-gmail","provider":"N8N Commerce","version":"1.0","type":"link"}