USPS addon for Multivendor Dropship
- Community
- Real-time USPS REST API v3 shipping rates
- Calculates shipping separately from each vendor’s origin
- Combines multiple vendor shipping rates into one checkout method
- Supports vendor-specific USPS services, package dimensions, and allowed methods
- Includes secure rate caching, OAuth2 authentication, debug mode, and detailed logging
The Problem
- ✖ Standard shipping methods calculate the entire cart from a single origin
- ✖ Products fulfilled by different vendors may require separate USPS shipments
- ✖ Using one origin can produce inaccurate shipping rates and reduce profit margins
- ✖ Manually calculating and combining vendor shipping charges is inefficient
The Solution
The Toweringmedia USPS Multi-Vendor Shipping Extension groups Magento cart products by vendor and calculates USPS shipping separately from each vendor’s configured postal code. It retrieves real-time rates through the USPS REST API v3, filters the available services using each vendor’s allowed-method settings, and combines the individual vendor charges into one clear shipping option at checkout.
How It works
See It In Action
Magento 2 USPS Multi-Vendor Shipping
Calculate USPS Shipping from Multiple Vendor Origins in One Checkout
The Toweringmedia USPS Multi-Vendor Shipping Extension for Magento 2 calculates USPS shipping rates separately for products supplied by different vendors. Cart items are grouped by vendor, each group is rated from its corresponding shipping origin, and the resulting vendor charges are combined into a single shipping option for the customer.
The extension uses the USPS REST API v3 with OAuth2 authentication to retrieve real-time shipping rates. It supports vendor-specific allowed services, shared package dimensions, secure rate caching, sandbox testing, debug logging, and reusable credentials from the Toweringmedia standalone USPS module.
Multi-Vendor Rate Calculation
Calculate Shipping Accurately for Products Fulfilled by Different Vendors
A standard shipping calculation normally treats the cart as one shipment from one
location. That approach can produce inaccurate charges when products are fulfilled
by several vendors. This extension groups products using their assigned
tm_vendor_id value and processes each vendor group independently.
For every vendor group, the extension uses the vendor’s postal code as the shipping origin. It requests the applicable USPS rates, filters the results according to the vendor’s allowed methods, and selects an available rate. The individual vendor charges are then added together and displayed as one customer-friendly shipping method.
- ✓ Groups cart items according to their assigned vendor
- ✓ Uses each vendor’s postal code as the shipping origin
- ✓ Requests USPS rates separately for every vendor shipment
- ✓ Filters rates using each vendor’s allowed USPS methods
- ✓ Combines vendor charges into one checkout rate
USPS REST API v3 Integration
Offer Real-Time USPS Services and Pricing
The extension connects to the USPS REST API v3 using the OAuth2 client credentials flow. It reuses credentials and shared API behavior configured in USPS REST API (Toweringmedia) Standalone, keeping USPS connection details in one central configuration.
Depending on the shipment, vendor configuration, destination, and USPS API response, available services can include USPS Ground Advantage, Priority Mail, Priority Mail Express, First-Class Mail, Media Mail, and Parcel Select Ground.
- ✓ OAuth2 client-credentials authentication
- ✓ Cached OAuth tokens to reduce repeated authentication requests
- ✓ USPS Domestic Prices v3 TotalRatesQuery integration
- ✓ Sandbox and production API environments
- ✓ Shared credentials with the Toweringmedia standalone USPS carrier
Vendor-Specific Configuration
Control USPS Availability for Every Vendor
Each vendor is configured under Toweringmedia > Vendors. To use this carrier, the vendor’s carrier must be set to USPS, the vendor must have valid allowed methods, and the vendor address must include a valid postal code.
This configuration allows different vendors to offer different USPS services while shipping from their own locations. Disabled vendors or vendors without the required shipping information are not treated as valid USPS shipping origins.
- ✓ Vendor-specific USPS carrier selection
- ✓ Vendor-specific allowed service methods
- ✓ Vendor postal code used as the shipment origin
- ✓ Support for different shipping origins in the same cart
- ✓ Integration with Toweringmedia Multi-Vendor Dropship
Package Dimensions and Weight
Build USPS Requests from Magento Product Data
Package dimensions are obtained from the shared product attributes
tm_pkg_length, tm_pkg_width, and
tm_pkg_height. The available dimension modes are inherited from the
standalone USPS module.
When several items are included in a vendor shipment, package length and width use the largest item values. Package height is calculated by adding each item’s height multiplied by its quantity. Total shipment weight is calculated for each vendor group.
- ✓ Product-level length, width, and height attributes
- ✓ Product-attribute dimension mode
- ✓ Automatic dimensional-weight mode
- ✓ Hybrid fallback dimension mode
- ✓ Multi-item package aggregation for each vendor
Magento Administration
Configure the Multi-Vendor USPS Checkout Method
Configure the carrier from Stores > Configuration > Sales > Delivery Methods > USPS REST API (Toweringmedia) Multi-Vendor. Administrators can enable or disable the carrier, change its checkout title, select sandbox mode, and control the maximum number of shipping methods returned.
USPS credentials are not duplicated in the multi-vendor configuration. The consumer key, consumer secret, and shared API behavior are managed through USPS REST API (Toweringmedia) Standalone.
- ✓ Enable or disable the multi-vendor USPS carrier
- ✓ Configurable checkout title
- ✓ USPS sandbox mode for testing
- ✓ Configurable Top N Methods limit
- ✓ Centralized credential ownership in the standalone USPS module
Performance and Diagnostics
Secure Rate Caching and Detailed Shipping Logs
Rate responses are cached for five minutes to reduce repeated USPS API requests. Cache entries distinguish the carrier, vendor, origin postal code, destination postal code, weight, allowed methods, and customer session.
The cache is limited to 100 entries and automatically removes expired data. Input and
cached-rate validation help protect against cache poisoning, weight manipulation,
destination changes, vendor switching, excessive memory use, and cross-user access.
Diagnostic information is recorded in var/log/shipping.log when debug
logging is enabled.
- ✓ Five-minute rate-cache lifetime
- ✓ Maximum of 100 cache entries with automatic cleanup
- ✓ Vendor, destination, weight, method, and session-aware cache keys
- ✓ OAuth token caching to reduce authentication requests
-
✓
Detailed vendor-rate logging in
var/log/shipping.log
Technical Specifications
Module
Toweringmedia_USPSMultiVendor
Carrier Code
toweringmedia_usps_multivendor
USPS Integration
USPS REST API v3 with OAuth2 authentication
Required USPS Module
Toweringmedia USPS REST API
Vendor Integration
Toweringmedia Multi-Vendor Dropship
Vendor Attribute
tm_vendor_id
Dimension Attributes
tm_pkg_length, tm_pkg_width, tm_pkg_height
Cache Lifetime
Five minutes
Log File
var/log/shipping.log
Required Components
Frequently Asked Questions
How does the extension calculate USPS shipping for multiple vendors?
Does this extension require separate USPS API credentials?
Can different vendors use different shipping origins?
Can each vendor offer different USPS services?
Which USPS services are supported?
Does the extension cache USPS shipping rates?
Where are USPS rate calculations and errors logged?
- Real-time USPS REST API v3 shipping rates
- Calculates shipping separately from each vendor’s origin
- Combines multiple vendor shipping rates into one checkout method
- Supports vendor-specific USPS services, package dimensions, and allowed methods
- Includes secure rate caching, OAuth2 authentication, debug mode, and detailed logging
📘 Documentation
Get started quickly with our detailed user guide. The documentation covers installation, USPS REST API credentials, vendor-origin configuration, product package attributes, allowed USPS services, rate calculation, secure caching, testing, and troubleshooting.
- Step-by-step installation instructions
- Required Toweringmedia module dependencies
- USPS REST API credential and environment configuration
- Vendor assignment and shipping-origin setup
- Package dimensions and vendor-specific allowed services
- Secure rate caching, debug logging, checkout testing, and troubleshooting
💬 Support
Need help? Our Magento experts can assist with installation, USPS API configuration, vendor shipping origins, allowed services, package settings, checkout-rate testing, and troubleshooting.
- Quick and reliable email support
- Help with extension installation and configuration
- Assistance with USPS REST API credentials and environments
- Guidance for vendor assignments and shipping origins
- Troubleshooting missing, incorrect, or combined checkout rates
- Regular updates and Magento compatibility support
The extension calculates USPS shipping separately for products fulfilled by different vendors. It groups cart products by vendor, requests rates using each vendor’s postal code as the shipping origin, and combines the individual vendor charges into one shipping option at checkout.
Products are assigned to vendors through the
tm_vendor_id product attribute. Vendor shipping origins,
carrier selections, and allowed USPS methods are managed through the
Toweringmedia Multi-Vendor Dropship configuration.
Yes. Each vendor group is rated using the postal code from that vendor’s configured address. This helps produce more accurate USPS charges when products in the same cart are shipped from different locations.
No. USPS OAuth2 credentials, the API environment, and shared package settings are configured in USPS REST API (Toweringmedia) Standalone. The multi-vendor extension reuses those settings for its USPS rate requests.
Supported services include USPS Ground Advantage, Priority Mail, Priority Mail Express, First-Class Mail, Media Mail, and Parcel Select Ground. Availability depends on the shipment, USPS API response, and allowed methods configured for each vendor.
Yes. Each vendor can have its own JSON-based allowed-methods configuration. The extension filters the USPS API results using that vendor’s settings before selecting and combining the applicable shipping rates.
Yes. Enable sandbox mode and configure valid USPS sandbox credentials
in the standalone USPS module. Test Connection makes a single OAuth
request, while Test Sample Rate makes one OAuth request and one USPS
rate request. Debug information is written to
var/log/shipping.log when logging is enabled.
The extension requires Toweringmedia Multi-Vendor Dropship for vendor management and product-to-vendor assignments. It also requires Toweringmedia USPS REST API for USPS credentials, OAuth2 authentication, API communication, and shared package configuration.
- Magento Version: Magento 2.4.x
- PHP Version: PHP 8.1 and 8.2
- Magento Editions: Magento Open Source and Adobe Commerce
- Framework: Built using Magento 2 dependency injection and carrier architecture
- Core Overrides: No Magento core-file overrides
- Composer Package: toweringmedia/module-usps-multivendor
- Magento Module: Toweringmedia_USPSMultiVendor
- Carrier Code: toweringmedia_usps_multivendor
- Installation Type: Composer or manual installation
- Required Integrations: Toweringmedia USPS REST API and Multi-Vendor Dropship
- Shipping Provider: USPS
- API Type: USPS REST API v3
- Rate API: Domestic Prices v3 TotalRatesQuery
- Authentication: OAuth2 client credentials using a USPS consumer key and secret
- API Environments: USPS sandbox and production
- Rate Calculation: Separate vendor-origin rates combined at checkout
- Vendor Product Attribute: tm_vendor_id
- Package Attributes: tm_pkg_length, tm_pkg_width, and tm_pkg_height
- Vendor Services: Vendor-specific JSON allowed-method configuration
- Method Limit: Configurable Top N Methods
- Rate Cache: Session-isolated cache with a five-minute lifetime and 100-entry limit
- Log File: var/log/shipping.log