Overview
This topic introduces the capabilities that are provided by Alipay+ MPP Server SDK and the business flows that involve the SDK.
Capabilities
The following table lists the APIs that are provided by the SDK:
Scenario | Merchant-presented Mode Payment & Cashier Payment | Description | |
API | MPP server -> SDK | ac.code.service.CodeIdentificationService#init | Code identification service initialization |
ac.code.service.CodeIdentificationService#identifyCode | Identify codes that can be processed by Alipay+ |
Business flows
This section introduces the business flows among different parties when the SDK is used to identify QR codes. The involved parties include the merchant, MPP client, MPP server,Alipay+ server SDK, and Alipay+.
Overall business flow
The following figure illustrates the overall business flow among the merchant, MPP, Alipay+ server SDK, and Alipay+.
Figure 1-1. Overall business flow
The overall business flow consists of the following steps:
1. Scan a QR code
1.1 The merchant presents a QR code to the customer.
1.2 The customer uses the MPP client to scan the QR code.
2. Identify the QR code
2.1 The MPP client sends a request to the MPP server to identify the QR code.
2.2 If the code value cannot be recognized, the MPP server calls the Alipay+ server SDK to identify the code.
2.3 The Alipay+ server SDK returns the identification result to the MPP server. If the code can be processed by Alipay+, the Alipay+ server SDK also includes the code type and further action in the result.
- Decode the code value
- If the code is an order code, the MPP server sends a request to Alipay+ to decode the code value.
- If the code is an entry code, the MPP client redirects the user to place an order. After the order is placed, the MPP server obtains the order code that is generated based on the order information and then sends a request to Alipay+ to decode the code value.
- Process the payment
4.1 Alipay+ calls the MPP server to process the payment.
4.2 The MPP server returns the cashier page URL to the MPP client. The user is then redirected to the cashier page to confirm the payment.
Alipay+ Server SDK business flow
The following figure illustrates the business flow between the MPP and Alipay+ server SDK.
Figure 1-2. Alipay+ server SDK business flow
The Alipay+ server SDK business flow consists of the following steps:
1. Initialize the Alipay+ server SDK
1.1 The MPP server initializes the Alipay+ server SDK by calling the ac.code.service.CodeIdentificationService#init API.
1.2 The Alipay+ server SDK loads route configurations from the route configuration HTTP server.
1.3 If route configurations are successfully loaded from the server, the Alipay+ server SDK saves downloaded route configurations to storage; otherwise, the Alipay+ server SDK might read route configurations from storage based on the value set in the ac.route.init-route-config-level property.
1.4 The Alipay+ server SDK schedules updates.
2. Identify the QR code by calling the identifyCode API
2.1 The MPP client calls the MPP server to identify the code.
2.2 If the code value cannot be recognized, the MPP server sends a request to the Alipay+ server SDK to identify the code by calling the ac.code.service.CodeIdentificationService#identifyCode API.
2.3 The Alipay+ server SDK returns the identification result to the MPP server. If the code can be processed by Alipay+, the Alipay+ server SDK also includes the code type and further action in the result.