The showPaymentSheet API is used to show the payment sheet for the user to complete the payment after the user places an order with Alipay+. You can display the recommended Mobile Payment Providers (MPPs) that are supported by Alipay+ on the payment sheet.
- The payment sheet mentioned in this section is also known as the Alipay+ checkout page.
- If only one payment method is available, the payment sheet is not displayed. In this case, the user is directly redirected to the MPP client to complete the payment.
After the user selects an MPP and clicks Pay Now, the user is redirected to the MPP client to complete the payment. In the preceding process, you can receive callbacks about key events, such as when the user clicks Close or when the user clicks Pay Now.
How to handle the key events:
- When you receive the event that the user has selected an MPP and clicked Pay Now, the SDK closes the payment sheet and redirects the user to the MPP client to complete the payment. The payment status will not be updated through callbacks. Therefore, you may need to call your server to query the payment status.
- When the user clicks Close, the SDK closes the payment sheet. You can define custom logic to process the event.
- If the value of the paymentData parameter is illegal, the payment sheet is not displayed and the corresponding callback is invoked to notify the caller.
About the payment sheet:
- The payment sheet will be rendered in the key window and cover the interface of the active app, including the navigation bar and status bar.
- The payment sheet is closed only when the user clicks Close or clicks Pay Now after selecting an MPP.
An object that describes the event that occurred when the status of the payment sheet changed.