An idempotent anti-duplicate method, device, equipment, medium and product for accounting

By determining the processing plan in the payment request and initiating the payment process or idempotent anti-duplicate process, the problem of duplicate payments in online consumption is solved, and the security of the payment system and user experience are improved.

CN119809636BActive Publication Date: 2025-09-23INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411858817.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-09-23
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

In the financial technology scenario, there is a problem of duplicate payments during online consumption, which leads to additional logistics costs, purchase and sale negotiations and return operating costs, affecting the merchant's reputation and user experience, and may be exploited by criminals. Existing technology makes it difficult to accurately prevent duplicate payments.

Method used

When receiving a payment request, the processing plan is determined based on the business key value and the technical key value, and the payment process or the idempotent anti-duplicate process is initiated to avoid duplicate payments and ensure the security and visual display of the payment results.

Benefits of technology

It effectively avoids the problem of duplicate payments, improves the security of the payment system and user experience, and ensures timely understanding and visual display of payment results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119809636B_ABST
    Figure CN119809636B_ABST
Patent Text Reader

Abstract

The present invention discloses an idempotent anti-duplicate method, apparatus, device, medium, and product for account transactions, relating to data processing technology in the field of financial technology. The method comprises: upon receiving a payment request for a pending payment service, determining a corresponding processing scheme for the payment request based on the business key and technical key included in the payment request, wherein the processing scheme is either a first processing scheme or a second processing scheme, the first processing scheme being used to initiate a payment process, and the second processing scheme being used to initiate an idempotent anti-duplicate process; initiating the payment process or the idempotent anti-duplicate process based on the first processing scheme or the second processing scheme, processing the business key and technical key of the payment request to obtain a payment result for the pending payment service; and controlling an information interaction interface to display the payment result. The present invention can avoid duplicate payment issues caused by a payment system responding to multiple payment requests, ensure the security of payment operations, and enhance the payment experience of the payment requester.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to data processing technology in the field of financial technology, and in particular to an idempotent anti-duplication method, device, equipment, medium and product for accounting. Background Art

[0002] With the popularization of electronic transactions and economic development, more and more users are shopping online through mobile terminals, and online shopping has become an important form of shopping.

[0003] Online purchases in FinTech scenarios typically involve two processes: ordering and payment. During the payment process, duplicate payments can occur, leading to additional logistics costs, transaction negotiation, and return costs, significantly impacting the merchant's reputation and user experience. Duplicate payments can occur due to: 1) customer error. For example, after clicking the order button, before receiving payment information from the backend, the order button is not disabled and the order status is unavailable, causing the user to click the order button repeatedly. 2) Payment channel timeouts. For example, a user may select a payment method at the checkout page and complete the payment through the corresponding payment channel, but the channel returns an asynchronous notification timeout. The payment system has not yet updated the payment status, leaving the user unclear about the order's success, resulting in multiple payments. Users may make duplicate payments due to network fluctuations or data delays. Some unscrupulous individuals may exploit various methods to duplicate payments, resulting in losses for merchants or users. Therefore, accurately preventing duplicate payments and ensuring payment security are pressing issues. Summary of the Invention

[0004] The present invention provides an idempotent anti-duplicate method, device, equipment, medium and product for account transactions, which can avoid the problem of duplicate payments caused by the payment system responding to multiple payment requests, ensure the security of payment work, and also visualize the payment results, so that the payment requester can timely understand the payment status of the pending payment business, thereby improving the payment experience of the payment requester.

[0005] According to one aspect of the present invention, a method for preventing duplicate transactions is provided, the method comprising:

[0006] Upon receiving a payment request for a pending payment service, determining a processing scheme corresponding to the payment request based on the service key and technical key included in the payment request, wherein the processing scheme is either a first processing scheme or a second processing scheme, the first processing scheme being used to initiate a payment process, and the second processing scheme being used to initiate an idempotent anti-duplicate process;

[0007] Based on the first processing solution or the second processing solution, the payment process or the idempotent anti-duplicate process is started, the business key value and the technical key value of the payment request are processed, and the payment result of the to-be-paid business is obtained;

[0008] Control the information interaction interface and display the payment results.

[0009] According to another aspect of the present invention, an idempotent anti-duplication device for account transactions is provided. The idempotent anti-duplication device for account transactions is used to implement the idempotent anti-duplication method for account transactions in any embodiment of the present invention. The device includes:

