YooKassa Payment Gateway Integration with Google Sheets Logging - n8n Workflow

Automate YooKassa payments, order tracking, and transaction logging using this robust n8n workflow. This template simplifies e-commerce operations with no-code Google Sheets integration.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Online stores requiring a robust payment and tracking solution.
Sellers of digital products, services, or online courses.
Entrepreneurs utilizing web forms or Telegram bots for sales.
Users seeking powerful n8n templates to handle financial operations.


  • Anyone needing reliable, automated transaction logging in Google Sheets.

Overview

This powerful n8n workflow provides a complete, no-code infrastructure for managing online payments through the YooKassa gateway. It resolves the complexity of integrating payment processing and detailed record-keeping. The automation handles product retrieval from Google Sheets, initiates secure payments, manages payment webhooks (success and refund), and logs all critical data into dedicated Google Sheets (products, orders, transactions). This specific n8n workflow ensures high reliability through extensive validation and error handling across all steps, making it an essential n8n template for any e-commerce or digital sales operation.

How it Works

This comprehensive n8n workflow is structured around four main endpoints, each triggered by a dedicated n8n trigger Webhook node.

1. Product Retrieval Flow (/products)


  1. The Get products n8n trigger (Webhook node) initiates the flow.

  2. The Get products1 n8n node retrieves the entire product list from the designated 'products' Google Sheet.

  3. The data is passed to the Sorting by price n8n node to organize the list.

  4. The Respond Products n8n node returns the sorted product list to the requester.

2. Payment Initiation Flow (/payment)


  1. The Payment n8n trigger (Webhook node) receives the order request (containing productid, email, returnurl).

  2. The Check request values and Email validation If n8n nodes rigorously validate the input data structure and email format.

  3. The Get Product Google Sheets n8n node looks up the product details (especially the price) using the provided productid.

  4. The Check product_id If n8n node verifies the product exists.

  5. The Idempotence Key Generation Code n8n node generates a unique UUID, crucial for YooKassa API requests.

  6. The YooKassa Request HTTP Request n8n node submits the payment creation request to the YooKassa API, utilizing the retrieved product details and generated key.

  7. The Save Order Google Sheets n8n node logs the new order into the 'orders' sheet.

  8. The Respond Payment n8n node returns the payment confirmation URL provided by YooKassa to the customer.

3. YooKassa Webhook Processing (/yoomoney)


  1. The Handle YooKassa webhook n8n trigger activates upon payment or refund events from YooKassa.

  2. The Handle Events Switch n8n node routes the flow based on payment.succeeded or refund.succeeded events.

  3. For payment.succeeded: The flow validates metadata, fetches the order details using the Get Order Google Sheets n8n node, and if successful, the Save Transaction Google Sheets n8n node logs the completed payment into the 'transactions' sheet.

  4. For refund.succeeded: The flow checks if the transaction exists using the Get transaction node and then uses the Update refund status Google Sheets n8n node to change the transaction status to 'refund'.

4. Status Check Flow (/status/:id)


  1. The Status n8n trigger initiates, reading the payment ID from the URL path parameter.

  2. The YooKassa Request Status HTTP Request n8n node queries the YooKassa API for the real-time status of the provided payment ID.

  3. The Respond status n8n node returns the payment status, ID, and description to the user.

Installation Guide

To deploy this robust n8n workflow template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' button and selecting 'Import from JSON'.

  2. Configure Credentials:

Google Sheets: Set up an OAuth2 credential named 'Google Sheets account' allowing access to your Google Drive and Sheets. This credential is vital for all Google Sheets n8n node operations.
YooKassa: Set up a Basic Auth credential named 'Yookassa credential'. This requires your shopId (username) and secretKey (password) obtained from your YooKassa dashboard.

  1. Set Up Google Sheets: Ensure your Google Sheet document (linked in the configuration) contains the following sheets with matching column headers:

products: Must include columns like productid, title, and price.
orders: Used for logging customer orders (e.g., id, email, product
id, orderdatetime).
* transactions: Used for logging successful payments and refunds (e.g., id, email, product
id, transaction_status).

  1. Activate Webhooks: Once imported, activate the Get products, Payment, Handle YooKassa webhook, and Status n8n triggers to expose the required endpoints. Copy the respective webhook URLs and configure them in your frontend application or YooKassa merchant settings (for the /yoomoney endpoint).

Node Details

This n8n workflow utilizes several key n8n node types to manage the payment flow:

Webhook n8n trigger (Get products, Payment, Handle YooKassa webhook, Status): These four nodes act as external HTTP endpoints, initiating the respective workflow segments. The Payment node is crucial for receiving order requests, and the Handle YooKassa webhook receives payment confirmation/refund events.
Google Sheets n8n node (Get products_1, Get Product, Save Order, Get Order, Save Transaction, Update refund status): These nodes manage the persistent data layer. They are used for retrieving product prices (Lookup), logging new orders (Append), and updating transaction statuses (Update).
HTTP Request n8n node (YooKassa Request, YooKassa Request Status): Used to communicate directly with the external YooKassa API for initiating payments (POST) and checking real-time statuses (GET).
If n8n node (Check request values, Email validation, Validation metadata, etc.): Essential for flow control, ensuring that incoming data is complete, valid (e.g., regex for email), and that database lookups yield results before proceeding to critical API calls.
Code n8n node (Idempotence Key Generation): Executes custom JavaScript to generate a globally unique UUID string. This key is mandatory for safe, idempotent communication with the YooKassa payment API, preventing duplicate charges.
Respond To Webhook n8n node (Respond Payment, Respond Products, Handle Error...): Responsible for sending immediate HTTP responses back to the client or the YooKassa server, often carrying the confirmation URL or acknowledging receipt of a webhook event (status 200).

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by
Sergey Skorobogatov
Sergey Skorobogatov

Featured*