Implementation Procedure

  1. The user initiates WeChat payment in the mobile browser.
  2. The merchant system calls the OTT Pay API to make payment, and the OTT Pay server returns Payment Navigation Link
  3. Direct to this payment Navigation link on the front-end of the merchant system, and the WeChat wallet will be activated for payment
  4. The payment result will be notified to the merchant system through the callback

Code Example

Get the payment navigation link:

Map<String, Object> data = new HashMap<>();
data.put("amount", "1");
data.put("callbackURL", "https://your.callback.url");
data.put("remark", "this is remark");

Gson gson = new Gson();
RequestBody body = RequestBody.create(gson.toJson(data), MediaType.parse("application/json; charset=utf-8"));
String token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJPTjAwMDAwMDk3MTMwIiwiYXVkaWVuY2UiOm51bGwsInJvbGUiOm51bGwsImNyZWF0ZWQiOjE2NzgxOTkwMTY2OTAsInVzZXJ0eXBlIjoiQ1VTVE9NRVIiLCJleHAiOjE2NzgyMDgwMTYsInVzZXJpZCI6MTMwfQ.VhP7j4Y8fjOLFm2d_Mm8INhotX68GnHFDG4XiDQEJdxuqLMjBxsRw2sBzrqM7CXNdBW0kn8jKHGhMhVwPVkgoQ";
Request request = new Request.Builder()
        .addHeader("Authorization", "Bearer " + token)

final OkHttpClient httpClient = new OkHttpClient();
try (Response response = httpClient.newCall(request).execute()) {

    if (!response.isSuccessful()) {
        throw new IOException("Unexpected code " + response);

    // Response
} catch (IOException e) {
    throw new RuntimeException(e);

payInfo in the returned response is the payment navigation link, and the front-end will direct to this link to call the WeChat wallet for payment.