[0010] An information acquisition module, configured to, upon receiving a payment request for a pending payment service, determine a corresponding processing scheme for the payment request based on a service key and a technical key included in the payment request, wherein the processing scheme is either a first processing scheme or a second processing scheme, the first processing scheme being used to initiate a payment process, and the second processing scheme being used to initiate an idempotent anti-duplicate process;

[0011] An interface scoring module is used to initiate a payment process or an idempotent anti-duplicate process based on the first processing solution or the second processing solution, process the business key value and technical key value of the payment request, and obtain a payment result for the pending payment service;

[0012] The conclusion determination module is used to control the information interaction interface and display the payment results.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and a memory communicatively coupled to the at least one processor;

[0015] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the idempotent anti-duplication method for accounts in any embodiment of the present invention.

[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for enabling a processor to implement the idempotent anti-duplication method for accounts in any embodiment of the present invention when the computer instructions are executed.

[0017] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it implements the idempotent anti-duplication method for accounts according to any embodiment of the present invention.

[0018] The idempotent anti-duplicate method for accounts of the present invention includes: upon receiving a payment request for a pending payment service, determining a processing scheme corresponding to the payment request based on the business key value and technical key value included in the payment request, wherein the processing scheme is a first processing scheme or a second processing scheme, the first processing scheme is used to start the payment process, and the second processing scheme is used to start the idempotent anti-duplicate process; based on the first processing scheme or the second processing scheme, starting the payment process or the idempotent anti-duplicate process, processing the business key value and technical key value of the payment request, and obtaining the payment result of the pending payment service; controlling the information interaction interface to display the payment result. The present invention determines whether the payment request is triggered for the first time by the business key value and technical key value of the payment request for the pending payment service, and if it is triggered for the first time, starts the payment process, and if it is triggered for the second time, starts the idempotent anti-duplicate process, thereby avoiding the problem of duplicate payment caused by the payment system responding to multiple payment requests, ensuring the security of the payment work, and visually displaying the payment result, so that the payment requester can timely understand the payment status of the pending payment service, thereby improving the payment experience of the payment requester.

[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 This is a flow chart of an idempotent anti-duplicate method for accounting transactions provided by the present invention;

[0022] Figure 2 This is a schematic diagram of a payment process provided by the present invention;

[0023] Figure 3 This is a schematic diagram of the structure of an idempotent anti-duplicate device for accounting services provided by the present invention;

[0024] Figure 4 It is a structural schematic diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first", "second", "initial", "intermediate", "candidate", "target", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] Figure 1 This is a flow chart of an idempotent anti-duplicate method for accounts provided by the present invention. This embodiment can be applied to avoid duplicate payment problems, improve the security of payment systems, etc. The method can be executed by the idempotent anti-duplicate device for accounts provided by the present invention. The device can be implemented in the form of hardware and / or software. In a specific embodiment, the device can be integrated into an electronic device. The following embodiments will be described using the device integrated into an electronic device as an example. Figure 1 , the method specifically comprises the following steps:

[0028] S101: When a payment request for a service to be paid is received, a processing solution corresponding to the payment request is determined based on the service key and technical key included in the payment request.

[0029] Among them, pending payment services can be understood as orders that require payment, such as payment orders generated after a purchase instruction is issued, or payment orders generated after a payment instruction is issued. Payment requests can be understood as payment instructions for pending payment services, indicating the user's current willingness to pay to complete the order. Business keys and technical keys can be understood as two key pieces of information contained in an order. Business keys are business-related information about the order, including but not limited to the order number and order generation time. Technical keys are technical-related information about the order, including but not limited to the order type and order amount. These two pieces of information work together to determine the processing solution for the payment request.

[0030] In order to prevent the problem of repeated payment for the same order, the present invention will parse the payment request to determine whether the payment request is the first payment instruction for the business to be paid. Different order payment processes are formulated for different types of payment requests. For example, for the first payment instruction, the normal payment process can be directly triggered. For the second payment instruction, it is necessary to determine whether the corresponding business has been successfully paid, that is, to trigger the payment anti-duplicate process. The purpose of this setting is to reduce the probability of repeated payment on the basis of ensuring the smooth execution of the payment work.

[0031] The processing scheme of the present invention is a first processing scheme or a second processing scheme. The first processing scheme is used to start the payment process, and the second processing scheme is used to start the idempotent anti-duplicate process.

[0032] In one embodiment, S101 may specifically include: upon receiving a payment request for a business to be paid, determining a historical payment business set, wherein the historical payment business set includes at least one historical payment business, and the historical payment business includes a historical business key value and a historical technical key value; determining whether there is a matching payment business for the business to be paid in the historical payment business set, wherein the matching payment business is a payment business in which the historical business key value in the historical payment business set is the same as the business key value of the business to be paid and / or the historical technical key value is the same as the technical key value of the business to be paid; if there is no matching payment business for the business to be paid in the historical payment business set, determining that the processing solution is the first processing solution; if there is a matching payment business for the business to be paid in the historical payment business set, determining that the processing solution is the second processing solution.

[0033] Among them, the historical payment business set can be understood as all payment logs within the data processing period, including each payment business and detailed payment information of each payment business (payment successful, payment in progress, payment failed, etc.), which is used to determine whether the payment request of the current pending payment business is the first payment instruction and to quickly determine the payment result of the business corresponding to the second payment instruction. The matching payment business and its historical business key value and the historical business key value are used to indicate the historical payment information of the pending payment business. Once the business key value or technical key value of the pending payment business is the same as a business in the historical payment business set, that is, the pending payment business has found a matching payment business in the historical payment business set, it proves that the pending payment business has a payment record, and idempotent anti-duplicate is required to avoid repeated payment. The processing solution is determined to be the second processing solution. If the business key value or technical key value of the pending payment business is not recorded in the historical payment business set, that is, the pending payment business has not found a matching payment business in the historical payment business set, it proves that the pending payment business has no payment record, and the payment process can be triggered directly without the problem of repeated payment. The processing solution is determined to be the first processing solution.

[0034] For example, assuming that the historical payment business set includes three businesses, the historical business key value of historical payment business 1 is A1, and the historical technical key value is B1, the historical business key value of historical payment business 2 is A2, and the historical technical key value is B2, and the historical business key value of historical payment business 3 is A3, and the historical technical key value is B3. If the business key value of the business to be paid is A4, A5, etc., which are different from A1, A2, and A3, and the technical key value is B4, B5, etc., which are different from B1, B2, and B3, then it is considered that there is no matching payment business for the business to be paid in the historical payment business set, the payment request for the business to be paid is triggered for the first time, and the processing solution is the first processing solution. If the business key value of the business to be paid is any one of A1, A2, and A3 and / or the technical key value is any one of B1, B2, and B3, then it is considered that there is a matching payment business for the business to be paid in the historical payment business set, and idempotent anti-duplicate processing is required. The processing solution is the second processing solution, and the historical payment business with the same technical key value and / or business key value as the business to be paid is determined to be the matching payment business.

[0035] The advantage of this setting is that it can quickly, efficiently and specifically determine the processing procedures for pending payments, ensuring the security and real-time nature of account payment results.

[0036] Furthermore, the same key values ​​include three situations: the same technical key values, the same business key values, and the same technical key values ​​and business key values. The three situations can be divided into two situations based on whether the business key values ​​are the same or different. In order to improve the efficiency of idempotent anti-duplicate work, the present invention sets different idempotent anti-duplicate schemes for different situations. Specifically, the second processing scheme includes a business idempotent processing scheme and a technical idempotent processing scheme. Determining the second processing scheme includes: determining whether the historical business key value of the matching payment business is the same as the business key value of the business to be paid; if the historical business key value of the matching payment business is the same as the business key value of the business to be paid, then determining that the second processing scheme is a business idempotent processing scheme; if the historical business key value of the matching payment business is different from the business key value of the business to be paid, then determining that the second processing scheme is a technical idempotent processing scheme.

[0037] The business idempotent processing scheme indicates that the current payment request for a pending payment service has a duplicate business key value and requires business idempotent processing. The technical idempotent processing scheme indicates that the current payment request for a pending payment service has a duplicate technical key value and requires technical idempotent processing. The benefit of this setup is that it refines and categorizes the processing methods for re-payment requests based on their type, enabling better and more targeted determination of the payment results for each payment request for the pending payment service.

[0038] S102: Based on the first processing solution or the second processing solution, start the payment process or the idempotent anti-duplicate process, process the business key value and the technical key value of the payment request, and obtain the payment result of the business to be paid.

[0039] The first and second processing schemes are separate processes for different types of payment requests, designed to achieve global account duplication prevention and idempotency within a distributed architecture. The first processing scheme corresponds to the payment process, while the second processing scheme corresponds to the idempotent duplication prevention process. Specifically, the payment process indicates that the payment is a first payment, and the payment result obtained by executing this process is the first payment result; the idempotent duplication prevention process indicates that the payment is a second payment, and the payment result obtained by executing this process is the second payment result.

[0040] Exemplarily, when the processing scheme is the first processing scheme, the payment process is initiated, the payment process for the pending payment transaction is executed based on the business key and technical key of the payment request, and a first payment result is determined based on the payment status. For example, if the payment process is successfully executed, the first payment result is determined to be a payment success; if the payment process fails, the first payment result is determined to be a payment failure. When the processing scheme is the second processing scheme, the idempotent anti-duplicate process is initiated, the anti-duplicate payment process for the pending payment transaction is executed based on historical payment status (which can be understood as at least one first payment result of the pending payment transaction), the business key and technical key of the payment request, and a second payment result is determined based on the payment status. It is worth noting that the same transaction can only be successfully paid once. The second payment result is determined by determining whether the first payment result is successful. If the first payment result is a payment success, the payment for the pending payment transaction is determined to have been completed, and the second payment result is a failure. If the first payment result is a payment failure, the payment process is continued using the business key and technical key, and the second payment result is determined based on the payment status. Similarly, if the payment process is successfully executed, the second payment result is determined to be a payment success; if the payment process fails, the second payment result is determined to be a payment failure. The advantage of this setting is that it can effectively avoid the problem of duplicate payment.

[0041] In one embodiment, based on the first processing scheme, the payment process is initiated, the business key value and technical key value of the payment request are processed, and the payment result of the business to be paid is obtained, including: generating a first payment instruction based on the business key value and technical key value of the payment request, sending the first payment instruction to the accounting processing device, and receiving first payment feedback information from the accounting processing device; based on the first payment feedback information, determining the first payment result of the business to be paid.

[0042] The first payment instruction can be understood as an instruction carrying payment request information for the business to be paid, the account processing device can be understood as an account accounting or payment server, the first payment feedback information can be understood as the payment conclusion of the business to be paid obtained by the account processing device in response to the first payment instruction and after processing the payment request information carried in the first payment instruction, and the payment result application indicates the payment result of the business to be paid. For example, the payment conclusion can be the execution status of the business key value, the execution status of the technical key value, and the execution status of the business key value and the execution status of the technical key value are used to determine the payment result of the business to be paid.

[0043] Specifically, when the first payment feedback information indicates that the business key and technical key of the payment request were successfully executed, the first payment result is determined to be payment successful; when the first payment feedback information indicates that the business key and technical key of the payment request were unsuccessful, the first payment result is determined to be payment failed; and when the first payment feedback information indicates that the execution status of the business key and technical key of the payment request is unknown, the first payment result is determined to be payment in progress. The advantage of this setting is that the payment result of the pending payment business can be obtained accurately and specifically.

[0044] Furthermore, before generating the first payment instruction based on the business key value and technical key value of the payment request, the key value information of the technical key value of the payment request is written into the database, and the key value information of the business key value of the payment request is written into the distributed cache device and the database; after obtaining the first payment result of the business to be paid, the key value information of the distributed cache device and the database is adjusted based on the first payment result; wherein, the key value information is used to determine the payment result of the re-payment work, and when the first payment result is a successful payment, the key value information in the distributed cache device and the database is updated based on the first payment result, that is, the key value information of the business key value in the distributed cache device is updated to success, and the key value information of the business key value and the technical key value in the database is updated to success. The key value information in the database can be understood as anti-duplication details; when the first payment result is a failed payment, the key value information in the distributed cache device is deleted and the key value information in the database is updated, that is, the information of the business key value in the distributed cache device and the database is deleted, and the technical key value is updated to failure. This setting will not affect subsequent payment work and will also leave a complete payment record, thereby ensuring the traceability of transaction data.

[0045] In another embodiment, based on the second processing scheme, an idempotent anti-duplicate process is started, and the business key value and technical key value of the payment request are processed to obtain the payment result of the business to be paid, including: when the second processing scheme is a technical idempotent processing scheme, determining that the second payment result is a business rejection; when the second processing scheme is a business idempotent processing scheme, determining whether the historical technical key value of the matching payment business is the same as the technical key value of the business to be paid; if the historical technical key value of the matching payment business is the same as the technical key value of the business to be paid, then determining that the second payment result is the payment result of the matching payment business, that is, the payment result of the idempotent first payment; if the historical technical key value of the matching payment business is different from the technical key value of the business to be paid, then determining whether the payment result of the matching payment business is a payment failure; when the payment result of the matching payment business is not a payment failure, determining that the second payment result is a payment failure, and returning the transaction identification information of the business to be paid; when the payment result of the matching payment business is a payment failure, generating a second payment instruction based on the business key value and technical key value of the payment request, sending the second payment instruction to the accounting processing device, and determining the second payment result based on the second payment feedback information of the accounting processing device.

[0046] Similarly, the second payment instruction carries payment request information for the pending payment transaction. The second payment feedback information is the payment conclusion for the pending payment transaction obtained by the accounting processing device in response to the second payment instruction and after processing the payment request information carried in the second payment instruction. The payment result should indicate the payment result for the pending payment transaction. Specifically, when the first payment result is successful, the second payment result will fail to avoid duplicate payments. When the first payment result fails, the payment process will continue using the technical key and business key in the second payment request, and the second payment result will be determined based on the information fed back by the accounting processing device.

[0047] Table 1 shows the payment status relationship, indicating the correspondence between payment results and payment request information. The transaction scenario is used to indicate whether the payment request is submitted for the first time. The business key represents the business key value, the technical key represents the technical key value, the execution status represents the execution status of the business key value and the technical key value, the execution result represents the payment result, the database represents the conclusion stored in the database, the slash indicates that the execution result is not written to the database, the written information can be understood as anti-duplicate details, and the serial number can be understood as key value information. Table 1 distinguishes between resubmission and secondary submission. In fact, the secondary submission can also follow the resubmission process, and the present invention does not limit this.

[0048] Table 1 Payment status relationship

[0049]

[0050]

[0051] The main content of Table 1 is as follows: when making the first payment, the payment result is determined based on the execution status of A1 and B1. When making the second payment, the payment result of the second payment is determined based on the key value information and the first payment result. If the key value information is A1 and B1, the first payment result is directly fed back. If the key value information is A2 and B1, the payment is rejected. If the key value information is A1 and B2, it is first determined whether A1 and B1 fail. If A1 and B1 succeed, it is directly determined that A1 and B2 fail. Only if A1 and B1 fail will A1 and B2 be used to continue the payment process, and the payment result is determined based on the execution status of A1 and B2.

[0052] The distributed cache device of the present invention can be a REDIS (an in-memory data structure storage database) cache, which connects multiple distributed systems to achieve the purpose of data transfer and caching, and realizes the global idempotence and anti-duplicate of accounts under the distributed system. The advantages of adopting this design are: 1) Solving the anti-duplicate protection problem under the distributed architecture. When the REDIS cache fails, the local anti-duplicate of the database can be used to ensure the availability of anti-duplicate. 2) Solving the global anti-duplicate problem under the distributed architecture. Anti-duplicate filtering of payment services based on the REDIS distributed cache can improve the performance of business processing and reduce the pressure on the database.

