Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

Error scenario simulation

iMock provides simulations of different API results and returns the specified response for integration testing.

Before you start

Before using iMock, go to Alipay Developer Center, enter the Integration Settings section, and configure your settings for the sandbox environment.

  1. Click the Sandbox tab, then click Edit public key.

image.png

  1. Enter your public key and click Submit.

image.png

If you do not have a public key, you can download the tool for generating RSA2 keys and use it to generate your keys.

image.png

  1. Enter your notification URL, which will be used for receiving notifications.

image.png

Use iMock

iMock can simulate all the result codes, including rare production environment scenarios. This helps developers to work with the same corresponding system logic processing in the sandbox. The effective time of the mock results can be changed by adjusting the mock time.

Alipay designed different responses for indicating different result codes. By default, no response is specified. If you specify a response, then the response is always returned for the corresponding API when iMock is turned on.

image.png

API Mock will be turned off automatically when the duration time is up. The duration can be set as 30min, 60min, 90min, or 120min. The user can manually set the time for automatic shutdown.

image.png

To start using the iMock tool for simulations of different API results, go to Alipay Developer Center, create an application, and then locate iMock under Development Tools.