A payment-invoice issuing system and method based on aggregated payment

CN122989231APending Publication Date: 2026-10-27JINCAI SHUKE (BEIJING) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611237297.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-14
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

三类通道接口协议、签名加密规则、商户认证体系、交易数据关联字段相互独立,不存在统一兼容标准,商户若同时使用多种支付方式,需要分别对接多个乐企通道,每个通道的接口规范、认证方式、数据格式各不相同,开发和维护成本高昂,难以满足"支付即开票"对实时性和多通道并发的要求

Benefits of technology

[0067]本发明提供的基于聚合支付的支付即开票系统及方法在支付回调到达的瞬间自动获取交易数据并触发开票,消费者在支付成功页面即可看到开票结果,不需额外操作,与现有的独立开票系统相比,真正实现"支付完成即开票完成",实现"支付即开票"无感体验;通过统一路由映射表自动选择通道,商户不需关心底层通道差异,一次接入即可支持多种支付方式的即开票,与分别对接多个乐企通道的方案相比,显著降低了开发和维护成本;根据实际付款方式路由至对应乐企通道,每笔交易均可关联原始支付数据进行验证,通道匹配更精准,与统一走单一通道的聚合开票服务相比,开票准确性和合规性更高;本发明支持多维度自定义配置,开票配置更灵活,企业可根据门店和品类灵活设置默认开票项目,与固定开票项目的现有系统相比,"支付即开票"场景下自动开票内容更准确;本发明支持邮件、短信、APP三种交付渠道,自动推荐交付方式,发票即时交付更便捷,在"支付即开票"模式下发票即时送达,与现有单一交付方式的系统相比,送达率和用户满意度更高;本发明支持基于历史支付记录一键补开和换开,并支持批量换开,与人工查找凭证、手动录入信息的现有方式相比,使"先付后开"场景可获得与"支付即开票"等效的便捷体验,大幅提升了消费者满意度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989231A_ABST
    Figure CN122989231A_ABST
Patent Text Reader

Abstract

The application provides a payment and invoice opening system and method based on aggregated payment, and relates to the technical fields of tax digitization and aggregated payment. The system comprises a front-end aggregated payment integration module, an invoice opening configuration management module, a back-end intelligent invoice opening routing module, an invoice delivery module, a bill replacement module, and a message queue service. The front-end aggregated payment integration module encapsulates multi-channel payment SDK, and the payment callback instantaneously analyzes transaction data and issues an invoice opening task. The invoice opening configuration management module constructs invoice opening template matching rules, and matches tax classification codes and tax rates. The intelligent invoice opening routing module has a built-in mapping relationship between payment channels and Lekai channels. The invoice delivery module adaptively selects multi-channel instant delivery of invoices and tracks the delivery status. The bill replacement module reuses the underlying routing and configuration engine underlying capabilities to realize one-key replacement of historical bills, red replacement, and batch invoice opening. The system realizes a non-invasive experience of payment and invoice opening, ensures tax compliance of invoice opening business, and stable operation in high-concurrency scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of tax digitization and aggregated payment technology; in particular, it relates to a payment invoicing method and system that adapts to multi-channel aggregated payment and achieves automated transaction closed-loop through the tax enterprise direct connection channel; more specifically, it relates to a payment invoicing system and method based on aggregated payment. Background Technology

[0002] The fully digital electronic invoice (hereinafter referred to as "digital invoice") is an important vehicle for the State Taxation Administration to promote the reform of digital tax collection and management. Digital invoices eliminate the need for traditional tax control equipment and paper invoice media. Relying on the Leqi Direct Connection Open Platform, it enables enterprises to independently and in real-time issue, deliver, and cancel invoices online, reducing merchants' invoicing hardware and maintenance costs. As an official direct connection channel, the Leqi platform allows enterprise systems to connect to the tax interface to directly generate digital invoices, serving as the underlying infrastructure for the implementation of payment-based invoicing services.

[0003] With the widespread adoption of mobile payments, offline brick-and-mortar merchants and online e-commerce platforms commonly use aggregated payment models. A single POS terminal is compatible with three mainstream payment channels: WeChat Pay, Alipay, and UnionPay QuickPass, allowing consumers to freely choose their payment method. Payment and invoicing together form a complete transaction loop. Immediately issuing electronic invoices after payment is a shared need of merchants, consumers, and tax authorities, giving rise to the "payment-invoicing" business model: as consumers complete the payment process, the system automatically completes the entire process of invoice issuance, data verification, and multi-channel delivery, eliminating the need for consumers to manually scan codes, navigate to mini-programs, or repeatedly enter buyer information, achieving seamless invoicing.

[0004] Currently, each payment platform has built its own dedicated LeQi integration channel: WeChat Pay corresponds to the WeChat LeQi channel, Alipay corresponds to the Alipay LeQi channel, and UnionPay channels such as UnionPay QuickPass correspond to the UnionPay Business LeQi channel. The interface protocols, signature encryption rules, merchant authentication systems, and transaction data association fields of these three types of channels are independent and lack a unified compatibility standard. If a merchant uses multiple payment methods simultaneously, they need to connect to multiple LeQi channels separately. Each channel has different interface specifications, authentication methods, and data formats, resulting in high development and maintenance costs and making it difficult to meet the real-time and multi-channel concurrency requirements of "payment-instant invoicing."

[0005] Currently available electronic invoicing systems can be divided into three categories, none of which can fully realize true instant invoicing upon payment, and each has the following technical weaknesses:

[0006] Option 1: Independent SaaS Invoicing System: This type of system is physically isolated from the merchant's POS payment system and their data is not shared. After the merchant completes payment, the consumer needs to scan the paper invoice QR code, be redirected to a separate H5 invoicing page, and manually enter the buyer's information such as company name, taxpayer identification number, address, telephone number, and bank account number. The system connects to a single LeQi channel or traditional tax UKey to complete the invoicing. Its drawbacks are mainly manifested in:

[0007] (1) Payment and invoicing data are fragmented and cannot be automatically synchronized with core data such as transaction amount, store, and consumer category. Consumers repeatedly enter information, the operation process is lengthy, and there is no automated linkage capability of "payment and invoicing".

[0008] (2) Only a single invoicing channel is supported. When merchants receive payments through multiple payment channels, they cannot distinguish the source of the transaction and cannot associate the original transaction flow through the corresponding payment channel. The invoicing compliance verification is missing.

[0009] (3) It does not support the reissue of historical payment bills. Reissue of invoices requires manual retrieval of cash receipts and entry of transaction data line by line, which is extremely inefficient.

[0010] Option 2: Built-in invoicing plugin on a single payment platform: WeChat Pay Merchant Platform and Alipay Open Platform natively include a simplified invoicing function, which is only compatible with transactions within their own channels. The consumer's payment success page can redirect to an invoicing pop-up, achieving simplified automatic invoicing within a single channel. Its main drawbacks are:

[0011] (1) The channel is closed and incompatible with cross-payment scenarios. When merchants use WeChat, Alipay and UnionPay at the same time, they need to configure invoicing parameters and maintain merchant qualifications in three merchant back-ends respectively, which doubles the development and maintenance manpower costs.

[0012] (2) Without a unified management platform, merchants cannot uniformly configure all store invoicing items, uniformly query all channel invoicing records, and uniformly handle red-ink reversal and replacement;

[0013] (3) Without intelligent routing logic, it is impossible to achieve unified triggering of multiple payment channels and automatic invoicing of different channels, and it is impossible to form a standardized aggregated payment invoicing process.

[0014] Option 3: Third-party general aggregated invoicing service: A few third-party service providers on the market offer aggregated invoicing tools that claim to support multiple payment channels, but their underlying logic is "unified connection to a single Leqi channel," meaning all transactions are invoiced through the same channel. Its shortcomings are mainly manifested in:

[0015] (1) The channel matching logic is missing. Alipay and UnionPay transactions are forced to issue invoices through the WeChat Leqi channel, which cannot be associated with the original payment flow of the corresponding channel. The data verification of the tax side is prone to failure, and there is a risk of non-compliant invoicing.

[0016] (2) The invoicing process is asynchronous. After payment is completed, the batch processing of invoices is delayed by several minutes to several hours. It is impossible to realize instantaneous invoicing after payment callback, which does not meet the requirement of seamless real-time invoicing.

[0017] (3) The invoicing items are fixed and only support a single global tax classification code. It cannot distinguish the different configurations of stores, consumption amounts, and payment channels. Automatic invoicing is prone to problems where the product name and tax rate do not match the actual business.

[0018] (4) The invoice delivery channel is limited to SMS push links, which cannot meet the diverse receiving needs of email, APP push, payment card wallet, etc.

[0019] (5) There is a lack of standardized processes for batch reissue and red-ink reissue. Historical bill reissue relies on manual operation and there is no automated link support.

[0020] In light of the shortcomings and problems of the existing solutions, the following technical challenges urgently need to be addressed:

