Develop in the sandbox
Note: Since the sandbox is an emulated environment, all tests in the sandbox do not take effect in the production environment. All returned codes and processing logic need to be consistent with those in the production environment.
Step 1: Receive sandbox resources
After the application is created, sandbox resources are automatically allocated to you. On the Sandbox > Settings page, check your sandbox resources, which include the following two parts:
- Integration Information: contains key information for sandbox test, such as:
- Gateway Endpoint: indicates the domain name that is assigned by Alipay+ to construct the API request URL. For more information, see the Request URL section in API Reference.
- Client ID: used to specify the Client-Id parameter in the API request header. For more information, see the Request header section in API Reference. Note that the value here is only used for the sandbox.
- MPP ID: indicates the unique ID that is assigned by Alipay+ to identify a Mobile Payment Provider (MPP). The value of this parameter in the sandbox can be used to:
- Specify the pspId parameter in the API request or response.
- Recognize the participantId parameter involved in the reconciliation. For more information, see the Download reports chapter in Reconcile.
- Test Wallet Name: indicates the unique name that is assigned by Alipay+ to identify a test wallet. It is displayed as the payment method when you simulate the process of accepting payments from consumers in the Alipay+ Linker Merchant.
- Certification Type: indicates the method that is used by Alipay+ to sign an API request and validate the signature. It is displayed after you set a public key. For more information, see Set a sandbox public key.
- Financial Reports: contains information that is used to download sandbox clearing and settlement reports in the SFTP server, including the login account, password, and SFTP URL.
Step 2: Configure the sandbox
To configure the sandbox on the Settings page, complete the following tasks.
1. Set a sandbox public key
To make your integration safer, Alipay+ uses asymmetric keys for API signature. Your key pair and the Alipay+ public key are required in your local code. You need to generate your key pair and upload your public key to get the Alipay+ public key.
In the Public key panel of the Sandbox > Settings page, complete the following steps.
- Click Set Your Public Key.
- On the Set Your Public Key page, click the respective link to download the RSA2 signature tool that is provided by Alipay+.
- Open the zipped folder and run the Run.bat file.
- Click New to generate a key pair. Keep the private key locally.
- Copy the public key and enter it on the Set Your Public Key page.
- Click Submit to upload your public key.
After submission, the Alipay+ public key is generated automatically. You can click the respective button to view or copy the Alipay+ public key.
Your public key is updatable. Click Edit Your Public Key to update it. Please remember to update your key pair in your local code.
Note: Your public key that is used in the sandbox must be different from the one in the production environment. For more information about getting the Alipay+ public key for the production environment, see Set a production public key.
2. Set API endpoints
On the API Endpoint Settings (Alipay+ > MPP) panel, click Edit to specify the endpoints for the APIs so that Alipay+ can call the APIs in the sandbox.
3. Conditional: Set common settings
In the Common Settings panel, click Edit to specify the common settings related to this application.
Note that if a setting that is shown as Required is not completed, the sandbox acceptance testing cases involving the setting might fail. Please complete the setting before rerunning the cases.
4. Conditional: Set test parameters
In the Test Parameter Settings panel, click Edit to specify the parameters to execute test cases in the sandbox.
Step 3: Develop and test in the sandbox
When getting the sandbox ready, use development tools and resources to develop and test your application. Alipay+ provides the following tools and resources for developers:
- Alipay+ MPP SDKs: For more information, see Alipay+ MPP SDKs.
- Alipay+ Linker Merchant: used to simulate the process of accepting payments on the merchant side. For more information, see Alipay+ Linker Merchant.
You can find these tools and resources under the Sandbox > Tools tab.