[0053] S103: Control the information interaction interface to display the payment result.

[0054] Specifically, the information interaction interface can be understood as an information display screen. The purpose of controlling the information interaction interface to display the payment results is to visualize the payment results, so that the payer can understand the payment status of the pending payment business and take corresponding processing measures in a timely manner.

[0055] It's worth noting that if the payment result is a failure, the information interaction interface can also be controlled to display the reason for the payment failure, allowing the payer to adjust the payment request or the business parameters of the pending payment. For example, if the displayed amount is too large, the payment can be made in batches. If the balance is insufficient, the payer can be prompted to resolve the balance issue before initiating the payment process.

[0056] The technical solution of this embodiment determines whether the payment request is triggered for the first time through the payment request business key value and technical key value of the business to be paid. If it is triggered for the first time, the payment process is started. If it is triggered for the second time, the idempotent anti-duplicate process is started to avoid the problem of repeated payments caused by the payment system responding to multiple payment requests, ensure the security of the payment work, and visualize the payment results, so that the payment requester can understand the payment status of the business to be paid in a timely manner, thereby improving the payment experience of the payment requester.

[0057] Figure 2 This is a schematic diagram of a payment process provided by the present invention. Figure 2 It is a complete business payment process, such as Figure 2As shown in the figure, the payment process mainly includes:

[0058] 1. The product server sends a payment instruction to the payment server.

[0059] The essence of this step is to send the payer's payment request to the payment service. The payment instruction is essentially the business key and technical key of the business to be paid.

[0060] 2. The payment service writes the business key value into the distributed cache.

[0061] 3. The distributed cache feeds back the writing status of the business key value to the payment business.

[0062] Figure 2 The business key value is written successfully.

[0063] 4. The payment service writes the business key and technical key into the database.

[0064] 5. The database provides feedback to the payment service on the writing status of technical key values ​​and business key values.

[0065] Similarly, Figure 2 The writing status of the technical key value and business key value is successful.

[0066] 6. The payment service sends payment instructions to the core accounting service.

[0067] 7. The core accounting service sends the payment conclusion to the payment service.

[0068] The payment conclusion is whether the payment is successful.

[0069] 8. The payment service updates / deletes the key-value information in the distributed cache based on the payment conclusion.

[0070] Specifically, when the payment is successful, the key value information in the distributed cache is updated, and when the payment fails, the key value information in the distributed cache is deleted.

[0071] 9. The distributed cache sends the key-value information to the payment service.

[0072] 10. The payment service updates / deletes the key value information in the database based on the payment conclusion.

[0073] Specifically, when the payment is successful, the key value information in the distributed cache is updated, and when the payment fails, the key value information in the distributed cache is deleted. It is worth noting that the transaction details status in the database will be updated regardless of success or failure.