[0021] Payment transaction data and invoicing request data are disconnected, lacking a full-chain mechanism that automatically triggers the invoicing process the moment the payment callback arrives;

[0022] Multiple payment channels correspond to multiple independent Leqi channels. Unified access and maintenance of multiple channels are costly and lack automated intelligent routing allocation.

[0023] Invoicing items and tax classification codes are fixed globally and cannot be configured differently based on multiple dimensions such as store, amount, and payment channel, making it easy to violate regulations in automatic invoicing;

[0024] The invoice delivery channel is limited and cannot automatically match the optimal delivery method based on the information provided by the consumer.

[0025] It only supports instant invoicing during payment, and lacks standardized processes for tracing and re-issuing historical bills and automated processes for reversing invoices. The experience is poor in scenarios where payment is made first and invoicing is later.

[0026] In multi-channel concurrent scenarios, the lack of channel health checks, failure retry, and degradation fault tolerance mechanisms can easily lead to invoicing failures and order congestion during peak cashier periods with high customer traffic. Summary of the Invention

[0027] Therefore, the purpose of this invention is to develop a payment-invoicing system and method based on aggregated payment, constructing a closed-loop system for instant payment-invoicing linkage: Upon asynchronous callback from the payment channel, the system automatically captures all transaction data and automatically assembles the invoicing request, eliminating the need for consumers to manually enter transaction and buyer information, achieving a seamless "payment completed, invoicing completed" experience; it constructs a multi-channel intelligent routing engine, establishing a one-to-one mapping relationship between payment channels and dedicated enterprise channels, automatically matching invoicing channels in milliseconds, achieving a single aggregated POS entry point and compliant invoicing across different channels, reducing the development and maintenance costs for merchants integrating multiple channels; and it supports invoicing template mapping by store, transaction amount range, and payment channel, realizing a multi-dimensional flexible invoicing configuration system. It automatically matches tax classification codes, product names, and tax rates according to preset priorities to ensure the compliance and accuracy of automatically issued invoices; it is compatible with three delivery carriers: SMS, email, and APP messages, enabling multi-channel adaptive instant invoice delivery, automatically selecting the best delivery channel based on the consumer's pre-reserved information, tracking the invoice delivery status throughout the process, and automatically retrying; it covers both instant invoicing and delayed re-invoicing scenarios, enabling one-click re-invoicing of historical bills, red-ink reversal and replacement, and batch invoicing based on persistent payment transaction records, and achieving equivalent automated invoicing processes in the pre-payment, post-invoicing scenario, uniformly reusing the underlying capabilities of intelligent routing and configuration engine; it adds channel health inspection, tiered retry, and business degradation fault tolerance mechanisms to ensure the stable operation of instant payment invoicing business in peak concurrency scenarios in catering and supermarkets.

[0028] This invention provides a payment-instant-invoicing system based on aggregated payment, comprising: a front-end aggregated payment integration module, an invoicing configuration management module, a back-end intelligent invoicing routing module, an invoice delivery module, an invoice replacement module, and an underlying message queue service;

[0029] The front-end aggregated payment integration module is used to integrate the multi-channel aggregated payment SDK, receive consumer payment requests, parse asynchronous callback messages pushed by payment channels, persistently store transaction data, and send instant invoicing trigger messages to the message queue; the front-end aggregated payment integration module includes a unified payment interface encapsulation unit, a payment channel adapter unit, a callback processing center unit, and an instant invoicing trigger unit.

[0030] The invoicing configuration management module is used to store invoicing product templates, multi-dimensional invoicing matching rules, and buyer information configuration strategies. It receives calls from the instant invoicing trigger unit and matches the tax classification code, tax rate, and product name corresponding to the transaction. It includes an invoicing project template management unit, a multi-dimensional rule matching engine unit, and a buyer information strategy management unit.

[0031] The backend intelligent invoicing routing module (the core scheduling module of this system) receives invoicing requests, matches the corresponding tax enterprise direct connection channel according to the transaction payment channel identifier, and completes the issuance of digital invoices. It has a built-in enterprise channel adapter cluster unit, intelligent routing decision engine unit, fault tolerance retry and health inspection unit.

[0032] The invoice delivery module receives the invoice data and invoice file after successful invoicing, and completes the instant delivery of the invoice by matching any channel such as email, SMS or APP push according to the contact information reserved by the consumer. The delivery status is recorded throughout the process and the failed delivery task is retried.

[0033] The bill reissue module is used to retrieve historical payment transaction records, realize one-click reissue of unbilled bills, red-letter reissue of bills that have been invoiced, and batch invoicing in the merchant backend, and reuse the underlying scheduling capabilities of the billing configuration management module and the backend intelligent billing routing module.

[0034] The message queue service is used to asynchronously decouple payment callback, invoicing, and invoice delivery tasks, and to smooth out peaks in high-concurrency scenarios to avoid task blockage and loss.

[0035] Preferably, the payment channel adapter unit adopts a factory pattern to design independent adapter classes, which are adapted to WeChat, Alipay, and UnionPay QuickPass payment channels respectively. When adding a third-party payment channel, only the adapter implementation class needs to be added and registered to the factory, without modifying the core invoicing and scheduling code. The three types of Leqi channel adapters are adapted to the corresponding platform's exclusive signature authentication system: WeChat uses merchant certificate + APIv3 signature, Alipay uses RSA2 public and private key signature, and UnionPay Merchant Services uses two-way merchant certificate authentication.

[0036] Furthermore, the intelligent routing decision engine unit has a built-in static routing mapping table to establish a one-to-one correspondence between the payment channel identifier pay_channel and the dedicated enterprise channel channel_type; the mapping rules are: WXPAY corresponds to the WeChat enterprise channel, ALIPAY corresponds to the Alipay enterprise channel, and UNIONPAY corresponds to the UnionPay Business enterprise channel; the routing engine extracts the pay_channel field from the transaction record to retrieve the mapping table, and matches the corresponding enterprise adapter in milliseconds to execute invoicing.

[0037] Furthermore, the multi-dimensional rule matching engine unit supports configuring invoice template mapping rules in three dimensions: store_id, payment channel, and transaction amount. The rules are set with priority values, and the matching priority order is: payment channel exclusive rules > amount range rules > store general rules > merchant default template. The multi-dimensional rule matching engine unit filters the highest priority valid rules and retrieves the corresponding tax classification code and tax rate to assemble the invoice details.

[0038] Furthermore, the fault-tolerant retry and health inspection unit sends heartbeat detection requests to the three Leqi channels at fixed intervals. If multiple consecutive detections fail, the corresponding channel is marked as unavailable. The fault type is distinguished and a graded retry strategy is implemented: network instantaneous failure is retried 3 times, and retry is terminated if the service parameter is incorrect. When the channel is unavailable, the immediate invoicing task is stored in the delayed waiting queue, and invoices are reissued in batches after the channel is restored, realizing the service degradation to payment first and invoicing later.

[0039] Furthermore, the bill reissue module includes a historical bill retrieval unit, a single-transaction reissue unit, a red-ink reissue unit, and a batch invoicing unit; the red-ink reissue unit first calls the Leqi channel corresponding to the original transaction to issue a red-ink invoice to cancel the original blue-ink invoice, and then reissues a new digital invoice based on the consumer's updated purchaser information and invoicing details.

[0040] This invention's system can be applied to industries such as catering, retail, hotels, and healthcare that simultaneously accept multiple payment methods and require instant electronic invoice issuance. Typical scenarios include: instant invoicing after dine-in payment via QR code (consumers receive invoices immediately upon payment), instant invoicing after hotel check-out, unified "payment-and-invoicing" management for multiple chain retail stores, and bulk reissue of electronic invoices for corporate travel expenses.

[0041] Preferably, this system adopts a non-intrusive design, connecting with merchants' existing POS systems, ERP systems, and financial systems via standard RESTful APIs. It supports both SaaS cloud deployment and private deployment modes. The front-end aggregated payment SDK supports integration across multiple platforms, including mini-programs, apps, and H5, ensuring a consistent "payment and invoicing" experience across different terminal formats.

[0042] Preferably, the communication between this system and each enterprise channel adopts HTTPS + two-way certificate authentication, and the operation log is recorded throughout the process, supporting audit traceability; the purchaser information (company name, tax number, etc.) and invoice data are all encrypted during storage and transmission.

[0043] This invention also provides a payment-based instant invoicing method, applied to the payment-based instant invoicing system described above, including an instant payment-based instant invoicing main process, such as... Figure 1 As shown, the main process for instant payment and invoicing includes the following steps:

[0044] S1: When a consumer completes payment through an aggregated payment channel, the corresponding payment platform pushes an asynchronous callback message indicating successful payment.

[0045] S2: The front-end aggregated payment integration module verifies and parses callback messages, writes standardized transaction data into the payment transaction record table, and sends trigger messages to the message queue;

