# Troubleshooting Checkout Issues

Common issues encountered during the B2B Commerce checkout process and provides guidance to help identify and resolve them.

1. OOTB Checkout, Payment, or Place Order API Fails

| Action                                  | Troubleshooting Notes                                                                                                         |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Check for concurrent modifications      | Verify if other endpoints or custom code are concurrently modifying WebCart.                                                  |
| Validate last `/checkouts` API response | Last operation on checkout should return 200.                                                                                 |
| Handle 202 response                     | If last `/checkouts` API returned 202, wait until GET `/checkouts` returns 200, indicating asynchronous operations completed. |

2. Custom Components Can’t Update Checkout Information

| Action                           | Troubleshooting Notes                                                                                                         |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Verify checkout page load status | Check result of last GET `/checkouts` call. 202 response means checkout wasn't completely loaded.                             |
| Update customization logic       | Modify customization to wait for GET `/checkouts` to return 200 before attempting updates.                                    |
| Use out-of-the-box APIs          | Use OOTB APIs whenever possible. For example, OOTB API for updating phone number includes necessary validation at invocation. |

3. Payment or Billing Information Gets Overridden

| Action                                   | Troubleshooting Notes                                                                                                                                                                      |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Review API orchestration                 | Observe API call sequence and compare against standard OOTB Checkout flow.                                                                                                                 |
| Identify post-payment checkout API usage | Check if any Checkout API is used after entering payment/billing information. For example, updating shipping address re-runs calculators and invalidates payments if total amount changes. |
| Check custom Apex calls                  | Inspect all custom Apex calls made after entering payment/billing information. A customization might be overriding fields.                                                                 |

4. Payments Created But Not Updated on WebCart

| Action                                           | Troubleshooting Notes                                                                                                       |
| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| Examine `/checkouts/payments` PostAuth responses | Look for failures in PostAuth API response.                                                                                 |
| Identify concurrent modifications                | Most frequent cause is concurrent modification. Look for concurrent custom code modifying cart state.                       |
| Avoid concurrent cart modifications              | Eliminate concurrent calls modifying cart state.                                                                            |
| Verify pre-payment /checkouts status             | Verify last `/checkouts` call returned 200 before invoking payments. If not, modify orchestration to wait for 200 response. |

5. Order or Order Summaries Not Created

| Action                                  | Troubleshooting Notes                                                                                                  |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Check Checkout API failures             | Review responses of all Checkout APIs for failures.                                                                    |
| Focus on CheckoutPayment PostAuth API   | Common point of failure. Refer to troubleshooting steps in "Payments Created But Not Updated on WebCart."              |
| Verify subsequent API success           | Ensure APIs following payment step (PlaceOrder/SubmitOrder) were successful.                                           |
| Review process exceptions               | Navigate to Setup > Process Exceptions and check for recent exceptions. See Process Exceptions for more details.       |
| Troubleshoot high scale order ingestion | If High Scale Order Ingestion is enabled, try disabling and re-enabling Order Ingestion from Setup > Order Management. |

6. "Payment Method Isn't Authorized" Error

| Action                                                  | Troubleshooting Notes                                                                                                                                                                                                          |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Check `paymentMethodId` and `paymentGroupId` on WebCart | Verify both fields are present on WebCart. This applies to Commerce Webstore Checkout Orders API.                                                                                                                              |
| Validate payment amount sum                             | Ensure: PaymentGroup.TotalAuthAndSaleAmount + PaymentGroup.PendingAuthAndSaleAmount = WebCart.GrandTotalAmount (or FirstPymtGrandTotalAmount for subscriptions). Applies to Commerce Webstore Checkout Place Order Action API. |
| Validate custom solution                                | If using custom payment solution, ensure it incorporates required field validations.                                                                                                                                           |
| Verify OOTB solution                                    | If using OOTB payments, verify CheckoutPayment APIs response was successful.                                                                                                                                                   |

7. Order Summary Displays $NaN for $0.00 Line Items

| Action                               | Troubleshooting Notes                                                                |
| ------------------------------------ | ------------------------------------------------------------------------------------ |
| Check for custom calculator          | Determine if custom calculator is used for price or promotion logic.                 |
| Identify null/undefined price fields | Check if any price fields are left as null or undefined instead of being set to 0.   |
| Fix custom calculator                | Update custom calculator to explicitly set fields to 0 instead of null or undefined. |

8. Shipping Options or Delivery Methods Don’t Load (No Errors)