[0074] 11. The database sends the key-value information to the payment service.

[0075] 12. Payment service product and service feedback payment results.

[0076] Specifically, the feedback of payment results can be understood as a visual display of the payment results, which makes it easier for the payer to understand the payment status of the pending payment business.

[0077] The beneficial effects of the present invention include: 1) Supporting service idempotence. Specifically, for payment data submitted repeatedly, the original data processing result is returned by default, and the response data is displayed to indicate that the data has been processed. In addition, when it is determined that it is an idempotent request, the consistency of the business elements will be checked. If the business elements are inconsistent, the transaction will be rejected, and the user will be reminded to check the business elements to prevent accounting risks. 2) Global anti-duplication is performed based on the REDIS cache. Specifically, if the insertion of the global anti-duplication key value fails, the exception return message is encapsulated. If the payment fails, the global business anti-duplication key value is deleted for subsequent retries. If successful or unknown, the global business anti-duplication is not deleted, and the original transaction processing result is returned idempotently. 3) Database anti-duplication is implemented based on the business anti-duplication table. Ensure that the system can route the same transaction to the same database shard based on the business flow. Within the same shard, it can be determined whether it is the same business based on the primary key of the business anti-duplication table. If it is the same business and the payment status is unknown or successful, the original processing result is returned idempotently. 4) Support service failure redo. Specifically, for failed payment services, the business flow remains unchanged, and it supports replacing the technical flow and re-initiating. When the system determines that the original transaction has failed, it can continue the payment process to avoid repeated payments while ensuring the payment quality of the business.