[0046] S3: Based on the trigger message, query the complete transaction data, and the instant invoicing trigger unit calls the invoicing configuration management module to match the corresponding invoiced commodity template, tax code, and tax rate;

[0047] S4: Assemble standardized invoicing requests based on merchant purchaser information strategies and send them to the backend intelligent invoicing routing module;

[0048] S5: The intelligent routing decision engine unit matches a dedicated Leqi channel adapter according to the transaction payment channel and calls the tax Leqi interface to issue digital invoices;

[0049] S6: After successful invoicing, update the transaction record invoicing status and push the invoice data to the invoice delivery module;

[0050] S7: The invoice delivery module adaptively matches the delivery channel, delivering electronic invoices to consumers instantly, and the payment front end simultaneously displays the invoice viewing entry.

[0051] Further, step S5 includes a smart enterprise channel routing matching sub-process, which includes:

[0052] M1: Extract the unique payment transaction record carried by the invoicing task, and query the main transaction table to obtain the pay_channel payment channel identifier;

[0053] M2: Retrieve the static route mapping table to match the corresponding Leqi channel type;

[0054] M3: Retrieve the channel health status synchronized by the scheduled inspection. If the channel is normal, execute the invoicing interface call; if the channel is faulty, store the task in the delay queue and execute the downgraded payment before invoicing.

[0055] M4: Differentiate between fault types and execute tiered retry logic. Temporary network faults can be retried up to 3 times, while errors in buyer information or tax codes will directly terminate the process.

[0056] Furthermore, the payment-based instant invoicing method also includes the process of reissuing historical bills and reversing invoices.

[0057] The process for reissuing historical bills is as follows: Consumers filter unbilled historical transactions, select single or batch bills, match the billing templates corresponding to the store and payment channel, supplement the buyer information, and then reuse the intelligent routing module to issue invoices in batches by channel.

[0058] The red-ink invoice cancellation process is as follows: Select the invoiced bill, and the system will issue a red-ink invoice through the original transaction channel to cancel the original invoice. After the consumer modifies the purchaser or invoice details, a blue-ink invoice will be reissued and the delivery will be completed.

[0059] Further, step S7 includes an adaptive invoice delivery sub-process, which includes:

[0060] D1: Read whether the consumer has manually selected an invoice delivery channel. If selected, the corresponding channel will be used for delivery.

[0061] D2: If not selected, automatic matching will be performed: if a reserved email address exists, email delivery will be prioritized; if only a mobile phone number is reserved, SMS delivery will be performed; if there is no contact information on the APP, an APP message will be pushed.

[0062] D3: If delivery fails, automatically retry up to 3 times, and record the status log of each invoice delivery throughout its entire lifecycle.

[0063] This invention constructs a fully automated payment-invoicing mechanism with instantaneous payment callback linkage. After asynchronous payment callbacks complete data parsing and storage, the invoicing task is automatically triggered immediately via a message queue, automatically synchronizing all transaction amounts, store data, and payment channel data. No manual input from consumers is required, achieving a seamless and uninterrupted closed loop between payment and invoicing, unlike existing systems where payment and invoicing are asynchronous and require manual intervention. A static intelligent routing method based on payment channel identifiers is designed to establish a one-to-one mapping between WeChat, Alipay, and UnionPay payment channels and their respective official LeQi channels. Invoicing channels are automatically allocated in milliseconds, and each transaction is invoiced through the corresponding channel to verify the original payment transaction history, resolving the dual drawbacks of separate multi-channel connections and non-compliant single-channel invoicing. A three-dimensional invoicing template priority matching mechanism based on store, payment channel, and amount range is established, with three layers of rules. The system automatically matches tax classification codes and tax rates through tiered filtering, catering to the diverse product categories and operational needs of chain stores. It addresses the technical flaw of discrepancies between automatically generated invoices and actual business operations from the ground up. A multi-carrier adaptive invoice delivery mechanism is employed, automatically selecting email, SMS, and app push notifications based on the consumer's pre-registered contact information. The system tracks delivery status throughout the process and automatically retryes, improving the instant delivery rate of invoices. It reuses the same routing and configuration engine for historical bill reissue and invoice replacement systems, ensuring that instant invoicing, delayed reissue, and invoice replacement services share the underlying routing, configuration, and delivery capabilities, achieving unified automated invoicing and accommodating both real-time transactions and post-transaction invoicing scenarios. A timed health check, tiered retry, and business degradation fault-tolerant architecture is constructed for the LeQi channel, preventing invoicing task congestion in high-concurrency POS scenarios and automatically downgrading to payment-first-invoice-later in case of channel failure, ensuring business continuity.

[0064] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the payment and invoicing method based on aggregated payment as described above.

[0065] The present invention also provides a computer device, the computer device including a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the steps of the payment and invoicing method based on aggregated payment as described above.

[0066] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0067] The payment-instant invoicing system and method based on aggregated payment provided by this invention automatically acquires transaction data and triggers invoicing the instant the payment callback arrives. Consumers can see the invoicing result on the payment success page without any additional operation. Compared with existing independent invoicing systems, it truly achieves "payment completion equals invoicing completion," realizing a seamless "payment-instant invoicing" experience. Through a unified routing mapping table, it automatically selects the channel, eliminating the need for merchants to worry about underlying channel differences. A single integration supports instant invoicing for multiple payment methods, significantly reducing development and maintenance costs compared to solutions that connect to multiple payment channels separately. Routing to the corresponding payment channel based on the actual payment method, each transaction can be verified by associating it with the original payment data, resulting in more accurate channel matching. Compared to aggregated invoicing services that uniformly use a single channel, invoicing accuracy is significantly improved. The invention offers enhanced security and compliance. It supports multi-dimensional custom configuration, allowing for more flexible invoicing options. Businesses can flexibly set default invoicing items based on store and product category. Compared to existing systems with fixed invoicing items, the automatic invoicing content is more accurate in the "pay-to-invoice" scenario. The invention supports three delivery channels: email, SMS, and APP, automatically recommending delivery methods for more convenient instant invoice delivery. In the "pay-to-invoice" mode, invoices are delivered instantly, resulting in higher delivery rates and user satisfaction compared to existing systems with a single delivery method. Furthermore, the invention supports one-click reissue and replacement based on historical payment records, and supports batch replacement. Compared to existing methods of manually searching for vouchers and manually entering information, this provides an equivalent convenient experience to "pay-to-invoice" in the "pay first, invoice later" scenario, significantly improving consumer satisfaction. Attached Figure Description

[0068] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.

[0069] In the attached diagram:

[0070] Figure 1 This is a flowchart illustrating the main steps of an instant payment and instant invoicing method based on aggregated payment according to the present invention.

[0071] Figure 2 This is a schematic diagram of the configuration of a computer device according to an embodiment of the present invention. Detailed Implementation

[0072] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and products consistent with some aspects of this disclosure as detailed in the appended claims.

[0073] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0074] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0075] The embodiments of the present invention will be described in further detail below.

[0076] This invention provides a payment-instant-invoice system based on aggregated payment (e.g., ...). Figure 1 As shown in the diagram, a layered, modular microservice architecture is adopted, including five core functional modules, an underlying support service cluster, and external third-party gateways. The five core modules are, in order: front-end aggregated payment integration module, back-end intelligent invoicing routing module, invoicing configuration management module, invoice delivery module, and bill replacement module; the underlying support services include message queue service, data persistence storage service, encryption security service, scheduled health check service, and log audit service; the external gateways include aggregated payment channel gateway, tax enterprise channel gateway, and message push gateway.

[0077] Hierarchical Relationship of Modules: The front-end aggregated payment integration module serves as the system's traffic entry point, connecting to merchant POS terminals, mini-programs, apps, and H5 front-ends, capturing payment transaction events and triggering invoicing tasks; the invoicing configuration management module provides the entire system with unified invoicing rules, product templates, and buyer information strategy configuration data; the back-end intelligent invoicing routing module is the core scheduling hub of the system, receiving invoicing tasks, completing channel matching, LeQi interface calls, failure retries, and fault tolerance degradation; the invoice delivery module receives invoice files and invoice data after successful invoicing, executes multi-channel delivery, and records delivery status; the bill re-issuance module independently handles the re-issuance of historical un-invoiced bills, the red-ink re-issuance of invoiced bills, and batch invoicing business, reusing the underlying capabilities of intelligent routing and configuration management; the underlying message queue decouples payment callbacks, invoicing, and delivery asynchronous tasks, ensuring high concurrency without order loss; the encryption security service is responsible for the encryption and decryption of buyer sensitive information, merchant keys, and transmitted messages; the scheduled inspection service monitors the online status of the three LeQi channels in real time and dynamically updates the channel availability identifier.

[0078] The specific implementation schemes for each module are as follows:

