Current location - Quotes Website - Personality signature - Wechat H5 payment process
Wechat H5 payment process
1. The user completes the order at the merchant's end and pays by using WeChat Pay.

2. The merchant initiates an order request to WeChat Pay in the background (calling the unified order interface). Note: the transaction type is trade_type=MWEB.

3. The unified order interface returns payment related parameters to the merchant background, such as payment jump url (parameter name "mweb_url"), and the merchant calls out the middle page of WeChat payment through mweb_url.

4. Check the H5 mechanism and check the security of the intermediate page (see below for common errors).

5. If the payment is successful, the merchant background will receive an asynchronous notification from WeChat.

6. The user completes the payment or cancels the payment at the WeChat payment cashier, and returns to the merchant page (the default is to return to the payment initiation page).

7. On the display page, the merchant guides the user to initiate the inquiry of the payment result.

8.9. The merchant background judges whether to receive the payment result notice from WeChat. If not, call our order inquiry interface in the background to confirm the order status (please refer to the payment callback and execution guide for document inquiry).

10. Display the final order payment result to the user.

FREQUENTLY ASKED QUESTIONS

First, the callback page

Users in the normal process will return to the page that initiated the payment after the payment is completed. If you need to return to the specified page, you can specify the callback page by splicing the redirect_url parameter after MWEB_URL.

For example, if you want users to jump to after paying, you can do the following:

Suppose you get MWEB_URL= through the unified ordering interface.

note:

1.redirect_url needs to be urlencode.

2. After setting redirect_url, the operation of jumping back to the specified page may occur in:

A, it is more than 5 seconds after the middle page of WeChat payment is adjusted to WeChat cashier.

B. The user clicks "Cancel Payment" or clicks "Finish" button after payment is completed. Therefore, there is no guarantee that the payment process will end when the page bounces back, so the redirect_url address set by the merchant cannot automatically perform the document search operation, and the user has to click the button to trigger the document search operation. Please refer to the following figure for the display effect of the bounce page.

Second, other common mistakes

| The network environment failed security verification, please try again later | 1. The unified terminal ip of the merchant (spbill _ create _ IP) is inconsistent with the terminal IP detected by WeChat when the user actually adjusts the payment. This problem is generally caused by the failure of merchants to pass the correct terminal IP to spbill_create_ip when placing unified orders. For more information, refer to the guide for obtaining the client IP.

2. Unified ordering, and the network changes when payment is adjusted. For example, when placing a unified order, it is a WIFI network. Switching to 4G network and adjusting payment after placing an order successfully may cause us to intercept normally. Please restart the payment process while keeping the network environment consistent.

|

| 2 |

| Wrong format of merchant parameter, please contact the merchant to solve it |

1. At present, the referrer for adjusting H5 payment is empty, which is generally caused by directly entering the page for adjusting H5 payment. Please follow the normal process to jump to the page and initiate payment, or grab the package yourself to confirm whether the referer value is empty.

2. If H5 payment is activated in the APP, you need to manually set referer in webview, such as (

Map< string & gtextraHeaders = new HashMap & lt string & gt ();

ExtraHeaders.put("Referer ","authorized domain name submitted by merchants when applying for H5 "); //For example |

|

|

| 7 |

| Due to the error of H5 transaction parameters passed in by the merchant, the transaction cannot be completed temporarily, please contact the merchant to solve it | spbill_create_ip field in unified order must be the ip address of the client |

Third, QA

Q 1:

1. When the redirect_url safari browser is delivered, a new page will open after the payment is completed;

2. There is also the fact that some ios phones will return to safari browser by default after paying with other browsers.

A 1:

1. The current logic is designed in this way to prevent merchants from calling the WeChat client indefinitely.

2. Yes, return the mode information of the browser. Some browsers hide this information. If you can't get the mode information, you will return to safari browser.