Magento Tutorials

How to Configure USPS Shipping Method in Magento 2

The United States Postal Service (or USPS) is integrated in Magento as one of its default shipping method. The USPS is the agency of the U.S offering domestic and international delivery to more than 190 countries, both by land and air. In this tutorial, we will guide you to configure USPS in Magento admin panel.

Get your USPS Web Tools credentials

First of all, having an account on USPS Web Tools is crucial. Kindly create a new one if you haven’t registered:

  • Open USPS Web Tools via this URL: https://registration.shippingapis.com/
  • Key in all required fields in a registration form as below
    USPS register
  • After completion, you will receive your User ID and a URL to the USPS test server.

Configure USPS in Magento 2

In your backend, navigate to Stores > Configuration (under Settings tab) > Shipping Methods (under Sales tab)

Expand the USPS set of options.

USPS settings in Magento 2

  1. Set Enabled for Checkout to Yes.
  2. The Gateway URL and Secure Gateway URL are set by default, and you should leave it as it is.
  3. Name this shipping method by key in the Title field if needed, or you can leave it as default.
  4. Enter the User ID and Password for your USPS account.
  5. Choose Mode as:
    • Development: if you want to run USPS in a test environment.
    • Live: if you want to run USPS in your live site.
      USPS settings in Magento 2 - 2
  6. Set Packages Request Type to:
    Divide to Equal Weight (one request): Choose this if the goods in packages have approximately equal weight.Use Origin Weight (few requests): Choose this if there are child products among other large goods in packages.
  7. Choose Container as the packaging type frequently used in your store. You can choose among:
    • Variable (if you are not sure what packaging type should be chose, choose this)
    • Flat-Rate Box
    • Flat-Rate Envelope
    • Rectangular
    • Non-Rectangular
  8. Set the Size as:
    • Regular
    • Large
  9. Set Machinable to Yes or No, depending whether your typical package can be processed by a machine or manually.
  10. Enter the Maximum Package Weight according to your carrier requirements.
    USPS settings in Magento 2 - 3
  11. Set Calculate Handling Fee to Fixed or Percent
  12. Determine Handling Applied to Per Order or Per Package
  13. Enter the amount of the Handling Fee. Use the decimal format for a percentage.
  14. Pick options in Allowed Methods list
  15. Set the Free Method to Yes or None.
  16. Set Enable Free Shipping Threshold field to Disable or Enable.
  17. Displayed Error Message: Leave this message as default or write a tailored message
    USPS settings in Magento 2 - 4
  18. Set Ship to Applicable Countries to all or specific countries where this shipping method can be used.
  19. Set Show Method if Not Applicable to
    • Yes: Lists all available USPS shipping methods during checkout, including those that don’t apply to the shipment.
    • No: Lists only the USPS shipping methods that are applicable to the shipment.
  20. Set Debug to Yes if you need a log file with activities of USPS shipments.
  21. In the Sort Order field, determine in which order USPS shipping method appears in the shipping methods list.
  22. Click Save Config.