Duty Tax Calculator API

(0 reviews)

Postman Collection


Download and Install Postman

Step 1: Go to https://www.getpostman.com/downloads/ to download the latest version.

resources/image-ed4e2e6b-6dd3-4f57-9192-c5eefc640f7b.png

Step 2: Install by right clicking the setup exe (Postman-win64-x.y.z-Setup.exe) as administrator.

Step 3: Open the postman application by right clicking and Run as administrator.

resources/image-4de703ef-6d6f-4e5d-b8ee-d988056df279.png

Step 4: After opening Postman, go to File menu – Import.

resources/image-52669c7a-825c-427e-99ad-d3887deee130.png

Step 5: Choose “Import From Link”- Copy and paste the below Collection JSON, and click Import.

Collection JSON

{
    "info": {
        "_postman_id": "1841a5c5-0a3c-482d-bd42-289aed4f5d5c",
        "name": "Postal DDP API Test Suite",
        "description": "**Step 1:** Import the Postman collection.  \n**Step 2:** Import Environment Variables under Environments and refer them to the collection while sending requests to the API.  \n**Step 3:** Update Environment Variables with your own credentials for testing.  \n**Step 4:** Update Environment Variables - URL with the appropriate URL that you want to test.  \nProd URL: [https://api.nzpost.co.nz/postalddp/v1](https://api.nzpost.co.nz/postalddp/v1)  \nUAT URL: [https://api.uat.nzpost.co.nz/postalddp/v1](https://api.uat.nzpost.co.nz/postalddp/v1)",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
        "_exporter_id": "23588468",
        "_collection_link": "https://nzpost-projects.postman.co/workspace/c3cc1831-eadb-46c5-a7cc-51053d31b499/collection/23588468-1841a5c5-0a3c-482d-bd42-289aed4f5d5c?action=share&source=collection_link&creator=23588468"
    },
    "item": [
        {
            "name": "Authentication",
            "item": [
                {
                    "name": "OAuthTokenGet",
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "exec": [
                                    "var jsonData = JSON.parse(responseBody);\r",
                                    "pm.environment.set(\"bearer_token\", \"Bearer \" + jsonData.access_token);\r",
                                    ""
                                ],
                                "type": "text/javascript",
                                "packages": {}
                            }
                        }
                    ],
                    "request": {
                        "auth": {
                            "type": "oauth2",
                            "oauth2": [
                                {
                                    "key": "addTokenTo",
                                    "value": "header",
                                    "type": "string"
                                }
                            ]
                        },
                        "method": "POST",
                        "header": [],
                        "body": {
                            "mode": "urlencoded",
                            "urlencoded": [
                                {
                                    "key": "grant_type",
                                    "value": "client_credentials",
                                    "type": "text"
                                },
                                {
                                    "key": "client_id",
                                    "value": "{{client_id}}",
                                    "type": "text"
                                },
                                {
                                    "key": "client_secret",
                                    "value": "{{client_secret}}",
                                    "type": "text"
                                }
                            ]
                        },
                        "url": {
                            "raw": "https://oauth.nzpost.co.nz/as/token.oauth2",
                            "protocol": "https",
                            "host": [
                                "oauth",
                                "nzpost",
                                "co",
                                "nz"
                            ],
                            "path": [
                                "as",
                                "token.oauth2"
                            ]
                        }
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Flows",
            "item": [
                {
                    "name": "LandedCost",
                    "item": [
                        {
                            "name": "LandedCost",
                            "request": {
                                "auth": {
                                    "type": "oauth2",
                                    "oauth2": [
                                        {
                                            "key": "grant_type",
                                            "value": "client_credentials",
                                            "type": "string"
                                        },
                                        {
                                            "key": "addTokenTo",
                                            "value": "header",
                                            "type": "string"
                                        }
                                    ]
                                },
                                "method": "POST",
                                "header": [
                                    {
                                        "key": "Authorization",
                                        "value": "{{bearer_token}}",
                                        "type": "text"
                                    },
                                    {
                                        "key": "client_id",
                                        "value": "{{client_id}}",
                                        "type": "text"
                                    },
                                    {
                                        "key": "Content-Type",
                                        "value": "{{content-Type}}",
                                        "type": "text"
                                    },
                                    {
                                        "key": "account_number",
                                        "value": "{{account_number}}",
                                        "type": "text"
                                    }
                                ],
                                "body": {
                                    "mode": "raw",
                                    "raw": "{\r\n\t\"currency\": \"USD\",\r\n\t\"ship_from\": {\r\n\t\t\"country\": \"US\"\r\n\t},\r\n\t\"ship_to\": {\r\n\t\t\"country\": \"BR\",\r\n\t\t\"state\": \"SP\",\r\n\t\t\"city\": \"Campinas\",\r\n\t\t\"postal_code\": \"75828-000\"\r\n\t},\r\n\t\"items\": [\r\n\t\t{\r\n\t\t\t\"amount\": 75,\r\n\t\t\t\"currency\": \"NZD\",\r\n\t\t\t\"country_of_origin\": \"FR\",\r\n\t\t\t\"description_customs\": \"Hoka One Running Shoe - Women's\",\r\n\t\t\t\"hs_code\": \"6116.10.00\",\r\n\t\t\t\"quantity\": 1,\r\n\t\t\t\"weight\": 3.24\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"amount\": 15,\r\n\t\t\t\"currency\": \"EUR\",\r\n\t\t\t\"country_of_origin\": \"CN\",\r\n\t\t\t\"description_customs\": \"Men's t-shirt 100% polyester\",\r\n\t\t\t\"quantity\": 2\r\n\t\t}\r\n\t],\r\n\t\"calculation_method\": \"DAP\",\r\n\t\"end_use\": \"NOT_FOR_RESALE\"\r\n}",
                                    "options": {
                                        "raw": {
                                            "language": "json"
                                        }
                                    }
                                },
                                "url": {
                                    "raw": "{{url}}/landedcost",
                                    "host": [
                                        "{{url}}"
                                    ],
                                    "path": [
                                        "landedcost"
                                    ]
                                }
                            },
                            "response": []
                        }
                    ]
                }
            ]
        }
    ]
}

