Preview Cart for an Exchange Order

Before submitting an exchange request, we recommend previewing the balance state for the exchange order. Previewing can help you determine what functions are necessary, especially for uneven exchanges.

Required Editions
Available in: Enterprise, Unlimited, and Developer Editions

There are three outcomes of an uneven exchange.

  • Additional funds are needed because the web cart’s total amount is larger than the return order amount being returned: WebCart.GrandTotalAmount() > ReturnOrder.GrandTotalAmount()
  • A refund is needed because where the total amount being refunded is greater than the web cart total: WebCart.GrandTotalAmount() < ReturnOrder.GrandTotalAmount()
  • The exchange is an even exchange, where the totals equal each other: WebCart.GrandTotalAmount() = ReturnOrder.GrandTotalAmount()

To preview the cart, set the orderSummaryId (mainOrderSummaryId), exchangeCartId, and referenceId (returnOrderId) to be neither null nor empty. They must have valid Salesforce IDs and must represent a valid entity.

The ReferenceId must be type ReturnOrder. The return order StatusCategory must be activated. ReturnOrderId (ReferenceId) must belong to MainOrderSummaryId.

The minimum cart must contain at least one product and delivery group. Make sure that the cart belongs to the same account as the OrderSummary OrderSummary.Account equals cart.Account.

The preview response might look like this example.

1{
2  "changeBalances": {
3  "grandTotalAmount": -47.49,
4  "totalAdjDeliveryAmtWithTax": 12.94
5  "totalAdjDistAmountWithTax": 0,
6  "totalAdjProductAmtWithTax": -60.44,
7  "totalAdjustedDeliveryAmount": 11.99,
8  "totalAdjustedDeliveryTaxAmount": 0.95,
9  "totalAdjustedProductAmount": -55.96,
10  "totalAdjustedProductTaxAmount": -4.48,
11  "totalAdjustmentDistributedAmount": 0,
12  "totalAdjustmentDistributedTaxAmount": 0,
13  "totalAmount": -43.97,
14  "totalExcessFundsAmount": 47.49,
15  "totalFeeAmount": 0,
16  "totalFeeTaxAmount": 0,
17  "totalRefundableAmount": 47.49,
18  "totalRequiredFundsAmount": 0,
19  "totalTaxAmount": -3.52
20  },
21  "errors": [],
22  "orderSummaryId": "1OsSB000000UdWz0AK",
23  "success": true
24  }

See Also