[0079] (1) The front-end aggregated payment integration module is the system front-end access layer. It uniformly encapsulates the multi-channel aggregated payment SDK, shields the differences between the underlying interfaces of WeChat Pay, Alipay and UnionPay QuickPass, and carries the pre-processing logic of payment callback parsing, transaction data persistence, instant invoicing task issuance and multi-dimensional invoicing rule matching. It includes four units: unified payment interface encapsulation unit, payment channel adapter unit, callback processing center unit and instant invoicing trigger unit.

[0080] Unified Payment Interface Encapsulation Unit:

[0081] Define a standardized, universal payment request parameter structure to expose a unified call entry point to the merchant's POS frontend. The structure fields include the merchant's unique ID (merchant_id), internal order number (order_no), total transaction amount (amount in cents), payment channel identifier (pay_channel), consumption product summary (subject), and payment result asynchronous callback address (notify_url). Internally, set a unified parameter conversion rule so that all channel frontend requests are uniformly converted to this standard structure before being distributed to the corresponding adapter.

[0082] The following is an example of the unified payment request parameter structure:

[0083] {

[0084] "merchant_id":"merchant ID",

[0085] "order_no":"order number",

[0086] "amount":10000, / / Unit: cents

[0087] "pay_channel":"WXPAY", / / Payment channel: WXPAY / ALIPAY / UNIONPAY

[0088] "subject":"food service",

[0089] "notify_url":"https: / / api.example.com / pay / notify"

[0090] }

[0091] Payment channel adapter unit:

[0092] The system employs a factory pattern to design independent adapter classes, corresponding to three channels: WeChat WXPAY, Alipay ALIPAY, and UnionPay UNIONPAY. Each adapter implements a unified abstract interface and internally handles the conversion between standard parameters and channel-specific request formats, channel-specific signature encryption, interface request sending, and payment response message parsing. When adding a third-party payment channel, only the adapter implementation class needs to be added and registered to the factory; no modification to the core business code is required, demonstrating high extensibility.

[0093] Callback processing center unit:

[0094] It receives asynchronous payment success callback messages from three types of payment channels, and uses built-in message verification logic to validate the callback's validity. It then parses and extracts key fields: payment transaction_id, merchant order number (order_no), pay_channel identifier, transaction amount, payment completion time (pay_time), and consumer pre-filled buyer information (buyer_info). The parsed standardized transaction data is written to the payment transaction record table, where the invoice_status field is set to "not invoiced" by default. Upon successful validation, an instant invoicing trigger message is sent to the Kafka / RabbitMQ message queue. This asynchronous queue smooths out peak traffic, preventing high-concurrency callbacks from blocking the system's main thread.

[0095] Examples of key fields in the payment transaction record table are as follows:

[0096]

[0097] Instant invoicing trigger unit:

[0098] The system subscribes to invoicing trigger messages pushed by the message queue, queries the complete transaction record using transaction_id as a unique index, and calls the rule matching engine of the invoicing configuration management module to obtain the invoicing product template that matches the corresponding store, channel, and amount range; it then distinguishes three branch processes based on the buyer information configuration strategy:

[0099] Branch 1: The consumer payment front end pre-fills complete enterprise purchaser information, directly assembles a complete invoice request and sends it to the intelligent invoice routing module;

[0100] Branch 2: If the buyer information is not filled in, the merchant backend is configured with the "default personal invoice" policy, which will automatically fill in the personal buyer identifier and initiate the invoice issuance.

[0101] Branch 3: If there is no pre-filled information and the default personal invoicing is not enabled, the invoicing task is suspended, the transaction record remains in the "uninvoiced" state, and it is transferred to the bill re-invoicing module for the consumer to actively re-invoice later.

[0102] (2) Invoice configuration management module:

[0103] The invoicing configuration management module provides standardized, multi-dimensional, and flexible invoicing rules support for the entire system. It is the core guarantee for the compliance and accuracy of invoice information in automatic invoicing and includes three sub-units: invoicing project template management unit, multi-dimensional rule matching engine unit, and buyer information strategy management unit.

[0104] "Invoicing upon payment" requires the system to automatically determine the invoice items upon payment completion. Therefore, businesses need to configure a default invoice item template in advance. Businesses can customize default invoice items based on their product categories through the invoice configuration management interface, including product name, tax classification code, tax rate, specifications, and unit. This configuration supports differentiated settings for multiple stores. The specific implementation is as follows:

[0105] Invoice Item Template Management Unit:

[0106] It has a built-in standard library of official tax classification codes from the State Taxation Administration, supporting hierarchical browsing and keyword search for codes; the merchant administrator can visually create, edit, and deactivate invoice templates in the backend, and each template stores fields including item_name, standard tax classification code tax_code, applicable tax rate tax_rate, specification model spec, and unit of measurement unit; the system supports template reuse, and multiple stores can be bound to the same set of product templates.

[0107] The following is an example of a template configuration for an invoice item:

[0108] Enterprise administrators create invoicing project templates in the system. Each template contains the following information:

[0109] Product names: such as "catering services", "accommodation services", "food retail", etc.;

[0110] Tax classification code: corresponds to the State Taxation Administration's tax classification code standard, such as the code 3070401000000000000 for catering services;

[0111] Tax rates, such as 6%, 13%, 3%, etc., are determined based on the category of goods and the taxpayer status of the enterprise.

[0112] Specifications and Units: Optional fields, such as "copies", "times", "days", etc.

[0113] Unit price: Optional. If left blank, it will be automatically calculated from the transaction amount.

[0114] Multi-dimensional rule matching engine unit:

[0115] The design incorporates a three-tiered mapping rule storage table, supporting merchants to bind invoice templates based on three dimensions: store_id (store), pay_channel (payment channel), and amount_min / amount_max (amount range). Each rule is configured with a priority (the higher the value, the higher the matching weight). The matching execution logic filters according to priority, with the matching priority order being: when multiple configuration dimensions are matched simultaneously, the invoice item is selected in the priority order of "payment channel > amount range > store > enterprise default".

[0116] Specifically, businesses can map and bind invoice item templates to specific conditions, supporting configuration in the following dimensions:

[0117] Store-specific configuration: Different stores can have different default invoicing items set. For example, store A (pure catering) defaults to "catering services", while store B (catering + retail) defaults to "food retail".

[0118] Configure by amount range: Different invoicing items can be mapped according to the transaction amount range;

[0119] Configure by payment channel: Different default invoicing items can be set for different payment channels.

[0120] The system supports configuring default invoicing item mapping rules based on three dimensions: store, amount range, and payment channel, and automatically matches them according to priority. The mapping rules are stored in a configuration table, with the following structure:

[0121] .

[0122] When the "Pay and Issue Invoice" trigger message arrives, configure the matching engine to select the invoice item according to the following steps:

[0123] Step 1: Use merchant ID + store ID + payment channel + transaction amount as criteria to query all enabled mapping rules.

[0124] Step 2: Sort by priority and select the invoice item template corresponding to the rule with the highest priority.

[0125] The invoicing items of a certain catering chain enterprise are configured as follows:

[0126]

[0127] Step 3: If no rule is matched, the company's default invoicing item template will be used; if the company has not configured a default template, an exception will be returned, prompting the administrator to configure it.

[0128] Buyer Information Strategy Management Unit:

[0129] In the "pay and invoice simultaneously" model, the strategy for obtaining the buyer's information directly impacts the seamless user experience. The system supports the following three strategies:

[0130] Strategy A (Default Individual Invoicing): Enterprises configure a default individual invoice policy. Once payment is completed, invoices will be automatically issued with the individual's name on the invoice. Consumers do not need to fill in any information, achieving a completely seamless experience.

[0131] Strategy B (Pre-fill before payment): Consumers fill in the buyer's information before payment, and the invoice is automatically issued according to the pre-filled information upon completion of payment;

[0132] Strategy C (Pay first, issue later): No invoice is issued when the consumer pays, and an invoice is issued later through the invoice replacement module. This is suitable for scenarios where the buyer's information is uncertain.

[0133] The system allows consumers to save frequently used buyer information (individuals or businesses), which is automatically populated when issuing invoices next time, reducing repetitive entry. Buyer information is stored encrypted to ensure the security of sensitive data.

[0134] (3) Backend intelligent invoicing routing module: realizes intelligent automatic matching of multiple payment channels and dedicated Leqi channel, millisecond-level routing scheduling, and includes three sub-units: Leqi channel adapter cluster unit, intelligent routing decision engine unit, and fault tolerance retry and health inspection unit.

[0135] Leqi Channel Adapter Cluster Unit:

[0136] Three independent LeQI channel adapters are packaged, corresponding to WeChat LeQI WXPAY_LEQI, Alipay LeQI ALIPAY_LEQI, and UnionPay Business LeQI UNIONPAY_LEQI respectively. Each adapter is adapted to the corresponding platform's exclusive authentication system: WeChat uses merchant certificate + APIv3 signature, Alipay uses public and private key RSA2 signature, and UnionPay uses merchant two-way certificate authentication. A standardized invoice request input parameter structure is uniformly output externally, and internally parameter format conversion, signing, tax interface calls, and invoice result parsing are completed.

