First of all, this is just a situation I encountered. Recently, I was doing the function of calling Alipay webpage payment, and I came into contact with alipay’s sandbox environment, in which I need to configure two urls:

A is return_url, namely synchronous notification call address, also sweep the user code for the path of success after the jump, the general can choose to jump back to the page in the project or single jump a page, notify users pay a success, remember the path to return to the values in the Map is only part of the useful, whether can confirm the other payment is successful, Again, look at the Map value returned from the following address;

Is notify_url that asynchronous invocation address, also confirm that the order of important basis of success, pay treasure to launch notification to the path of the request, this must be the network to be able to access, and in the project don’t on the path to any interception, login user permissions, and so on, for example, when I do is to encounter this problem, Finally, ignore the path in the interceptor to receive the notification successfully, there may be other methods, please advise. The key value for confirming the successful collection is “trade_status”. If the corresponding value is “TRADE_SUCCESS” or “TRADE_FINISHED”, the collection is successful and the order is over.

The switch (alipayTradeQueryResponse getTradeStatus ()) / / judgment results {case "TRADE_FINISHED" : / / deal ends and not refund break; Case "TRADE_SUCCESS": // TRADE_SUCCESS break; Case "TRADE_CLOSED": // Unpaid trade timeout close or full refund break after payment completed; Case "WAIT_BUYER_PAY": // Transaction created and waiting for buyer to pay break; default: break; }Copy the code