Step 6: Choose “Import From Link”, then copy and paste the below Environment Variables JSON and click Import.

Environment Variables JSON:

{
    "id": "e606b8dd-5802-411a-8913-7d9f4db41497",
    "name": "Postal-ddp-Environment Variables",
    "values": [
        {
            "key": "client_id",
            "value": "use your client id",
            "type": "default",
            "enabled": true
        },
        {
            "key": "client_secret",
            "value": "use your client secret",
            "type": "default",
            "enabled": true
        },
        {
            "key": "account_number",
            "value": "use account number",
            "type": "default",
            "enabled": true
        },
        {
            "key": "bearer_token",
            "value": "",
            "type": "default",
            "enabled": true
        },
        {
            "key": "content-Type",
            "value": "application/json",
            "type": "default",
            "enabled": true
        },
        {
            "key": "url",
            "value": "https://api.nzpost.co.nz/postalddp/v1",
            "type": "default",
            "enabled": true
        },
        {
            "key": "url_uat",
            "value": "https://api.uat.nzpost.co.nz/postalddp/v1",
            "type": "default",
            "enabled": true
        },
        {
            "key": "url_prod",
            "value": "https://api.nzpost.co.nz/postalddp/v1",
            "type": "default",
            "enabled": true
        }
    ],
    "_postman_variable_scope": "environment",
    "_postman_exported_at": "2025-05-29T00:00:00.108Z",
    "_postman_exported_using": "Postman/11.30.0-250529-0000"
}

Step 7: Update the place-holder values in the Environment Variables with your own values.

Step 8: In the top right corner of Postman, click the environment selector and select the appropriate Environment variables collection.

resources/image-2bc11743-6605-4843-971c-20fa9faa1341.png

Postman collection is available to test postalddp API.


Reviews