Magento 2 UPS XML end of life June 3rd

Magento 2 UPS XML end of life June 3rd

UPS XML End of Life - Magento 2 Transition Guide

UPS announced that the XML shipping API will be deprecated and reach its end of life on June 3rd, 2024. This means that any applications or integrations relying on this API for UPS services, including shipping rate calculation, tracking, and label generation, will need to transition to the newer API.

For Magento 2 users and developers, it’s crucial to update your shipping methods to ensure continued functionality. Here's a step-by-step guide to help you transition from UPS XML to the new API:

Step-by-Step Guide to Transition from UPS XML to the New API

1. Review UPS API Documentation

  • Visit the UPS Developer Kit to get the latest documentation on the new API.
  • Familiarize yourself with the endpoints and required changes.

2. Update Magento 2 Configuration

  • Go to the Magento 2 admin panel.
  • Navigate to Stores > Configuration > Sales > Shipping Methods.
  • Locate the UPS section and review the current settings.

3. Install Necessary Modules

  • Ensure you have the latest version of any UPS-related modules or extensions.
  • Check for any updates or new releases from your module providers that support the new API.

4. Modify API Credentials

  • Obtain new API credentials if required.
  • Update your Magento configuration with these new credentials:

$config = [
    'username' => 'your_ups_username',
    'password' => 'your_ups_password',
    'access_key' => 'your_ups_access_key',
    'endpoint' => 'new_api_endpoint'
];
    

5. Update API Endpoints in Custom Code

  • If you have custom code interacting with the UPS API, update the endpoints to match the new API.
  • Example update in PHP:

$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'new_api_endpoint', [
    'auth' => ['your_ups_username', 'your_ups_password'],
    'headers' => ['AccessKey' => 'your_ups_access_key'],
    'json' => $data
]);
    

6. Test the New API

  • Test all UPS functionalities (rate calculation, tracking, label printing) to ensure they work with the new API.
  • Use the UPS sandbox environment if available for testing.

7. Monitor for Issues

  • After transitioning, monitor the Magento logs for any issues or errors.
  • Address any issues promptly to ensure seamless operation.

Example Configuration Update

Here's an example of updating the UPS shipping method configuration in Magento 2:


use Magento\Framework\App\Config\ScopeConfigInterface;

class UPSShippingUpdate
{
    private $scopeConfig;

    public function __construct(ScopeConfigInterface $scopeConfig)
    {
        $this->scopeConfig = $scopeConfig;
    }

    public function updateUPSConfig()
    {
        $this->scopeConfig->setValue(
            'carriers/ups/access_license_number',
            'new_access_key',
            ScopeConfigInterface::SCOPE_TYPE_DEFAULT
        );
        $this->scopeConfig->setValue(
            'carriers/ups/username',
            'new_username',
            ScopeConfigInterface::SCOPE_TYPE_DEFAULT
        );
        $this->scopeConfig->setValue(
            'carriers/ups/password',
            'new_password',
            ScopeConfigInterface::SCOPE_TYPE_DEFAULT
        );
        $this->scopeConfig->setValue(
            'carriers/ups/gateway_url',
            'new_api_endpoint',
            ScopeConfigInterface::SCOPE_TYPE_DEFAULT
        );
    }
}
    

Conclusion

Transitioning to the new UPS API is essential to ensure uninterrupted UPS services in your Magento 2 store. Follow the steps outlined above, update your configurations, test thoroughly, and monitor for any issues. If you need further assistance, consider reaching out to a Magento developer or your module provider for support services.