Alipay+Alipay+

How to test APIs locally with Postman script

Read this chapter to learn about how to use the Postman script to test Alipay+ APIs.

Follow these steps:

  1. Download the Postman script file on the iTest page of the Alipay+ Developer Center.

image.png

  1. Import the Alipay+ environment into Postman.

Download the following file and import it to the Postman environment:

Alipay+ Postman Environment.json

  1. Set values in Postman.

Enter "A+ APS" for the Environment Name field and provide values for the pk, which stands for privateKey, and clientId parameters.

1.png

If you don't have a private key yet, use the Alipay+ Developer Center to generate the key pairs associated with your own client ID. For more information about how to get your client ID and generate key pairs, see steps 1 and 2 in the Configure the sandbox chapter.

image.png

  1. Import the Alipay+ collection.

Download the following file and import it into Postman:

Alipay+ Postaman Collection.json

  1. Edit the API request body.

Click on the specific API and you can edit its request body. Note that for the pay APIs in different scenarios, values for one parameter might be different. For more information about how to specify parameter values in Alipay+ APIs, see either of the following documents:

3.png

If you need to view or modify the algorithm, right-click the specific API and click Edit to edit the script.

2.png

image.png

Note: The script is based on this open-source library: https://joolfe.github.io/postman-util-lib/.