[0078] Figure 3 This is a schematic diagram of the structure of an idempotent anti-duplicate device for accounting services provided by the present invention. Figure 3 As shown, the device includes: a solution determination module 201, a result determination module 202 and a result display module 203.

[0079] The solution determination module 201 is used to determine the processing solution corresponding to the payment request based on the business key value and technical key value included in the payment request when receiving the payment request for the service to be paid, wherein the processing solution is the first processing solution or the second processing solution, the first processing solution is used to start the payment process, and the second processing solution is used to start the idempotent anti-duplicate process.

[0080] The result determination module 202 is used to start the payment process or the idempotent anti-duplicate process based on the first processing solution or the second processing solution, process the business key value and the technical key value of the payment request, and obtain the payment result of the to-be-paid business.

[0081] The result display module 203 is used to control the information interaction interface and display the payment results.

[0082] Optionally, the solution determination module 201 is specifically used to determine a historical payment business set, wherein the historical payment business set includes at least one historical payment business, and the historical payment business includes a historical business key value and a historical technical key value; determine whether there is a matching payment business for the business to be paid in the historical payment business set, wherein the matching payment business is a payment business in which the historical business key value in the historical payment business set is the same as the business key value of the business to be paid and / or the historical technical key value is the same as the technical key value of the business to be paid; if there is no matching payment business for the business to be paid in the historical payment business set, determine that the processing solution is the first processing solution; if there is a matching payment business for the business to be paid in the historical payment business set, determine that the processing solution is the second processing solution.

[0083] Optionally, the second processing scheme includes a business idempotent processing scheme and a technical idempotent processing scheme. The scheme determination module 201 is specifically used to determine whether the historical business key value of the matching payment business is the same as the business key value of the business to be paid; if the historical business key value of the matching payment business is the same as the business key value of the business to be paid, the second processing scheme is determined to be a business idempotent processing scheme; if the historical business key value of the matching payment business is not the same as the business key value of the business to be paid, the second processing scheme is determined to be a technical idempotent processing scheme.

