How to realize the display of commodity express logistics information on the shopping app

foreword

Nowadays, most people choose to shop on mobile shopping apps, which is very convenient for shopping. You can buy products from all over the country or even abroad without going out. After placing an order, you only need to wait for the express delivery. An indispensable auxiliary function of a shopping app is to display the logistics information of the goods, so that users can see where the things they bought have arrived.

So how do we display the logistics information of the product on the shopping app? This article teaches you how to embed the express logistics query function into the shopping app~

How to achieve?

  1. Select an express logistics query interface: First, choose a reliable express logistics query interface supplier. Ensure that the interface provides accurate and real-time logistics information and has stable service availability.
  2. Integration interface: In the back-end system of the shopping app, integrate the selected express logistics query interface. This usually requires making an API call. According to the documentation and guidelines of the interface provider, configure the API key and related parameters to ensure that requests can be sent to the interface and corresponding logistics information can be obtained.
  3. User interface design: In the front-end interface of the shopping app, design and add related functions of logistics inquiries. An entry or button for logistics inquiry can be created on the order details page or in the user's personal center. After the user clicks on the entry, the query request will be triggered and the logistics information will be displayed.
  4. Query and display logistics information: When the user clicks the logistics query button, call the back-end API to send a request to the express logistics query interface, and pass the order number or express delivery number as a parameter to the interface. After receiving the response, parse and process the returned logistics data, and display relevant logistics information on the App interface, such as logistics status, transportation progress, estimated delivery time, etc.
  5. Update logistics information: regularly send requests to the express logistics query interface to obtain the latest logistics information and update the display in the App. Timed tasks can be set or update requests can be triggered based on user operations to maintain real-time logistics information.
  6. Error handling and exceptions: Handle errors and exceptions of interface requests, such as network connection failures, failure to parse returned data, etc. In these cases, an error message can be displayed to the user with the option to try again or contact support.
  7. Testing and optimization: After the integration is completed, conduct a comprehensive test to ensure that the logistics query function works normally under different scenarios and conditions. Based on user feedback and usage, optimize and improve to enhance user experience.

Where should the logistics query entry be placed?

Through research and everyone's feedback, it is found that the entry of commodity logistics information query can be placed in: [to be received] → [commodity information] → [view logistics].

Click the [View Logistics] button to call the logistics query API, and pass in the courier company code and logistics order number of the product. If the interface request is successful, the returned logistics data will be filled and displayed on the page.

Selection of logistics query interface

Through the comparison of online logistics query APIs, I recommend APISpace 's national logistics query API : provide express logistics tracking number query including 600+ express companies including STO, SF Express, YTO, Yunda, ZTO, and Huitong.

Regarding the logistics interface, there is also a cross-border international logistics query API , which can query international logistics; if you want to display the logistics trajectory on the logistics information page, you can use the national express logistics map trajectory query API ; you also want to display the approximate time of delivery on the page, You can use the logistics timeliness query API

Example of JAVA call of National Logistics Query API:

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"cpCode":"YTO","mailNo":"YTO1111111111","tel":"13000000000或0000","orderType":"asc"}");
Request request = new Request.Builder()
  .url("https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_search")
  .method("POST",body)
  .addHeader("X-APISpace-Token","")
  .addHeader("Authorization-Type","apikey")
  .addHeader("Content-Type","application/json")
  .build();

Response response = client.newCall(request).execute();
System.out.println(response.body().string());

write at the end

After understanding how to realize the display of commodity express logistics on the shopping APP, then you will also know how to embed the function of express logistics query into various applications with shopping functions. Hope this article can help you~

Guess you like

Origin blog.csdn.net/m0_58974397/article/details/131654447