UPS shipping method integration migration from SOAP to RESTful API

Note: If you uploaded any of the three patches from this article prior to June 6, 2024: If you are facing this issue because of the Metric System/SI measurements (kilograms and centimeters) not being used, you should re-apply one of these new, updated patches now published in this article for your 2.4.4+/2.4.5+/2.4.6+ version of Adobe Commerce/Magento Open Source once again, because otherwise you will not be able to select the Metric System/SI measurements of kilograms and centimeters in the UPS shipping methods in the Admin configuration. These new patches are compatible with the previously released patches. This issue will be fixed permanently in scope of upcoming Adobe Commerce version 2.4.7-p1 release planned for June 11, 2024.

Note:  If you uploaded any of the three patches from this article prior to October 10, 2023, you should reapply one of these patches now published in this article for your 2.4.4+/2.4.5+/2.4.6+ version of Adobe Commerce/Magento Open Source once again, because otherwise you will not be able to select and configure specific UPS shipping methods in the Admin configuration, and you will have to have all of them enabled. These new patches are compatible with the previously released patches.

This article provides a patch to resolve issues with the United Parcel Service (UPS) shipping method integration migration from SOAP to RESTful API for Adobe Commerce 2.4.4 - 2.4.6-pX.

Beginning in June 2024, Adobe Commerce merchants will not be able to transact with our current UPS integration, so we are releasing this hotfix, which allows Adobe Commerce 2.4.4+/2.4.5+/2.4.6+ merchants to migrate to the latest UPS REST APIs.

This issue will be fixed in Adobe Commerce/Magento Open Source version 2.4.7, and the fix will also be included in the 2.4.7-beta2 release in October 2023.

Description description

Affected products and versions

Adobe Commerce on cloud infrastructure and on-premises, and Magento Open Source:

  • 2.4.4
  • 2.4.4-pX
  • 2.4.5
  • 2.4.5-pX
  • 2.4.6
  • 2.4.6-pX

Causes

The UPS released a security update for their API.

If you have European Union (other origins may experience the same problem) as Origin of the Shipment this will cause an error in the UPS REST request:
“A shipment cannot have a KGS/IN or LBS/CM or OZS/CM as its unit of measurements.”

Resolution resolution

According to the latest updates to the UPS API Security Model, UPS has implemented an OAuth 2.0 security model for all APIs (More details available in the UPS Developer Portal Access Key Migration Guide) to enhance the overall security to reduce fraud and provide enhanced API capabilities.

This change impacts our current UPS shipping method integration implementation in Adobe Commerce and requires us to fix our current implementation and to migrate from SOAP API to the RESTful API to be able to support OAuth 2.0 authentication protocols.

Solution

Use the following attached patches, depending on your Adobe Commerce/Magento Open Source version:

To resolve the issue in the 2.4.4+, 2.4.5+, and 2.4.6+ versions, you must apply the corresponding patch to your version of Adobe Commerce/Magento Open Source below.

Patch

Use the following attached patches, depending on your Adobe Commerce/Magento Open Source version:

For versions 2.4.4, 2.4.4-pX:

For versions 2.4.5, 2.4.5-pX:

For versions 2.4.6, 2.4.6-pX:

How to apply the patch

Unzip the file and see How to apply a composer patch provided by Adobe in our support knowledge base for instructions.

How to tell whether the patches have been applied

Considering that it is not possible to easily check if the issue was patched, you might want to check whether the patch has been successfully applied. This uses (Example: AC-9363) as the patch to check.

You can do this by taking the following steps:

  1. Install the Quality Patches Tool.

  2. Run the command: vendor/bin/magento-patches -n status |grep "9363|Status"

  3. You should see output similar to this, where AC-9363 returns the Applied status:

    code language-none
    ║ Id│ Title│ Category │ Origin│ Status│ Details║    ║ N/A │ ../m2-hotfixes/AC-9363_USPS_Ground_Advantage_shipping_method_COMPOSER_patch.patch │ Other│ Local│ Applied│ Patch type: Custom
    

After applying the patch

Step 1: Create a UPS App in the UPS Developer Portal

To use the UPS REST API, you need to create an app in the UPS Developer Portal to generate the required credentials (Client ID and Client Secret). Follow these steps:

  1. Log in to the UPS Developer Portal

    • Navigate to https://developer.ups.com/.
    • Use your UPS account credentials to log in. If you do not have an account, click the Sign Up button to create one.
  2. Create a New Application

    • Once logged in, go to the Dashboard and click Create Application.
    • Provide a name for your application (for example, Adobe Commerce UPS Integration).
  3. Select the Required APIs

    • During the app creation process, when prompted, select the APIs your app will use. Ensure you include:

      • Rate API: For fetching shipping rates.
      • Time in Transit API: For delivery time estimates.
      • Any other APIs relevant to your shipping needs (for example, Tracking API, if applicable).
  4. Set Permissions

    • Ensure the app has the necessary permissions enabled for the selected APIs.
    • This is typically done during app creation, but you can review and update permissions later in the app settings.
  5. Generate Credentials

    • After the app is created, navigate to the Credentials section.
    • Copy the Client ID and Client Secret. These will be used to configure the UPS REST integration in Adobe Commerce.
    • Note: Keep these credentials secure and don’t share them publicly.
  6. Test the App

    • Use the UPS Developer Portal’s testing tools to verify that your app is working correctly and can fetch data from the selected APIs.

Step 2: Configure UPS REST in Adobe Commerce

Once you have the Client ID and Client Secret, proceed with configuring the UPS REST integration in Adobe Commerce.

Make sure to select UPS Type = “United Parcel Service REST”.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f