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

Testing in sandbox

  1. Before you test Alipay payment features in Sandbox, you must have an Alipay merchant account. See Alipay merchant account.
  2. When you test in Sandbox, pay attention to the following items:
    a. The APP payment supports testing in Sandbox environment. The online test and acceptance must be passed, and the related parameters and values need to be configured for a production environment before going live. Return codes and business logics are subject to that in the production environment.
    b. The APP payment supports only the balance payment method. Other payment methods, such as bank card and Yu'e Bao, are not supported.
  3. Call the following function to configure sandbox environment before you call the payment interface of the SDK:EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX)

Sample

copy
protected void onCreate(Bundle savedInstanceState) {
   EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);//For testing in Sandbox environment, please delete it when go live.
   super.onCreate(savedInstanceState);
   setContentView(R.layout.pay_main);
}

Note:

Comment out the above codes before going live. Otherwise the Sandbox environment is used.

  1. To perform the test in the sandbox environment, you can use this APK.