A blind scan payment method of an intelligent printer
By establishing a mapping relationship and a dual-channel mechanism in the cloud server, the problem of direct connection between SaaS POS system and smart printer in different network environments is solved, realizing the collaborative payment process between smart printer and POS machine, improving the flexibility and reliability of the payment process, and ensuring the accuracy of transaction data.
Patent Information
- Application Number
- CN202610090475.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-23
- Publication Date
- 2026-06-23
- Estimated Expiration
- 2046-01-23
AI Technical Summary
Existing SaaS POS systems and smart printers are difficult to connect directly in different network environments, resulting in a lack of collaborative work and affecting the smoothness and efficiency of the payment process.
By establishing a first mapping relationship between the smart printer device number and the payment request serial number, and a second mapping relationship between the payment request serial number and the payment code string through a cloud server, a dual-channel mechanism combining a segmented polling strategy and a push channel is adopted to realize data transfer and logical association between the cash register and the smart printer, ensuring the reliability and flexibility of the payment process.
This enables smart printers to complete collaborative payment processes without directly communicating with cash registers, improving flexibility and applicability, reducing invalid queries, enhancing the responsiveness and reliability of the payment process, and avoiding the risks of missed orders or duplicate payments.
Smart Images

Figure CN121563506B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a blind scanning payment method for a smart printer. Background Technology
[0002] With the rapid development and widespread adoption of mobile payment technology, merchant checkout scenarios are placing increasingly higher demands on the functionality and flexibility of payment devices. In traditional checkout scenarios, merchants typically need to configure multiple independent devices such as a POS terminal, barcode scanner, and printer to complete the entire checkout process. This not only increases equipment procurement and maintenance costs but also complicates the spatial layout of the checkout counter. To address this issue, intelligent POS terminal devices integrating multiple functions have emerged on the market. These devices simplify the complexity of the checkout system to some extent by integrating scanning, printing, and payment modules.
[0003] Meanwhile, SaaS (Software as a Service) POS systems based on cloud computing technology have also been widely adopted. SaaS POS systems deploy POS business logic on cloud servers, allowing merchants to connect to cloud services through locally installed POS software terminals to achieve functions such as product management, order processing, and data statistics. This model offers advantages such as flexible deployment, convenient updates, and centralized data management, making it popular among chain stores and small and medium-sized merchants. However, compatibility issues exist between SaaS POS systems and existing smart POS devices, especially smart printers that already have independent payment processing capabilities. How to enable these printers to work collaboratively with SaaS POS systems without altering their hardware structure has become a technical challenge that the industry needs to solve.
[0004] Chinese patent application CN110580785B discloses a POS system and its application, including a POS device and a POS method, filed in August 2019. The disclosed technical solution includes an input unit, a display unit, a scanning unit, and a system module. This device can acquire transaction amount data and perform scanning payment operations with the customer's device to generate payment data. Then, the system module sends the transaction amount data, pre-stored payment account information, and payment data to the cloud to complete the payment. However, when merchants use both smart printers and SaaS software, the POS system cannot coordinate with the smart printing device, as it does not support direct connection between the POS system and the cash register via USB cable. Summary of the Invention
[0005] In view of this, the present invention proposes a blind scanning payment method for smart printers, which solves the problem of difficulty in direct connection between SaaS POS systems and smart printers in different network environments in the prior art. It realizes data transfer and logical association between POS machines and smart printers, so that smart printers can complete collaborative payment processes without direct communication with POS machines.
[0006] The technical solution of this invention is implemented as follows: This invention provides a blind scanning payment method for smart printers, comprising the following steps:
[0007] S1. The cash register calculates the transaction amount based on the product information. After receiving the payment instruction, it generates a payment request serial number and sends it to the cloud server. The cloud server establishes a first mapping relationship between the smart printer device number and the payment request serial number in the cache service and sends a voice broadcast instruction to the smart printer.
[0008] S2. When the smart printer is in collaborative payment mode, it receives a voice broadcast command, triggers voice broadcast and starts scanning. After scanning the customer's payment code to obtain the payment code string, it uploads the payment code string and the smart printer device number to the cloud server. The cloud server queries the corresponding payment request serial number through the first mapping relationship based on the smart printer device number, and establishes a second mapping relationship in the cache service based on the payment request serial number and the payment code string.
[0009] S3. After sending the payment request serial number, the cash register starts a polling task. It adopts a segmented polling strategy to send query requests to the cloud server at polling intervals. The cloud server queries the payment request serial number in the query request through the second mapping relationship. If the associated payment code string is found, the payment code string is returned. If it is not found, a not ready response is returned.
[0010] S4. After sending the payment request serial number, the cash register establishes a push channel with the cloud server. After establishing the second mapping relationship, the cloud server pushes a payment code ready notification to the cash register through the push channel. After receiving the payment code ready notification, the cash register stops the polling task and requests the payment code string from the cloud server according to the payment request serial number in the payment code ready notification. The cloud server returns the payment code string according to the payment request serial number through the second mapping relationship.
[0011] S5. After the cash register obtains the payment code string, it generates a deduction request and calls the payment platform interface to send it to the payment platform. The payment platform completes the deduction based on the payment code string in the deduction request and returns the payment result. The cash register generates print data based on the payment result and sends a print instruction to the smart printer through the cloud server. The smart printer outputs the transaction receipt according to the print instruction.
[0012] Based on the above technical solutions, preferably, step S3 specifically includes:
[0013] S31. After sending the payment request serial number, the cash register starts a polling task and records the time when the payment request is initiated.
[0014] S32. The cash register calculates the time difference between the current time and the time when the payment request was initiated, and determines the current polling time interval based on the time stage in which the time difference is located;
[0015] S33. The cash register sends a query request to the cloud server at polling intervals. The cloud server checks whether there is an associated payment code string based on the payment request serial number in the query request. If it exists, it returns the payment code string; otherwise, it returns a not ready response.
[0016] S34. When the cash register receives the payment code string, it stops the polling task. When the time difference reaches the preset timeout period, it stops the polling task and marks the timeout status.
[0017] Based on the above technical solutions, preferably, step S32 specifically includes:
[0018] The time window from the moment the payment request is initiated to the preset timeout period is divided into a first time phase, a second time phase, and a third time phase.
[0019] The cash register determines the current time stage based on the time difference:
[0020] The first polling interval is set when the time difference is in the first time phase, the second polling interval is set when the time difference is in the second time phase, and the third polling interval is set when the time difference is in the third time phase, wherein the second polling interval is shorter than the first polling interval.
[0021] Based on the above technical solutions, preferably, step S4 specifically includes:
[0022] S41. When the cash register sends the payment request serial number, it establishes a push channel with the cloud server that supports the server to actively push messages.
[0023] S42. After establishing the second mapping relationship, the cloud server generates a payment code ready notification and pushes the payment code ready notification to the cash register through the push channel.
[0024] S43. After receiving the payment code ready notification, the cash register extracts the payment request serial number from the payment code ready notification, stops the polling task, and sends a request to the cloud server.
[0025] S44. After receiving the retrieval request, the cloud server retrieves the payment code string through the second mapping relationship based on the payment request serial number in the retrieval request and returns it to the cash register.
[0026] Based on the above technical solutions, preferably, when the push channel fails to push or the cash register does not receive the payment code ready notification, the cash register obtains the payment code string from the cloud server through a polling task.
[0027] Based on the above technical solutions, the preferred option also includes order recovery for timed-out orders, specifically including:
[0028] Once the cash register is marked as timed out, the order status is changed to pending verification, and the order information is sent to the cloud server. The order information includes the payment request serial number, transaction amount, and timeout time.
[0029] After receiving the order information, the cloud server creates a delayed verification task, which is triggered to execute at the verification time point after the timeout period.
[0030] When the delayed verification task is executed, the cloud server sends the payment request serial number to the order query interface of the payment platform. The payment platform returns the current payment status of the order based on the payment request serial number. The current payment status of the order includes unpaid, in progress, successful payment, failed payment, and closed.
[0031] The cloud server updates the order status based on the current payment status.
[0032] Based on the above technical solution, preferably, the delayed verification task is set with N verification time points, the i-th verification time point is the sum of the timeout moment and the i-th time interval, where i is a positive integer and 1≤i≤N, and the (i+1)-th time interval is greater than the i-th time interval;
[0033] The delayed verification task performs an order query once at each verification time point. When the current payment status returned by the query is payment successful, unpaid, or closed, the query for subsequent verification time points is stopped. When the current payment status returned by the query is payment in progress, the query continues to be executed at the next verification time point.
[0034] Based on the above technical solutions, preferably, step S5 specifically includes:
[0035] After the cash register obtains the payment code string, it generates a deduction request and calls the scanned payment interface provided by the payment platform to send the deduction request to the payment platform; the deduction request includes the merchant number, transaction amount, payment code string and payment request serial number;
[0036] After verifying the validity of the merchant number, signature, and payment code string, the payment platform identifies the corresponding user account based on the payment code string, deducts the transaction amount from the user account, generates a payment result, and returns it to the cash register.
[0037] After receiving the payment result, the cash register generates print data when the payment status in the payment result is "payment successful". It then sends a print instruction containing the print data to the smart printer through the cloud server. The print data includes the transaction time, transaction amount, and payment request serial number.
[0038] After receiving a print command, the smart printer extracts the print data from the command and outputs it as a transaction receipt.
[0039] Based on the above technical solutions, preferably, step S1 specifically includes:
[0040] The cash register receives product information and calculates the total transaction amount based on that information.
[0041] After receiving a payment instruction, the cash register obtains the current timestamp, merchant identifier, cash register device number, and random number, and concatenates the current timestamp, merchant identifier, cash register device number, and random number to generate a payment request serial number;
[0042] The cash register generates a payment request message and sends it to the cloud server; the payment request message includes a payment request serial number, transaction amount, and merchant information.
[0043] After receiving the payment request message, the cloud server verifies the format of the payment request serial number and the range of the transaction amount. Once the verification is successful, it establishes a first mapping relationship in the cache service using the smart printer device number pre-bound to the merchant information as the key and the payment request serial number as the value, and sends a voice broadcast command to the smart printer corresponding to the smart printer device number.
[0044] Furthermore, step S2 specifically includes:
[0045] After receiving the voice broadcast command, the smart printer plays the voice prompt and simultaneously starts the smart printer's barcode scanning module to enter the scanning ready state.
[0046] The smart printer's scanning module scans the customer's payment code, decodes the scanned payment code, and extracts the payment code string.
[0047] The smart printer encapsulates the payment code string and the smart printer device number and uploads them to the cloud server;
[0048] After receiving the uploaded data, the cloud server extracts the payment code string and the smart printer device number. In the cache service, it uses the smart printer device number as the key to query the corresponding payment request serial number through the first mapping relationship. In the cache service, it establishes a second mapping relationship using the payment request serial number as the key and the payment code string as the value.
[0049] The blind scanning payment method for a smart printer of the present invention has the following advantages over the prior art:
[0050] (1) By establishing a first mapping relationship between the smart printer device number and the payment request serial number, and a second mapping relationship between the payment request serial number and the payment code string through the cloud server, the data transfer and logical association between the cash register and the smart printer are realized, so that the smart printer can complete the collaborative payment process without communicating directly with the cash register, while maintaining the independent payment collection capability of the smart printer and improving the flexibility and applicability of the smart printer.
[0051] (2) By adopting a segmented polling strategy, the query frequency and actual demand were dynamically matched, which reduced the number of invalid queries while ensuring the timely response of the payment process.
[0052] (3) By combining polling tasks with push channels, the problem of payment process interruption caused by single channel failure is avoided, thus improving reliability and fault tolerance.
[0053] (4) By restoring overdue orders, the risk of missing orders or duplicate payments is avoided, and the accuracy of transaction data is guaranteed. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1 This is a flowchart of a blind scanning payment method for a smart printer according to the present invention;
[0056] Figure 2 This is a system architecture diagram of a blind scanning payment method for an intelligent printer according to the present invention;
[0057] Figure 3 This is a timing diagram of the segmented polling strategy for a blind scanning payment method for an intelligent printer according to the present invention.
[0058] Figure 4 This is a schematic diagram of the dual-channel acquisition mechanism of a blind scanning payment method for an intelligent printer according to the present invention. Detailed Implementation
[0059] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0060] like Figure 1 and Figure 2 As shown, the present invention provides a blind scanning payment method for a smart printer, comprising the following steps:
[0061] S1. The cash register calculates the transaction amount based on the product information. After receiving the payment instruction, it generates a payment request serial number and sends it to the cloud server. The cloud server establishes a first mapping relationship between the smart printer device number and the payment request serial number in the cache service and sends a voice broadcast instruction to the smart printer.
[0062] Specifically, step S1 includes:
[0063] The cash register receives product information and calculates the total transaction amount based on that information.
[0064] After receiving a payment instruction, the cash register obtains the current timestamp, merchant identifier, cash register device number, and random number, and concatenates the current timestamp, merchant identifier, cash register device number, and random number to generate a payment request serial number;
[0065] The cash register generates a payment request message and sends it to the cloud server; the payment request message includes a payment request serial number, transaction amount, and merchant information.
[0066] After receiving the payment request message, the cloud server verifies the format of the payment request serial number and the range of the transaction amount. Once the verification is successful, it establishes a first mapping relationship in the cache service using the smart printer device number pre-bound to the merchant information as the key and the payment request serial number as the value, and sends a voice broadcast command to the smart printer corresponding to the smart printer device number.
[0067] Understandably, the cash register receives product information by scanning product barcodes with a barcode scanner or through an input device. Payment request messages can use structured data formats such as JSON or XML, and the cash register sends these messages to the cloud server via HTTPS encryption. Voice commands are sent via IoT communication protocols, such as MQTT or HTTP, and include information such as the command type and voice text. For example, if the command type is "VOICE_PLAY," the voice text might be "Please show your payment code." The cloud server then queries the smart printer's device ID to find its communication address or connection identifier and pushes the voice command to the target printer.
[0068] In one embodiment of the present invention, the verification includes whether the format of the payment request serial number conforms to preset rules, such as checking whether the timestamp format is correct, whether the merchant identifier exists in the system, and whether the random number length meets the requirements, etc., and verifying the numerical range of the transaction amount, such as checking whether the amount is positive, whether it exceeds the single transaction limit, and whether the number of decimal places meets the requirements, etc. At the same time, it also verifies whether the merchant account status is normal, such as whether the merchant has been frozen or cancelled.
[0069] S2. When the smart printer is in collaborative payment mode, it receives a voice broadcast command, triggers voice broadcast and starts scanning. After scanning the customer's payment code to obtain the payment code string, it uploads the payment code string and the smart printer device number to the cloud server. The cloud server queries the corresponding payment request serial number through the first mapping relationship based on the smart printer device number, and establishes a second mapping relationship in the cache service based on the payment request serial number and the payment code string.
[0070] Specifically, step S2 includes:
[0071] After receiving the voice broadcast command, the smart printer plays the voice prompt and simultaneously starts the smart printer's barcode scanning module to enter the scanning ready state.
[0072] The smart printer's scanning module scans the customer's payment code, decodes the scanned payment code, and extracts the payment code string.
[0073] The smart printer encapsulates the payment code string and the smart printer device number and uploads them to the cloud server;
[0074] After receiving the uploaded data, the cloud server extracts the payment code string and the smart printer device number. In the cache service, it uses the smart printer device number as the key to query the corresponding payment request serial number through the first mapping relationship. In the cache service, it establishes a second mapping relationship using the payment request serial number as the key and the payment code string as the value.
[0075] Understandably, the scanning module can be a 1D barcode scanner, a 2D barcode scanner, or a camera scanning module. The scanning module decodes the acquired barcode or 2D barcode image, using a suitable decoding algorithm to extract the contained data information and obtain the payment code string.
[0076] By using cloud server relay and first and second mapping relationships, the cash register and smart printer, which originally needed to communicate directly, are decoupled. The smart printer does not need to know which cash register initiated the request, and the cash register does not need to know which printer completed the scan. The two are logically associated only through a unified payment request serial number, which improves the system's flexibility and scalability.
[0077] In one embodiment of the present invention, the encapsulation format is JSON, for example, {"device_id":"PRINTER-A001","payment_code":"134567890123456789"}. The smart printer uploads the encapsulated data to a cloud server via a network connection.
[0078] S3. After sending the payment request serial number, the cash register starts a polling task. It adopts a segmented polling strategy to send query requests to the cloud server at polling intervals. The cloud server queries the payment request serial number in the query request through the second mapping relationship. If the associated payment code string is found, the payment code string is returned. If it is not found, a not ready response is returned. The segmented polling strategy sets the corresponding polling interval according to the time stage of the time difference between the current time and the time when the payment request was initiated.
[0079] like Figure 3 and Figure 4 As shown, specifically, step S3 includes:
[0080] S31. After sending the payment request serial number, the cash register starts a polling task and records the time when the payment request is initiated.
[0081] S32. The cash register calculates the time difference between the current time and the time when the payment request was initiated, and determines the current polling time interval based on the time stage in which the time difference is located;
[0082] S33. The cash register sends a query request to the cloud server at polling intervals. The cloud server checks whether there is an associated payment code string based on the payment request serial number in the query request. If it exists, it returns the payment code string; otherwise, it returns a not ready response.
[0083] S34. When the cash register receives the payment code string, it stops the polling task. When the time difference reaches the preset timeout period, it stops the polling task and marks the timeout status.
[0084] Understandably, if a matching payment code string is found, it means the smart printer has completed scanning and uploading, and the payment code is ready. The cloud server returns a response containing the payment code string to the cash register. If no matching payment code string is found, it means the smart printer has not yet completed scanning or the payment code has not yet been uploaded, and the payment code is not ready. The cloud server returns a "not ready" response to the cash register. When the cash register receives a "not ready" response, it continues to run the polling task. After waiting for the current polling interval, the cash register recalculates the time difference, determines a new polling interval, and initiates the next query request.
[0085] This invention employs a segmented polling strategy, dynamically adjusting the polling interval based on the time difference between the current moment and the moment the payment request was initiated. Shorter polling intervals are used during critical periods of the payment process to improve response speed, while longer polling intervals are used during non-critical periods to reduce server access pressure. This achieves dynamic matching between query frequency and actual demand, ensuring timely response of the payment process while reducing the number of invalid queries.
[0086] In one embodiment of the present invention, the query request uses the HTTP POST or HTTP GET method.
[0087] Furthermore, step S32 specifically includes:
[0088] The time window from the time the payment request is initiated to the preset timeout period is divided into a first time phase, a second time phase, and a third time phase. The first time phase is from the time difference of zero to the end of the first phase. The second time phase is the time difference from the end time of the first phase to the end time of the second phase, i.e. The third time phase is the time difference from the end time of the second phase to the preset timeout duration, i.e. ;
[0089] The cash register determines the current time stage based on the time difference:
[0090] The first polling interval is set when the time difference is in the first time phase, the second polling interval is set when the time difference is in the second time phase, and the third polling interval is set when the time difference is in the third time phase, wherein the second polling interval is shorter than the first polling interval.
[0091] S4. After sending the payment request serial number, the cash register establishes a push channel with the cloud server. After establishing the second mapping relationship, the cloud server pushes a payment code ready notification to the cash register through the push channel. After receiving the payment code ready notification, the cash register stops the polling task and requests the payment code string from the cloud server according to the payment request serial number in the payment code ready notification. The cloud server returns the payment code string according to the payment request serial number through the second mapping relationship.
[0092] In one embodiment of the present invention, the push channel can be implemented using the WebSocket protocol. The cash register acts as a WebSocket client, initiating a connection request to the WebSocket server on the cloud server. After verifying the identity information, the cloud server establishes a connection and associates and stores the connection with the cash register's device number.
[0093] In one embodiment of the present invention, the push channel can also be implemented using the Server-Sent Events (SSE) protocol or based on HTTP long polling. The cloud server can proactively push messages to the cash register without requiring a request from the cash register. After the push channel is established, the connection is maintained, and the cash register starts a message listening mechanism to receive push messages from the cloud server in real time.
[0094] Specifically, step S4 includes:
[0095] S41. When the cash register sends the payment request serial number, it establishes a push channel with the cloud server that supports the server to actively push messages.
[0096] S42. After establishing the second mapping relationship, the cloud server generates a payment code ready notification and pushes the payment code ready notification to the cash register through the push channel.
[0097] S43. After receiving the payment code ready notification, the cash register extracts the payment request serial number from the payment code ready notification, stops the polling task, and sends a request to the cloud server.
[0098] S44. After receiving the retrieval request, the cloud server retrieves the payment code string through the second mapping relationship based on the payment request serial number in the retrieval request and returns it to the cash register.
[0099] Furthermore, when the push channel fails to push or the cash register does not receive the payment code ready notification, the cash register obtains the payment code string from the cloud server through a polling task.
[0100] Understandably, since the polling task starts and runs continuously after the cash register sends the payment request serial number, and does not depend on the state of the push channel, even if the push channel fails, the polling task can still query the payment code string from the cloud server at preset polling intervals. After the smart printer completes scanning and uploads the payment code, the cloud server establishes a second mapping relationship, and the cash register can obtain the payment code string from the cloud server in its next polling query.
[0101] This invention employs a dual-channel mechanism combining polling tasks and push channels. Under normal circumstances, the push channel enables rapid delivery of payment code readiness notifications, shortening the time delay from scanning completion to the cash register retrieving the payment code. In the event of a push channel failure or the cash register not receiving a push notification, the polling task can still continuously query according to a segmented polling strategy and ultimately obtain the payment code string. This avoids the problem of payment process interruption due to a single channel failure, improving reliability and fault tolerance.
[0102] In one embodiment of the present invention, the method further includes timed-out order recovery, specifically including:
[0103] Once the cash register is marked as timed out, the order status is changed to pending verification, and the order information is sent to the cloud server. The order information includes the payment request serial number, transaction amount, and timeout time.
[0104] After receiving the order information, the cloud server creates a delayed verification task, which is triggered to execute at the verification time point after the timeout period.
[0105] When the delayed verification task is executed, the cloud server sends the payment request serial number to the order query interface of the payment platform. The payment platform returns the current payment status of the order based on the payment request serial number. The current payment status of the order includes unpaid, in progress, successful payment, failed payment, and closed.
[0106] The cloud server updates the order status based on the current payment status.
[0107] The delayed verification task has N verification time points. The i-th verification time point is the sum of the timeout and the i-th time interval, where i is a positive integer and 1≤i≤N, and the (i+1)-th time interval is greater than the i-th time interval.
[0108] The delayed verification task performs an order query once at each verification time point. When the current payment status returned by the query is payment successful, unpaid, or closed, the query for subsequent verification time points is stopped. When the current payment status returned by the query is payment in progress, the query continues to be executed at the next verification time point.
[0109] Understandably, when the time difference reaches the preset timeout duration... The polling task stops and a timeout status is marked. At this point, the cash register has not yet obtained the payment code string, and the payment process is interrupted.
[0110] When the current payment status is "Payment Successful," it means the customer has actually completed payment, but the cash register failed to receive the payment success notification in time due to network latency or other reasons. The cloud server updates the order status in the local database from "Pending Verification" to "Paid." The cloud server records the actual payment completion time and the platform transaction serial number returned by the payment platform to ensure the integrity and accuracy of the order data. The cloud server generates print data containing the payment request serial number and sends a reprint instruction containing the print data to the smart printer. After receiving the reprint instruction, the smart printer generates and outputs a transaction receipt according to the print data. The cloud server simultaneously sends an order confirmation notification to the cash register, which includes the order status update information. The cash register displays a message on the interface: "Order payment confirmed, printing receipt," informing the cashier that the transaction has actually been successful.
[0111] When the current payment status is "Unpaid" or "Closed," it indicates that the customer has indeed not completed the payment process, or has actively cancelled the order on the payment platform side. The cloud server updates the order status from "Pending Verification" to "Cancelled." The cloud server sends an order cancellation notification to the cash register, which displays a "Order Cancelled" message on its interface. The cashier can then guide the customer to re-initiate the payment or choose another payment method.
[0112] When the current payment status is "Payment in Progress," it means the payment process has not yet been completed. The customer may be entering their payment password or performing biometric authentication on their mobile phone. The cloud server maintains the order's pending verification status, and the delayed verification task continues to wait for the next verification time to execute the order query again.
[0113] This invention addresses the issue of order timeout recovery by creating a delayed verification task on a cloud server after the cash register marks the order as timeout. At the designated verification time, the task proactively calls the payment platform's order query interface to obtain the actual payment status of the order and updates the local order status based on the query results. This resolves the problem of discrepancies between order status and actual payment status caused by network latency or communication failures, avoiding the risks of missed orders or duplicate payments and ensuring the accuracy of transaction data. Furthermore, by setting multiple verification time points for the delayed verification task, a dynamic balance is achieved between verification frequency and order status determinism. This ensures that abnormal orders are verified and processed promptly while avoiding resource waste caused by frequent queries.
[0114] The verification time points are configured according to business needs, and this invention does not impose specific restrictions on them. The setting of verification time points follows an incremental interval strategy, that is, the time interval between subsequent verification time points and the timeout time gradually increases.
[0115] S5. After the cash register obtains the payment code string, it generates a deduction request and calls the payment platform interface to send it to the payment platform. The payment platform completes the deduction based on the payment code string in the deduction request and returns the payment result. The cash register generates print data based on the payment result and sends a print instruction to the smart printer through the cloud server. The smart printer outputs the transaction receipt according to the print instruction.
[0116] This invention establishes a first mapping relationship between the smart printer device number and the payment request serial number, and a second mapping relationship between the payment request serial number and the payment code string through a cloud server. This realizes data transfer and logical association between the cash register and the smart printer, enabling the smart printer to complete the collaborative payment process without direct communication with the cash register. It solves the technical problem of the difficulty of direct connection between SaaS cash register systems and smart printers in different network environments, while maintaining the independent payment collection capability of the smart printer and improving the flexibility and applicability of the smart printer.
[0117] Specifically, step S5 includes:
[0118] After the cash register obtains the payment code string, it generates a deduction request and calls the scanned payment interface provided by the payment platform to send the deduction request to the payment platform; the deduction request includes the merchant number, transaction amount, payment code string and payment request serial number;
[0119] After verifying the validity of the merchant number, signature, and payment code string, the payment platform identifies the corresponding user account based on the payment code string, deducts the transaction amount from the user account, generates a payment result, and returns it to the cash register.
[0120] After receiving the payment result, the cash register generates print data when the payment status in the payment result is "payment successful". It then sends a print instruction containing the print data to the smart printer through the cloud server. The print data includes the transaction time, transaction amount, and payment request serial number.
[0121] After receiving a print command, the smart printer extracts the print data from the command and outputs it as a transaction receipt.
[0122] In one embodiment of the present invention, the scanned payment interface is a standard API provided by payment platforms such as WeChat Pay or Alipay to merchants, used by merchants to scan users' payment codes to complete deductions. The cash register sends a deduction request to the payment platform via the HTTPS protocol. The request requires signature authentication; the cash register uses the merchant's private key to sign the request parameters, and the payment platform uses the merchant's public key to verify the validity of the signature, ensuring the authenticity and integrity of the request.
[0123] In one embodiment of the present invention, after receiving a deduction request, the payment platform first verifies the validity of the merchant number, signature, and payment code string. It verifies that the merchant number exists and is in a normal state. It verifies that the signature is correct to prevent the request from being tampered with or forged. It verifies the validity of the payment code string, including whether the format is correct, whether it is within its validity period, and whether it has already been used. Payment code strings typically have an expiration time, for example, they are refreshed every minute; expired payment codes cannot complete the payment.
[0124] The smart printer has two operating modes: independent payment collection mode and collaborative payment collection mode. The operating mode of the smart printer can be switched through configuration parameters or the back-end management system.
[0125] In independent payment mode, the smart printer functions as a standalone payment terminal. Merchants or cashiers enter the transaction amount into the smart printer, which then uses the payment platform's API to generate a QR code. This QR code is displayed on the smart printer's screen or printed onto a paper receipt via the printing module. Customers scan the QR code using WeChat or Alipay, confirm the payment amount on their phones, and complete the payment. After the payment platform deducts the payment, it sends a payment success notification to the smart printer. Upon receiving the notification, the smart printer automatically prints the transaction receipt. The entire payment process is completed independently by the smart printer, without the need for a cash register or cloud server.
[0126] In collaborative payment mode, the smart printer acts as a collaborating device with the cash register, working in conjunction with the cash register and cloud server to complete the payment process. After receiving a voice prompt from the cloud server, the smart printer executes step S2, which involves scanning and uploading. The smart printer plays a voice prompt, activates the scanning module to scan the payment code displayed on the customer's mobile phone screen, extracts the payment code string, and uploads the payment code string and the smart printer's device number to the cloud server. After receiving a print command from the cloud server, the smart printer executes step S5, which involves outputting a transaction receipt. The smart printer parses the print data in the print command and drives the print module to output the data as a transaction receipt.
[0127] By supporting two working modes, the smart printer achieves multiple uses. In standalone payment mode, it functions as a standalone payment device, eliminating the need for a separate cash register and reducing equipment procurement costs for merchants. Simultaneously, in collaborative payment mode, it integrates with a SaaS POS system to enable advanced functions such as product management, order processing, and data statistics, meeting the complex business needs of merchants.
[0128] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A blind scanning payment method for a smart printer, characterized in that: Includes the following steps: S1. The cash register calculates the transaction amount based on the product information. After receiving the payment instruction, it generates a payment request serial number and sends it to the cloud server. The cloud server establishes a first mapping relationship between the smart printer device number and the payment request serial number in the cache service and sends a voice broadcast instruction to the smart printer. The first mapping relationship is established using the smart printer device number, which is pre-bound to the merchant information, as the key and the payment request serial number as the value. S2. When the smart printer is in collaborative payment mode, it receives a voice broadcast command, triggers voice broadcast and starts scanning. After scanning the customer's payment code to obtain the payment code string, it uploads the payment code string and the smart printer device number to the cloud server. The cloud server queries the corresponding payment request serial number through the first mapping relationship based on the smart printer device number, and establishes a second mapping relationship in the cache service based on the payment request serial number and the payment code string. S3. After sending the payment request serial number, the cash register starts a polling task. It adopts a segmented polling strategy to send query requests to the cloud server at polling intervals. The cloud server queries the payment request serial number in the query request through the second mapping relationship. If the associated payment code string is found, the payment code string is returned. If it is not found, a not ready response is returned. Step S3 specifically includes: S31. After sending the payment request serial number, the cash register starts a polling task and records the time when the payment request is initiated. S32. The cash register calculates the time difference between the current time and the time when the payment request was initiated, and determines the current polling time interval based on the time stage in which the time difference is located; S33. The cash register sends a query request to the cloud server at polling intervals. The cloud server checks whether there is an associated payment code string based on the payment request serial number in the query request. If it exists, it returns the payment code string; otherwise, it returns a not ready response. S34. When the cash register receives the payment code string, it stops the polling task. When the time difference reaches the preset timeout period, it stops the polling task and marks the timeout status. Step S32 specifically includes: The time window from the moment the payment request is initiated to the preset timeout period is divided into a first time phase, a second time phase, and a third time phase. The cash register determines the current time stage based on the time difference: The first polling interval is set when the time difference is in the first time phase, the second polling interval is set when the time difference is in the second time phase, and the third polling interval is set when the time difference is in the third time phase, wherein the second polling interval is shorter than the first polling interval. S4. After sending the payment request serial number, the cash register establishes a push channel with the cloud server. After establishing the second mapping relationship, the cloud server pushes a payment code ready notification to the cash register through the push channel. Upon receiving the payment code ready notification, the cash register stops the polling task and requests the payment code string from the cloud server based on the payment request serial number in the payment code ready notification. The cloud server returns the payment code string based on the payment request serial number through the second mapping relationship. Since the polling task starts and runs continuously after the cash register sends the payment request serial number, it does not depend on the state of the push channel. When the push channel fails or the cash register does not receive the payment code ready notification, the cash register obtains the payment code string from the cloud server through the polling task. By establishing the first mapping relationship between the smart printer device number and the payment request serial number, and the second mapping relationship between the payment request serial number and the payment code string through the cloud server, data transfer and logical association between the cash register and the smart printer are realized, enabling the smart printer to complete the collaborative payment process without direct communication with the cash register. Step S4 specifically includes: S41. When the cash register sends the payment request serial number, it establishes a push channel with the cloud server that supports the server to actively push messages. S42. After establishing the second mapping relationship, the cloud server generates a payment code ready notification and pushes the payment code ready notification to the cash register through the push channel. S43. After receiving the payment code ready notification, the cash register extracts the payment request serial number from the payment code ready notification, stops the polling task, and sends a request to the cloud server. S44. After receiving the acquisition request, the cloud server retrieves the payment code string by querying the payment request serial number in the acquisition request through the second mapping relationship and returns it to the cash register. This also includes the restoration of overdue orders, specifically: Once the cash register is marked as timed out, the order status is changed to pending verification, and the order information is sent to the cloud server. The order information includes the payment request serial number, transaction amount, and timeout time. After receiving the order information, the cloud server creates a delayed verification task, which is triggered to execute at the verification time point after the timeout period. When the delayed verification task is executed, the cloud server sends the payment request serial number to the order query interface of the payment platform. The payment platform returns the current payment status of the order based on the payment request serial number. The current payment status of the order includes unpaid, in progress, successful payment, failed payment, and closed. The cloud server updates the order status based on the current payment status; S5. After the cash register obtains the payment code string, it generates a deduction request and calls the payment platform interface to send it to the payment platform. The payment platform completes the deduction based on the payment code string in the deduction request and returns the payment result. The cash register generates print data based on the payment result and sends a print instruction to the smart printer through the cloud server. The smart printer outputs the transaction receipt according to the print instruction.
2. The blind scanning payment method for a smart printer as described in claim 1, characterized in that: The delayed verification task sets N verification time points. The i-th verification time point is the sum of the timeout moment and the i-th time interval, where i is a positive integer and 1≤i≤N, and the (i+1)-th time interval is greater than the i-th time interval. The delayed verification task performs an order query once at each verification time point. When the current payment status returned by the query is payment successful, unpaid, or closed, the query for subsequent verification time points is stopped. When the current payment status returned by the query is payment in progress, the query continues to be executed at the next verification time point.
3. The blind scanning payment method for a smart printer as described in claim 1, characterized in that: Step S5 specifically includes: After the cash register obtains the payment code string, it generates a deduction request and calls the scanned payment interface provided by the payment platform to send the deduction request to the payment platform; the deduction request includes the merchant number, transaction amount, payment code string and payment request serial number; After verifying the validity of the merchant number, signature, and payment code string, the payment platform identifies the corresponding user account based on the payment code string, deducts the transaction amount from the user account, generates a payment result, and returns it to the cash register. After receiving the payment result, the cash register generates print data when the payment status in the payment result is "payment successful". It then sends a print instruction containing the print data to the smart printer through the cloud server. The print data includes the transaction time, transaction amount, and payment request serial number. After receiving a print command, the smart printer extracts the print data from the command and outputs it as a transaction receipt.
4. The blind scanning payment method for a smart printer as described in claim 1, characterized in that: Step S1 specifically includes: The cash register receives product information and calculates the total transaction amount based on that information. After receiving a payment instruction, the cash register obtains the current timestamp, merchant identifier, cash register device number, and random number, and concatenates the current timestamp, merchant identifier, cash register device number, and random number to generate a payment request serial number; The cash register generates a payment request message and sends it to the cloud server; the payment request message includes a payment request serial number, transaction amount, and merchant information. After receiving the payment request message, the cloud server verifies the format of the payment request serial number and the range of the transaction amount. Once the verification is successful, it establishes a first mapping relationship in the cache service using the smart printer device number pre-bound to the merchant information as the key and the payment request serial number as the value, and sends a voice broadcast command to the smart printer corresponding to the smart printer device number.
5. The blind scanning payment method for a smart printer as described in claim 1, characterized in that: Step S2 specifically includes: After receiving the voice broadcast command, the smart printer plays the voice prompt and simultaneously starts the smart printer's barcode scanning module to enter the scanning ready state. The smart printer's scanning module scans the customer's payment code, decodes the scanned payment code, and extracts the payment code string. The smart printer encapsulates the payment code string and the smart printer device number and uploads them to the cloud server; After receiving the uploaded data, the cloud server extracts the payment code string and the smart printer device number. In the cache service, it uses the smart printer device number as the key to query the corresponding payment request serial number through the first mapping relationship. In the cache service, it establishes a second mapping relationship using the payment request serial number as the key and the payment code string as the value.
Citation Information
Patent Citations
POS systems and their applications, including POS devices and payment methods
CN110580785B