Alipay+ DocsAlipay+ Docs


Use iMock to simulate different API results and return specified responses for integration testing.


  • Use iTest to send API requests, so as to receive the responses that you specify in iMock. For how to use iTest, see iTest.
  • If you use other tools such as Postman to send API requests, you need to add the following parameters in the request headers: loadmode: 2, markuid: 0A, and instmock: O.

Take the following steps:

  1. Click Specify on the right side of each API.


  1. In the pop-up window, you can complete the Basic Settings or Advance Settings to set the API response.
    • Basic Settings: Select a value for the resultCode parameter from the drop-down list beside the Response: resultCode field.
    • Advanced Settings:
      1. Turn on Advanced Settings by switching the Off button to On.
        Note that Basic Settings is automatically cleared when Advanced Settings is turned on.
      2. Click Add Response.
      3. Specify values for the following fields:
        • Response: resultCode: indicates the value of resultCode parameter that you expect to return in the API response.
        • Request: {parameter}: indicates the value of the request parameter that triggers the specified value of resultCode in the API response.
      1. Click Save to make your settings valid.
        If you want to delete a record, click Delete in the Action column.
  1. Set the API Mocking duration on the iMock page. The duration can be 30 mins, 60 mins, 90 mins, or 120 mins. iMock is turned off automatically when the time is up.
  2. Turn on iMock by switching the Off button to On.