[0137] The core fields of the standardized and unified invoice request structure are: channel_type (channel type), transaction_id (payment transaction ID), buyer (complete buyer information array), invoice_items (product invoice details array), and delivery (invoice delivery target configuration).

[0138] Intelligent routing decision engine unit:

[0139] A built-in static route mapping table is used to establish a one-to-one binding relationship between the payment channel pay_channel and the Leqi channel channel_type;

[0140] The routing decision execution steps are as follows:

[0141] Step 1: Receive the standardized invoicing task issued by the upstream, extract the transaction_id, and query the transaction master table to obtain the pay_channel;

[0142] Step 2: Retrieve the routing table using pay_channel as the primary key and match the corresponding Leqi Channel adapter instance;

[0143] Step 3: Verify the availability status of the channels synchronized by the timed inspection unit. If the channel is normal, forward the invoice request to the corresponding adapter; if the channel is unavailable, trigger the degradation logic and store the task in the delayed processing queue.

[0144] Fault-tolerant retry and health inspection unit:

[0145] The timed inspection unit sends a heartbeat detection interface to the three Leqi channels every 5 minutes. If the detection fails 3 times in a row, the channel is marked as unavailable and an operation and maintenance alarm is pushed.

[0146] The tiered retry strategy distinguishes between fault types: temporary faults such as instantaneous network timeout and interface rate limiting will automatically retry 3 times, with intervals of 1s, 3s, and 5s increasing; business errors such as incorrect buyer information and code mismatch will directly terminate the retry and return an error message to the front end; when the entire channel is unavailable, immediate invoicing will be downgraded to payment first and invoicing later, and invoicing will be automatically reissued in batches after the channel is restored.

[0147] After successful invoicing, the transaction record table is updated with invoice_status=1, the official invoice number invoice_no is filled in, and the complete invoice OFD / PDF file and invoice data are pushed to the invoice delivery module.

[0148] (4) Invoice delivery module: realizes multi-channel adaptive real-time delivery, tracks the invoice delivery lifecycle, and includes a multi-channel delivery execution unit, an automatic delivery method matching unit, and a delivery status management unit.

[0149] Supports three delivery methods: email, SMS, and push notifications from the mobile app; automatic matching logic: if the consumer actively selects a delivery channel, it will be executed first; if no channel is selected, email will be sent first; if only a mobile phone number is provided, SMS will be used; if payment is made through the app and no contact information is provided, push notifications will be sent through the app.

[0150] The delivery record table records delivery_id, invoice_no, delivery_type, target email / phone number, delivery status, number of retries, and delivery time; it automatically retryes 3 times if delivery fails, and logs of failures are kept for merchants to manually resend in the backend.

[0151] Specifically, the delivery methods for each channel are as follows:

[0152] Email Delivery: The consumer provides their email address, and the system calls the email service API to send the invoice PDF / OFD file as an attachment to the consumer's email address. The email body includes invoice summary information (invoice number, invoice date, amount, invoicing party name, etc.) and a link to view the invoice.

[0153] Mobile phone SMS delivery: The consumer provides their mobile phone number, and the system calls the SMS service API to send an SMS containing a link to view the invoice. The consumer can click the link to view and download the invoice in their browser. An example of the SMS content is as follows: "[XX Invoicing] Your e-invoice has been successfully issued, invoice number 25000000000000000001. Click https: / / example.com / i / xxxx to view and download."

[0154] APP push notification delivery: After a consumer completes payment and invoicing within the APP, the system sends an invoicing success notification via the APP push notification service. The consumer can click the notification to directly view and download the invoice within the APP. The APP includes a "My Invoices" page, which centrally displays all historical invoices.

[0155] Under the "payment upon invoicing" mode, the system selects the delivery method according to the following logic:

[0156] Step 1: If the consumer actively selects a delivery method before payment, then the method selected by the consumer will be used.

[0157] Step 2: If the consumer has not made a selection but has already filled in an email address, delivery will be made by email by default.

[0158] Step 3: If the consumer does not select or fill in an email address, but uses a mobile phone number for payment (such as a mobile phone number linked to Alipay), then delivery will be made by default via SMS.

[0159] Step 4: If none of the above conditions are met, delivery will be made via APP push notification by default (if the consumer initiates payment through the APP).

[0160] The system tracks the delivery status of each invoice throughout the entire process, including: pending delivery, in progress, successful delivery, and failed delivery. If delivery fails, the system automatically retryes (up to 3 times). If the retry still fails, an exception log is recorded and the administrator is notified. Consumers can view the invoice delivery status on the "My Invoices" page.

[0161] The key fields in the delivery record table are as follows:

[0162]

[0163] (5) Bill Reissue Module: Covers two business scenarios: payment without invoice and invoice that needs to be reversed and replaced. It includes a historical bill retrieval unit, a single bill reissue unit, a reverse bill replacement unit, and a batch billing unit.

[0164] The historical bill retrieval unit retrieves all historical transactions based on the consumer member ID, mobile phone number, and payment account, and filters orders by invoicing status, including those that have not been invoiced and those that have been invoiced.

[0165] Single Invoice Reissue: When a consumer selects an unbilled bill, the system reuses the intelligent routing and configuration engine to automatically match the Leqi channel and invoice template. After the consumer adds the purchaser information, an invoice is issued with one click.

[0166] Red-letter invoice cancellation: For orders that have already been invoiced, first call the original Leqi channel to issue a red-letter invoice to cancel the original invoice, and then reassemble the new buyer information and invoice details to generate a new blue-letter invoice;

[0167] Batch invoicing: The merchant backend supports filtering batches of unbilled invoices by time and store, uniformly filling in the buyer information, and then distributing them in batches to the corresponding Leqi channel, displaying the invoicing progress in real time, and generating batch invoicing result reports.

[0168] The bill reissue module provides supplementary capabilities to "pay and issue invoices instantly". In actual operation, consumers may choose "pay first and issue invoice later" due to reasons such as uncertainty about the buyer's information. In this case, it is necessary to initiate a request for reissue and replacement of invoices based on historical payment records. This module enables the "pay first and issue invoice later" scenario to also obtain the same convenient experience as "pay and issue invoices instantly", without the need for manual search of transaction vouchers and manual entry of information.

[0169] Consumers can view all their historical payment records on the "Payment History" page of the app or mini-program. The system retrieves all transactions for a consumer from the payment transaction record table based on the consumer's identity identifier (mobile phone number / member ID / payment account) and displays transaction summary information (transaction time, amount, payment channel, store name, invoice status).

[0170] Consumers can filter by invoice status: view only "uninvoiced" invoices, view only "invoiced" invoices, or view all invoices. Uninvoiced invoices can be reissued; invoiced invoices can be reversed.

[0171] For historical bills where no invoice was requested at the time of payment (i.e., "pay first, invoice later" scenario), consumers can initiate a request for a supplementary invoice. The specific process is as follows:

[0172] Step 1: On the "History Bills" page, the consumer selects an "Unbilled" bill and clicks the "Request Invoice" button.

[0173] Step 2: The system routes the bill to the corresponding Leqi channel through the intelligent invoicing routing module based on the payment channel (pay_channel) of the bill.

[0174] Step 3: The system queries the store's invoicing configuration corresponding to the bill and obtains the default invoicing item template.

[0175] Step 4: Consumers fill in the buyer information (or select saved buyer information) and delivery method.

[0176] Step 5: The system assembles the invoice request and calls the corresponding Leqi channel to issue the invoice.

[0177] Step 6: After the invoice is successfully issued, update the invoice status of the bill to "Invoiced" and fill in the invoice number.

[0178] Step 7: The invoice delivery module delivers the invoice according to the delivery method selected by the consumer.

[0179] Here is an example of a bill being reissued:

[0180] On July 1, 2025, a consumer paid 500 yuan for a hotel stay via Alipay, without requesting an invoice at the time (selecting "pay first, invoice later"). Reimbursement is required on July 15th.

[0181] Consumers can find a transaction record of 500 yuan on July 1st by filtering for "unbilled" bills on the "historical bills" page of the APP.

[0182] Clicking "Apply for Invoice" will trigger the system to recognize pay_channel=ALIPAY and route the request to Alipay's Leqi channel.

[0183] The system queries the hotel's invoicing configuration, and the default invoicing item is "accommodation services" (tax classification code 3070401000000000000, tax rate 6%).

[0184] Consumers fill in the buyer's company information (name, tax number) and select mail delivery.

[0185] The system calls Alipay's Leqi channel to issue an invoice and returns the invoice number.

[0186] Update the bill status to "Invoiced" and send the invoice to the consumer via email.

[0187] For invoices that have already been issued but require changes to the buyer's information or invoice items, consumers can initiate a request for a red-ink reversal and replacement. The specific process is as follows:

[0188] Step 1: On the "History Bills" page, the consumer selects an "Invoiced" bill and clicks the "Reissue" button.