[0084] Optionally, the payment process is used to indicate that the business to be paid is the first payment work, and the payment result is the first payment result. The result determination module 202 is specifically used to generate a first payment instruction based on the business key value and technical key value of the payment request, send the first payment instruction to the accounting processing device, and receive the first payment feedback information of the accounting processing device; based on the first payment feedback information, determine the first payment result of the business to be paid; wherein, when the first payment feedback information indicates that the business key value and technical key value of the payment request are executed successfully, the first payment result is determined to be a successful payment; when the first payment feedback information indicates that the business key value and technical key value of the payment request fail to execute, the first payment result is determined to be a failed payment; when the first payment feedback information indicates that the execution status of the business key value and technical key value of the payment request is in an unknown state, the first payment result is determined to be a payment in progress state.

[0085] Optionally, the result determination module 202 is also used to write the key value information of the technical key value of the payment request into the database, and write the key value information of the business key value of the payment request into the distributed cache device and the database before generating the first payment instruction based on the business key value and the technical key value of the payment request; after obtaining the first payment result of the business to be paid, adjust the key value information of the distributed cache device and the database based on the first payment result; wherein the key value information is used to determine the payment result of the re-payment work, when the first payment result is a successful payment, update the key value information in the distributed cache device and the database based on the first payment result; when the first payment result is a failed payment, delete the key value information in the distributed cache device and the database and update the key value information in the database.

[0086] Optionally, the idempotent anti-duplicate process is used to indicate that the business to be paid is a re-payment work, and the payment result is a second payment result. The result determination module 202 is specifically used to determine that the second payment result is a business rejection when the second processing scheme is a technical idempotent processing scheme; when the second processing scheme is a business idempotent processing scheme, determine whether the historical technical key value of the matching payment business is the same as the technical key value of the business to be paid; if the historical technical key value of the matching payment business is the same as the technical key value of the business to be paid, determine that the second payment result is the payment result of the matching payment business; if the historical technical key value of the matching payment business is different from the technical key value of the business to be paid, determine whether the payment result of the matching payment business is a payment failure; when the payment result of the matching payment business is not a payment failure, determine that the second payment result is a payment failure, and return the flow identification information of the business to be paid. When the payment result of the matching payment business is a payment failure, generate a second payment instruction based on the business key value and technical key value of the payment request, send the second payment instruction to the accounting processing device, and determine the second payment result based on the second payment feedback information of the accounting processing device.

[0087] The idempotent anti-duplication device for accounts provided in this embodiment can execute the idempotent anti-duplication method for accounts provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0088] Figure 4 : is a structural diagram of an electronic device provided by the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0089] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (also known as random access memory, RAM) 13, etc., wherein the memory stores a computer program that can be executed by the at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12 and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0090] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0091] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any other suitable processors, controllers, microcontrollers, etc. Processor 11 executes the various methods and processes described above, such as the idempotent anti-duplication method for accounting transactions.

[0092] In some embodiments, the idempotent anti-duplication method for accounts can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the idempotent anti-duplication method for accounts described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the idempotent anti-duplication method for accounts in any other appropriate manner (for example, by means of firmware).

[0093] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0094] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0095] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device or any suitable combination of the foregoing.

[0096] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device that has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0097] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0098] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0099] In one embodiment, the present invention further includes a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the idempotent anti-duplication method for accounts of any embodiment of the present invention.

[0100] The computer program product may be implemented in a computer program code for performing the operations of the present invention written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​and conventional procedural programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0101] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0102] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. An idempotent anti-duplicate method for accounting, characterized in that: include: Upon receiving a payment request for a service to be paid, determining a historical payment service set, wherein the historical payment service set includes at least one historical payment service, and the historical payment service includes a historical service key and a historical technical key; Determining whether there is a matching payment service for the service to be paid in the historical payment service set, wherein the matching payment service is a payment service in the historical payment service set having a historical service key value identical to a service key value of the service to be paid and / or having a historical technical key value identical to a technical key value of the service to be paid; If there is no matching payment service for the service to be paid in the historical payment service set, determining the processing solution to be the first processing solution, wherein the first processing solution is used to start the payment process; If a matching payment transaction exists in the historical payment transaction set for the transaction to be paid, determining the second processing solution as the processing solution, wherein the second processing solution is used to start the idempotent anti-duplicate process; Based on the first processing solution or the second processing solution, starting the payment process or the idempotent anti-duplicate process, processing the business key value and the technical key value of the payment request, and obtaining the payment result of the to-be-paid business; The control information interaction interface displays the payment result.

2. The method according to claim 1, characterized in that The second processing solution includes a business idempotent processing solution and a technical idempotent processing solution. Determining the second processing solution includes: Determining whether the historical service key value of the matched payment service is the same as the service key value of the service to be paid; If the historical business key value of the matched payment business is the same as the business key value of the business to be paid, determining that the second processing solution is the business idempotent processing solution; If the historical business key value of the matched payment business is different from the business key value of the business to be paid, the second processing solution is determined to be the technical idempotent processing solution.