| Action                                     | Troubleshooting Notes                                                                                                    |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| Check for custom shipping calculator       | Determine if shipping calculator is custom implementation.                                                               |
| Verify shipping method generation (custom) | If custom, ensure calculator successfully generates and returns shipping methods.                                        |
| Verify CartValidationOutput (custom)       | If custom, ensure it creates CartValidationOutput for failure scenarios. Otherwise, checkout may get stuck in bad state. |

9. Phone Numbers Converted to E164 Format

| Action                             | Troubleshooting Notes                                                |
| ---------------------------------- | -------------------------------------------------------------------- |
| Understand phone number validation | Default validation converts input to E.164 format, removing hyphens. |
| Disable validation (workaround)    | Enable org permission CheckoutSkipPhoneValidation.                   |

10. ListPrice on OrderItem Doesn’t Map from CartItem

| Action                     | Troubleshooting Notes                                                                                        |
| -------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Understand default mapping | By default, CartItem.SalesPrice maps to OrderItem.ListPrice.                                                 |
| Change mapping             | Enable org permission SalesPriceToListPriceMap. This maps CartItem.ListPrice to OrderItem.ListPrice instead. |

11. "Cart is Currently in Use" Error

[Salesforce Knowledge Article Number: 002722661](https://help.salesforce.com/s/articleView?id=002722661\&type=1)

| Action                     | Troubleshooting Notes                                                      |
| -------------------------- | -------------------------------------------------------------------------- |
| Identify source API        | Pinpoint which API is returning this error.                                |
| Check for concurrent calls | Error indicates multiple concurrent calls attempting to update cart state. |
| Eliminate concurrent calls | Refactor process to eliminate concurrent calls modifying cart state.       |

12. CartCheckoutSession Not Created

| Action                          | Troubleshooting Notes                                                                      |
| ------------------------------- | ------------------------------------------------------------------------------------------ |
| Check for custom creation logic | Determine if customization creates CartCheckoutSession before invoking Checkout API.       |
| Use single creation method      | If custom logic exists, use only one method. Use standard Checkout API for this operation. |

13. Orders Created Even When Payment Fails in B2B LWR Store

| Action                                            | Troubleshooting Notes                                                                                                                                                         |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Identify Payment Provider and Webhook Usage       | Check if a payment provider, such as Adyen is used, which confirms payment via a webhook.                                                                                     |
| Check for Place Order API Usage                   | If the webstore uses Place Order API, orders are created immediately without waiting for the payment confirmation webhook, leading to order creation even on failed payments. |
| Switch to Place order Action API (Recommendation) | The recommended solution is to switch to Place order Action API, which only creates Orders after payment is confirmed by the webhook.                                         |

1. Out of Stock Error When Inventory Available

| Action                       | Troubleshooting Notes                                                                                                        |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Check cart size limit        | B2B stores have hard limit of 500 line items per order.                                                                      |
| Check OCI limit (if enabled) | If Order Confirmation Integration (OCI) is enabled, there's a limit of 100 product ID and location combinations per request. |

15."Invalid checkout session status. Expect: PendingClosed, actual: Active" with cartToOrderSummary

| Action                           | Notes                                                                                                                      |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Check for Place Order Action API | Determine if Place Order Action is enabled. See Streamline Place Order.                                                    |
| Compatibility issue              | If Place Order Action API is enabled, Apex method `Sfdc_Checkout.CheckoutOrderService.cartToOrderSummary` isn't supported. |

16. Incorrect Payment Amount

| Action                         | Troubleshooting Notes                                                                                          |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| Check API orchestration timing | Payment was likely initiated before waiting for all Checkout APIs to complete (before receiving 200 response). |
| Potential amount changes       | Amount fields on WebCart can change after asynchronous calculators complete. Always wait for 200 status.       |

17. "We Can't Find Checkout" Error

| Action                            | Troubleshooting Notes                                                                                                           |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Check OptionsCartCalculateEnabled | If OptionsCartCalculateEnabled is disabled, this error is expected. New CartCheckoutSession is required after cart is modified. |

18. Orders Created in Draft Status

[Salesforce Knowledge Article Number: 000393690](https://help.salesforce.com/s/articleView?id=000393690\&type=1)

| Action                     | Troubleshooting Notes                                                                                                                                             |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Check for concurrent calls | Concurrent calls modifying Cart and Checkout entities compete with Order Activation process, resulting in activation failure and order remaining in Draft status. |
| Eliminate competition      | Ensure no concurrent processes modify Cart/Checkout entities during Order Activation phase.                                                                       |