[0189] Step 2: The system queries the original invoice information corresponding to the bill (invoice number, invoicing channel, invoice amount, etc.).

[0190] Step 3: The system initiates a red-ink invoice (red cancellation) application through the original invoicing channel to cancel the original blue-ink invoice.

[0191] Step 4: After the red-ink reversal is successful, the system updates the invoice status of the bill to "red-ink reversal".

[0192] Step 5: The consumer fills in the new buyer information and invoice items (the default items can be selected or customized).

[0193] Step 6: The system uses the intelligent invoicing routing module to route the payment to the corresponding Leqi channel and reissue a blue-letter invoice.

[0194] Step 7: After the new invoice is successfully issued, update the bill status to "Invoiced", fill in the new invoice number, and deliver it via the delivery module.

[0195] Here is an example of a red-inked changeover:

[0196] On July 1st, a consumer made a purchase of 100 yuan via WeChat Pay and received an invoice with a personal invoice (the "pay and get an invoice" mode automatically issues in personal invoices). Later, due to reimbursement requirements, the invoice needed to be changed to a corporate invoice.

[0197] Consumers can find the invoiced bill on the "History Bills" page and click "Reissue".

[0198] The system queries the original invoice issued through the WeChat Leqi channel, initiates a WeChat Leqi red-ink application, and cancels the original invoice.

[0199] Consumers can change the purchaser information to the company name (name, tax number) and select the default invoicing item "catering services".

[0200] The system reissued the blue-letter invoice through the WeChat Leqi channel.

[0201] The new invoices are delivered to consumers via the app.

[0202] The system supports batch invoicing. Enterprise administrators can select multiple "unbilled" historical invoices in batches, fill in the buyer information and invoicing items uniformly, and the system will batch assemble the invoicing requests and route them sequentially to the corresponding Leqi channels through the intelligent routing module to complete the invoicing. Batch invoicing supports progress display and result summary reports.

[0203] Here is an example of batch replacement:

[0204] A company's finance staff needs to issue supplementary invoices in batches for all unbilled travel expense bills from June 2025 (a total of 50 bills, including 30 WeChat Pay bills, 15 Alipay bills, and 5 UnionPay QuickPass bills).

[0205] The finance staff filtered the "unbilled" bills for June in the management backend, selecting all 50 bills.

[0206] Fill in the buyer's company information and the invoice item "accommodation services" in a unified manner.

[0207] Click "Batch Invoicing," and the system will process the following transactions in sequence: 30 WeChat Pay transactions → WeChat Enterprise Channel, 15 Alipay transactions → Alipay Enterprise Channel, and 5 UnionPay QuickPass transactions → UnionPay Business Enterprise Channel.

[0208] The system displays the invoicing progress (e.g., "35 / 50 completed"). Once all invoices are completed, a summary report is generated (48 successful invoices, 2 failed invoices, and the reasons for the failures).

[0209] The electronic invoice issuance involved in this embodiment system complies with the relevant specifications of the State Taxation Administration's "Promotion of Fully Digitalized Electronic Invoices," and the Leqi Direct Connection interface follows the technical specifications of the State Taxation Administration's Leqi Direct Connection Open Platform. The payment interface follows the official API specifications of each payment platform (WeChat Pay API v3, Alipay Open Platform API, UnionPay Business API).

[0210] This invention also provides a payment-based instant invoicing method, applied to the payment-based instant invoicing system described above, which consists of five processes: instant payment-based instant invoicing main process, intelligent enterprise channel routing matching process, multi-dimensional invoicing template automatic matching process, multi-channel invoice adaptive delivery process, and historical bill reissue and red-ink reissue process.

[0211] Process 1: Instant Payment and Invoicing Main Process:

[0212] Step S1: Consumers initiate aggregated payment through merchant POS terminals, mini-programs, or apps. The front-end aggregated SDK assembles a standard payment request, and consumers can choose any of the WXPAY / ALIPAY / UNIONPAY channels to complete the payment.

[0213] Step S2: The corresponding payment channel pushes an asynchronous callback to the callback processing center unit after payment success. The adapter verifies the signature, parses the transaction metadata, writes it to the payment transaction record table, and sets invoice_status to 0 (no invoice issued).

[0214] Step S3: The callback processing center sends an instant invoicing trigger message to the message queue. The instant invoicing trigger unit queries the complete transaction record based on the trigger message, carrying the transaction_id.

[0215] Step S4: Call the rule matching engine of the invoicing configuration management module to automatically match a unique invoicing product template based on store_id, pay_channel, and transaction amount, and obtain the tax classification code and tax rate;

[0216] Step S5: Read the merchant's configured buyer information strategy and process the buyer information in three ways: pre-filled enterprise information is used directly, the default personal strategy is enabled to automatically fill in the personal buyer information, and if there is no information, the task is suspended and the bill is reissued.

[0217] Step S6: Assemble a standardized invoice request and send it to the backend intelligent invoice routing module;

[0218] Step S7: The routing engine matches the corresponding Leqi channel adapter and calls the tax Leqi interface to issue digital invoices;

[0219] Step S8: After successful invoicing, update the transaction record invoicing status, fill in the invoice number, and push the invoice file and delivery target to the invoice delivery module;

[0220] Step S9: The invoice delivery module automatically matches the optimal delivery channel to complete the immediate delivery of the invoice;

[0221] Step S10: The merchant's payment success page simultaneously displays the invoice number and provides an online viewing and download portal, completing the entire process of seamless payment and invoicing.

[0222] Process 2: Intelligent Enterprise Channel Routing Matching Process:

[0223] Step M1: Receive the invoicing task from the upstream and extract the unique payment transaction ID;

[0224] Step M2: Query the main payment transaction table and read the pay_channel payment channel identifier corresponding to this transaction;

[0225] Step M3: Search the built-in static route mapping table and match the exclusive Leqi channel channel_type corresponding to pay_channel;

[0226] Step M4: Retrieve the channel health status indicators maintained by the timed inspection unit to determine whether the channel is normal and usable;

[0227] Step M5: Channel is normal: Instantiate the corresponding Leqi adapter, convert parameters, sign, and then call the tax invoicing interface;

[0228] Step M6: Channel unavailable: Store the current invoicing task in the delayed pending queue. The front end will prompt that the invoice will be issued automatically after the delay. After the channel is restored during the regular inspection, the queue tasks will be executed in batches.

[0229] Step M7: Differentiate the fault type and perform tiered retries. Temporary faults will be automatically retried 3 times. Business errors will terminate the process and return an error message.

[0230] Step M8: Receive the invoicing result returned by Leqi. If successful, push the invoice data to the delivery module. If it fails, record the exception log.

[0231] Process 3: Automatic matching process for multi-dimensional invoice templates:

[0232] Step T1: Pass in the matching parameters: merchant_id (merchant ID), store_id (store), pay_channel (pay channel), and transaction amount (amount);

[0233] Step T2: Retrieve all the invoicing rules enabled by the merchant and sort them from highest to lowest priority;

[0234] Step T3: Verify the rule constraints in sequence: channel matching → amount range matching → store matching;

[0235] Step T4: Hit the highest priority valid rule and bind it to the corresponding item_template_id invoice template;

[0236] Step T5: Retrieve the template product name, tax classification code, tax rate, and unit, and assemble the invoice details array;

[0237] Step T6: If no rule matches, throw a configuration missing alarm and terminate the automatic invoicing process.

[0238] Process 4: Adaptive delivery process for multi-channel invoices:

[0239] Step D1: Receive the invoice data and the consumer's registered email address / phone number / APP user identifier after successful invoicing.

[0240] Step D2: Determine whether the consumer has actively selected a delivery channel; if so, directly execute the corresponding delivery unit.

[0241] Step D3: Execute automatic matching logic when no manual selection is required: If an email address exists, deliver the email; if only a mobile phone number is available, deliver the SMS; if there is no contact information on the app, push the app notification.

[0242] Step D4: Send the invoice via the corresponding channel API and record the initial delivery status as "Pending Delivery";

[0243] Step D5: Receive delivery callback. If successful, update the status to "delivery successful"; if delivery fails, automatically retry up to 3 times.

[0244] Step D6: If all retries fail, record the exception log. The merchant backend supports manually re-initiating delivery.

[0245] Process 5: Procedure for reissuing and reversing historical invoices:

[0246] (1) Procedure for reissuing a bill:

[0247] Step B1: Consumers / merchant administrators enter the bill reissue module and filter historical transactions with a specified time, store, and invoice status of "not invoiced".

[0248] Step B2: Select a single transaction or multiple transaction records in batches, and the system will automatically read the pay_channel, store_id, and transaction amount for each transaction;

[0249] Step B3: Reuse the configuration management module to match the invoicing template, add / select saved buyer information for consumers, and select the invoice delivery channel;

[0250] Step B4: Distribute the reissue task to the intelligent routing module and match the corresponding Leqi channel for batch invoicing according to the transaction channel;