3. The method according to claim 2, characterized in that The payment process is used to indicate that the business to be paid is a first payment operation, and the payment result is a first payment result; based on the first processing scheme, starting the payment process, processing the business key value and the technical key value of the payment request, and obtaining the payment result of the business to be paid, including: generating a first payment instruction based on the business key and the technical key of the payment request, sending the first payment instruction to the account processing device, and receiving first payment feedback information from the account processing device; Based on the first payment feedback information, a first payment result of the to-be-paid business is determined; wherein, when the first payment feedback information indicates that the business key value and the technical key value of the payment request are executed successfully, the first payment result is determined to be a successful payment; when the first payment feedback information indicates that the business key value and the technical key value of the payment request are executed unsuccessfully, the first payment result is determined to be a failed payment; and when the first payment feedback information indicates that the execution status of the business key value and the technical key value of the payment request is in an unknown state, the first payment result is determined to be a payment in progress state.

4. The method according to claim 3, characterized in that Also includes: Before generating the first payment instruction based on the business key and the technical key of the payment request, writing key value information of the technical key of the payment request into a database, and writing key value information of the business key of the payment request into a distributed cache device and the database; After obtaining the first payment result of the business to be paid, the key value information of the distributed cache device and the database is adjusted based on the first payment result; wherein, the key value information is used to determine the payment result of the re-payment work, and when the first payment result is a successful payment, the key value information in the distributed cache device and the database is updated based on the first payment result; when the first payment result is a failed payment, the key value information in the distributed cache device is deleted and the key value information in the database is updated.

5. The method according to claim 3, characterized in that The idempotent anti-duplicate process is used to indicate that the pending payment service is a re-payment process and the payment result is a second payment result; based on the second processing scheme, the idempotent anti-duplicate process is started to process the business key and technical key of the payment request to obtain the payment result of the pending payment service, including: When the second processing solution is the technical idempotent processing solution, determining that the second payment result is business rejection; When the second processing scheme is the service idempotent processing scheme, determining whether the historical technical key value of the matched payment service is the same as the technical key value of the service to be paid; If the historical technical key value of the matched payment service is the same as the technical key value of the service to be paid, determining the second payment result as the payment result of the matched payment service; If the historical technical key value of the matched payment service is different from the technical key value of the service to be paid, determining whether the payment result of the matched payment service is payment failure; When the payment result of the matched payment business is not payment failure, the second payment result is determined to be payment failure, and the transaction identification information of the business to be paid is returned; when the payment result of the matched payment business is payment failure, a second payment instruction is generated based on the business key value and technical key value of the payment request, the second payment instruction is sent to the accounting processing device, and the second payment result is determined based on the second payment feedback information of the accounting processing device.

6. An idempotent anti-duplication device for accounts, characterized in that: The idempotent anti-duplicate method for an account transaction according to any one of claims 1 to 5 is implemented, wherein the idempotent anti-duplicate device for an account transaction comprises: a solution determination module, configured to, upon receiving a payment request for a service to be paid, determine a historical payment service set, wherein the historical payment service set includes at least one historical payment service, and the historical payment service includes a historical service key and a historical technology key; The solution determination module is configured to determine whether there is a matching payment service for the service to be paid in the historical payment service set, wherein the matching payment service is a payment service in the historical payment service set having a historical service key value identical to a service key value of the service to be paid and / or a historical technical key value identical to a technical key value of the service to be paid; The solution determination module is configured to determine a first processing solution as starting a payment process if there is no matching payment service for the service to be paid in the historical payment service set; The solution determination module is configured to determine a second processing solution if a matching payment service exists in the historical payment service set, and the second processing solution is configured to start an idempotent anti-duplicate process; A result determination module is configured to start the payment process or the idempotent anti-duplicate process based on the first processing solution or the second processing solution, process the business key and technical key of the payment request, and obtain a payment result for the pending payment service; The result display module is used to control the information interaction interface and display the payment result.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the idempotent anti-duplication method for accounts as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the idempotent anti-duplication method for accounts as described in any one of claims 1 to 5 when executed.

9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the idempotent anti-duplication method for accounts according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • High-concurrency payment order anti-duplication method, device, system and equipment, medium and program product

    CN115374098A

  • Repeated payment prevention method and device based on order state idempotent control

    CN115730938A