[0251] Step B5: Once the invoicing is completed, the transaction record and invoicing status are updated, and the delivery module automatically pushes the invoice to the consumer's reserved channel.

[0252] (2) Red-hot replacement process:

[0253] Step H1: The consumer selects a previously invoiced historical bill, initiates a replacement invoice request, and reads the original transaction_id, the original Leqi channel, and the original invoice number;

[0254] Step H2: The routing engine matches the Leqi adapter corresponding to the original transaction, calls the red-ink invoice interface to issue a red-ink invoice, and cancels the original blue-ink invoice;

[0255] Step H3: The transaction record status is updated to "Reversed in Red";

[0256] Step H4: The consumer modifies the buyer's name, tax ID, or changes the invoice details;

[0257] Step H5: Reuse the routing module and configuration template to reissue a new blue invoice and complete the delivery.

[0258] Application examples

[0259] Examples of applications of this invention in real-world scenarios are as follows:

[0260] This application example uses a chain restaurant enterprise (merchant number M20260001) as the application scenario, with three stores: S001 Chaoyang Flagship Store (pure catering), S002 Binhai Branch (catering + food retail), and S003 Airport Fast Food Restaurant (fast food). The store's POS terminal supports three aggregated payment channels: WeChat Pay (WXPAY), Alipay (ALIPAY), and UnionPay (UNIONPAY). The merchant is configured with two sets of product templates: Template 1 Catering Services (code 3070401000000000000, 6% tax rate) and Template 2 Food Retail (code 3010101010100000000, 13% tax rate). The merchant's global invoicing policy is enabled with "pre-filled corporate buyer for payment, default to personal invoice if no pre-filled invoice is provided". The system is deployed with a SaaS cloud architecture, using Kafka for message queues, and the LeQi channel performs a heartbeat check every 5 minutes. Invoicing failures are automatically retried up to 3 times.

[0261] Application Example 1: WeChat Pay Instant Payment and Invoicing Process:

[0262] A consumer made a purchase of 100 yuan (10,000 points) at the Chaoyang flagship store S001 via WeChat Pay. The payment process involved filling in the following information for the purchasing company: XX Technology Co., Ltd., tax number 91110108XXXXXXXXXX, and reserving the email address for receiving invoices: user@shturl.

[0263] Step 1: The consumer scans the QR code to complete the WeChat payment. The pay_channel is identified as WXPAY, and the WeChat Pay platform pushes an asynchronous callback to the system callback processing center.

[0264] Step 2: The payment channel adapter completes APIv3 signature verification, parses transaction_id=WXP20260804001, writes it to the payment transaction record table, and sets invoice_status=0 (no invoice issued).

[0265] Step 3: The callback center sends an invoice trigger message to Kafka. The instant invoice trigger unit queries the transaction record based on the trigger message to obtain merchant_id=M20260001, store_id=S001, pay_channel=WXPAY, amount=10000;

[0266] Step 4: Call the invoicing configuration matching engine to retrieve the merchant's rules: Store S001 is bound to the catering service template, which has the highest priority. Obtain the corresponding tax code and 6% tax rate.

[0267] Step 5: Read the consumer's pre-filled complete enterprise purchase information, no need to supplement, and assemble the complete invoice details array;

[0268] Step 6: The standardized invoicing request is sent to the intelligent invoicing routing module;

[0269] Step 7: The routing engine retrieves the mapping table WXPAY→WXPAY_LEQI WeChat LeQI channel, and the heartbeat check shows that the channel status is normal; instantiate the WeChat LeQI adapter, load the merchant APIv3 certificate to generate a signature, and call the WeChat LeQI tax interface;

[0270] Step 8: The Leqi channel returns a message indicating successful invoicing, invoice number 25000000000000000001, the system updates the transaction record invoice_status=1, and then re-enters the invoice number;

[0271] Step 9: The invoice delivery module identifies the consumer's pre-registered email address, executes the EMAIL delivery unit, and sends the PDF invoice as an attachment to user@shturl. The delivery record status is set to successful.

[0272] Step 10: The consumer's WeChat payment success page displays the invoice number and an online viewing link. The invoice is received via email simultaneously after payment is completed, and the invoice is issued immediately upon completion of the seamless payment.

[0273] Application Example 2: Alipay payment, subsequent bill reissue process:

[0274] A consumer paid 260 yuan for food retail at the Binhai branch S002 via Alipay. The consumer did not fill in the purchaser information at the time of payment. The merchant's default personal invoicing policy was turned off, and the transaction record invoice_status remained as uninvoiced. Ten days later, the consumer needed to have the company reimburse the expense and went to the WeChat mini-program to issue an invoice for the historical bills.

[0275] Step 1: Consumers enter the bill reissue module, filter for unbilled bills, and find the transaction record from the ALIPAY channel;

[0276] Step 2: Click "Apply for Reissue". The system will automatically read store_id=S002 and match the 13% tax rate invoice template for food retail.

[0277] Step 3: Consumers select the saved enterprise purchaser information and choose the SMS delivery channel (pre-registered mobile phone number 138XXXX1234).

[0278] Step 4: Re-enable the task distribution smart route, pay_channel=ALIPAY to match Alipay Leqi Channel;

[0279] Step 5: Alipay Leqi Adapter calls the tax interface to issue electronic invoices for retail categories;

[0280] Step 6: The delivery module sends an SMS containing an invoice link to the consumer's mobile phone number, and the transaction record is updated to show that an invoice has been issued;

[0281] Step 7: Consumers click the link in the SMS message to download the invoice for reimbursement.

[0282] Application Example 3: UnionPay QuickPass payment invoice red-ink reissue process:

[0283] A consumer paid 58 yuan for a fast food meal at an airport store (S003) using UnionPay QuickPass. The payment automatically generated a personal invoice, but the invoice needed to be changed to a company invoice for reimbursement. The consumer then initiated the re-invoice process.

[0284] Step 1: The consumer selects the UNIONPAY channel invoiced order in the historical billing and clicks "Re-invoice";

[0285] Step 2: The routing engine identifies the original transaction channel as the UnionPay Enterprise Channel, calls the Red Invoice Reversal Interface to generate a red invoice, and updates the original transaction status to Red Invoice Reversal.

[0286] Step 3: Consumers enter the company name and tax number, and select APP push as the delivery method;

[0287] Step 4: The system reuses the UnionPay Business Enterprise Channel to reissue a blue-letter invoice with the enterprise header using the catering service template;

[0288] Step 5: The app pushes a notification that the invoice was successfully issued, and the consumer can view the new invoice on the "My Invoices" page.

[0289] Application Example 4: Fault Degradation and Fault Tolerance Implementation Process for Leqi Channel:

[0290] During the lunch rush, the WeChat Pay Channel failed heartbeat detection three times in a row and was marked as unavailable; multiple consumers completed payments via WeChat Pay.

[0291] Step 1: Payment callback is entered into the database normally, and an instant invoicing task is sent to the message queue;

[0292] Step 2: The routing engine detects that the WXPAY_LEQI channel is unavailable and stores all WeChat invoicing tasks in the delayed pending queue;

[0293] Step 3: The payment success page displays "The channel is under temporary maintenance, and the invoice will be automatically issued later," and the transaction status remains "invoice not issued."

[0294] Step 4: Regularly check the channel every 5 minutes. After 30 minutes, the WeChat LeQi channel will return to normal and the status will be updated to be available.

[0295] Step 5: The system automatically processes all WeChat invoicing tasks in the batch consumption delay queue, completing routing, invoicing, and email / SMS delivery in sequence;

[0296] Step 6: All tasks are completed, and the corresponding transaction records are updated in batches to show that invoices have been issued. There are no lost orders and no manual intervention required.

[0297] Application Example 5: Implementation Process for Bulk Reopening of Multiple Stores:

[0298] Merchants' finance department centrally processes all unbilled bills for June, totaling 50: 30 via WeChat, 15 via Alipay, and 5 via UnionPay QuickPass. Invoices for catering services are issued uniformly and delivered via email.

[0299] Step 1: The administrator logs into the merchant backend billing module, filters all unbilled transactions in June, and selects 50 orders.

[0300] Step 2: Fill in the merchant's company information uniformly and deliver it in batches via designated email;

[0301] Step 3: The system splits the task into 50 parts and automatically distributes them to the corresponding Leqi channel based on the pay_channel of each transaction;

[0302] Step 4: The page displays the invoicing progress in real time. 48 invoices were successfully issued, and 2 invoices failed due to incorrect buyer tax number format.

[0303] Step 5: The system generates a batch invoicing summary report, marking successful / failed orders and the reasons for failure. After the finance department corrects the tax number, the failed invoices are reissued separately.

[0304] This invention also provides a computer device. Figure 2 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention; see the accompanying drawings. Figure 2 As shown, the computer device includes: an input device 23, an output device 24, a memory 22, and a processor 21; the memory 22 is used to store one or more programs; when the one or more programs are executed by the one or more processors 21, the one or more processors 21 implement the payment and invoicing method based on aggregated payment provided in the above embodiment; wherein the input device 23, the output device 24, the memory 22, and the processor 21 can be connected via a bus or other means. Figure 2 Taking the example of a connection between China and Israel via a bus.

[0305] The memory 22, as a read / write storage medium for a computing device, can be used to store software programs and computer-executable programs, such as the program instructions corresponding to the payment and invoicing method based on aggregated payment described in this embodiment of the invention. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device. Furthermore, the memory 22 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 22 may further include memory remotely located relative to the processor 21, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0306] The input device 23 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device; the output device 24 may include display devices such as a display screen.

[0307] The processor 21 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 22, thereby realizing the above-mentioned payment and invoicing method based on aggregated payment.

[0308] The computer equipment provided above can be used to execute the payment and invoicing method based on aggregated payment provided in the above embodiments, and has corresponding functions and beneficial effects.

[0309] This invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the payment-based invoicing method provided in the above embodiments, based on aggregated payment. The storage medium can be any type of memory device or storage device, including: mounting media such as CD-ROM, floppy disk, or magnetic tape; computer system memory or random access memory such as DRAM, DDRRAM, SRAM, EDORAM, Rambus RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements; the storage medium may also include other types of memory or combinations thereof; furthermore, the storage medium may reside in a first computer system in which the program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet); the second computer system can provide program instructions to the first computer for execution. The storage medium includes two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). The storage medium may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0310] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the payment-instant invoicing method based on aggregated payment as described in the above embodiments, but can also execute related operations in the payment-instant invoicing system and method based on aggregated payment provided in any embodiment of the present invention.

[0311] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

[0312] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A payment-based instant invoicing system based on aggregated payment, characterized in that, include: The front-end aggregated payment integration module, invoice configuration management module, back-end intelligent invoice routing module, invoice delivery module, bill replacement module, and underlying message queue service; The front-end aggregated payment integration module is used to integrate the multi-channel aggregated payment SDK, receive consumer payment requests, parse asynchronous callback messages pushed by payment channels, persistently store transaction data, and send instant invoicing trigger messages to the message queue; the front-end aggregated payment integration module includes a unified payment interface encapsulation unit, a payment channel adapter unit, a callback processing center unit, and an instant invoicing trigger unit. The invoicing configuration management module is used to store invoicing product templates, multi-dimensional invoicing matching rules, and buyer information configuration strategies. It receives calls from the instant invoicing trigger unit and matches the tax classification code, tax rate, and product name corresponding to the transaction. It includes an invoicing project template management unit, a multi-dimensional rule matching engine unit, and a buyer information strategy management unit. The backend intelligent invoicing routing module receives the invoicing request, matches the corresponding tax enterprise direct connection channel according to the transaction payment channel identifier, and completes the issuance of digital invoices. It has a built-in enterprise channel adapter cluster unit, intelligent routing decision engine unit, fault tolerance retry and health inspection unit. The invoice delivery module receives the invoice data and invoice file after successful invoicing, and completes the instant delivery of the invoice by matching any channel such as email, SMS or APP push according to the contact information reserved by the consumer. The delivery status is recorded throughout the process and the failed delivery task is retried. The bill reissue module is used to retrieve historical payment transaction records, realize one-click reissue of unbilled bills, red-letter reissue of bills that have been invoiced, and batch invoicing in the merchant backend, and reuse the underlying scheduling capabilities of the billing configuration management module and the backend intelligent billing routing module. The message queue service is used to asynchronously decouple payment callback, invoicing, and invoice delivery tasks, and to smooth out peaks in high-concurrency scenarios to avoid task blockage and loss.

2. The payment-based instant invoicing system according to claim 1, characterized in that, The intelligent routing decision engine unit has a built-in static routing mapping table, which establishes a one-to-one binding relationship between the payment channel identifier pay_channel and the exclusive enterprise channel channel_type. The mapping rules are as follows: WXPAY corresponds to the WeChat enterprise channel, ALIPAY corresponds to the Alipay enterprise channel, and UNIONPAY corresponds to the UnionPay Business enterprise channel. The routing engine extracts the pay_channel field in the transaction record to retrieve the mapping table, and matches the corresponding enterprise adapter in milliseconds to execute the invoicing.

3. The payment-based instant invoicing system according to claim 1, characterized in that, The multi-dimensional rule matching engine unit supports configuring invoice template mapping rules in three dimensions: store_id, payment channel, and transaction amount. Rules are set with priority values, and the matching priority order is: payment channel exclusive rules > amount range rules > store general rules > merchant default template. The multi-dimensional rule matching engine unit filters the highest priority valid rules and retrieves the corresponding tax classification code and tax rate to assemble invoice details.

4. The payment-based instant invoicing system according to claim 1, characterized in that, The fault-tolerant retry and health inspection unit sends heartbeat detection requests to the three Leqi channels at fixed intervals. If the detection fails multiple times in a row, the corresponding channel is marked as unavailable. Differentiate fault types and implement a tiered retry strategy: retry 3 times for instantaneous network faults, terminate retry for incorrect service parameters; when the channel is unavailable, the immediate invoicing task is stored in the delayed processing queue, and invoices are reissued in batches after the channel is restored, realizing the service downgrade to payment first and invoicing later.

5. The payment-based instant invoicing system according to claim 1, characterized in that, The bill reissue module includes a historical bill retrieval unit, a single-transaction reissue unit, a red-ink reissue unit, and a batch invoicing unit. The red-ink reissue unit first calls the Leqi channel corresponding to the original transaction to issue a red-ink invoice to cancel the original blue-ink invoice, and then reissues a new digital invoice based on the consumer's updated purchaser information and invoicing details.

6. A payment-based instant invoicing method, applied to the payment-based instant invoicing system as described in any one of claims 1-5, characterized in that, This includes the main process for instant payment and instant invoicing, which comprises the following steps: S1: When a consumer completes payment through an aggregated payment channel, the corresponding payment platform pushes an asynchronous callback message indicating successful payment. S2: The front-end aggregated payment integration module verifies and parses callback messages, writes standardized transaction data into the payment transaction record table, and sends trigger messages to the message queue; S3: Based on the trigger message, query the complete transaction data, and the instant invoicing trigger unit calls the invoicing configuration management module to match the corresponding invoiced commodity template, tax code, and tax rate; S4: Assemble standardized invoicing requests based on merchant purchaser information strategies and send them to the backend intelligent invoicing routing module; S5: The intelligent routing decision engine unit matches a dedicated Leqi channel adapter according to the transaction payment channel and calls the tax Leqi interface to issue digital invoices; S6: After successful invoicing, update the transaction record invoicing status and push the invoice data to the invoice delivery module; S7: The invoice delivery module adaptively matches the delivery channel, delivering electronic invoices to consumers instantly, and the payment front end simultaneously displays the invoice viewing entry.

7. The payment and invoicing method based on aggregated payment according to claim 6, characterized in that, Step S5 includes a sub-process for intelligent enterprise channel routing matching, which includes: M1: Extract the unique payment transaction record carried by the invoicing task, and query the main transaction table to obtain the pay_channel payment channel identifier; M2: Retrieve the static route mapping table to match the corresponding Leqi channel type; M3: Retrieve the channel health status synchronized by the scheduled inspection. If the channel is normal, execute the invoicing interface call; if the channel is faulty, store the task in the delay queue and execute the downgraded payment before invoicing. M4: Differentiate between fault types and execute tiered retry logic. Temporary network faults can be retried up to 3 times, while errors in buyer information or tax codes will directly terminate the process.

8. The payment and invoicing method based on aggregated payment according to claim 6, characterized in that, This also includes the process of reissuing historical invoices and rewriting invoices with red ink; The process for reissuing historical bills is as follows: Consumers filter unbilled historical transactions, select single or batch bills, match the billing templates corresponding to the store and payment channel, supplement the buyer information, and then reuse the intelligent routing module to issue invoices in batches by channel. The red-ink invoice cancellation process is as follows: Select the invoiced bill, and the system will issue a red-ink invoice through the original transaction channel to cancel the original invoice. After the consumer modifies the purchaser or invoice details, a blue-ink invoice will be reissued and the delivery will be completed.

9. The payment and invoicing method based on aggregated payment according to claim 6, characterized in that, Step S7 includes an adaptive invoice delivery sub-process, which includes: D1: Read whether the consumer has manually selected an invoice delivery channel. If selected, the corresponding channel will be used for delivery. D2: If not selected, automatic matching will be performed: if a reserved email address exists, email delivery will be prioritized; if only a mobile phone number is reserved, SMS delivery will be performed; if there is no contact information on the APP, an APP message will be pushed. D3: If delivery fails, automatically retry up to 3 times, and record the status log of each invoice delivery throughout its entire lifecycle.

10. A computer device, the computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the payment and invoicing method based on aggregated payment as described in any one of claims 6-9.