Order Management

Using the Salesforce B2C Commerce APIs, you can customize your order processing functionality and payment processor methods. B2C Commerce also supports asynchronous payment methods.

Use the pipelet, GetPaymentProcessor, to establish the workflow to connect the payment method chosen by the customer (for example, credit card, bill-me-later, or bank card) to the payment processor defined through Business Manager. Use Studio to edit the pipelet.

You can configure multiple payment instruments per basket/order. For example, an order can be associated with multiple credit cards, gift certificates, or other payment methods. The SiteGenesis application implements a scenario where customers can redeem multiple gift certificates and pay the remaining amount with a credit card or BillMeLater.

Order Post-Processing APIs Deprecated 

The order post-processing APIs, including the Gillian package, are inactive by default, except for merchants who are already using them. Attempting to use them when they’re inactive throws an exception. Merchants who are already using them, can contact Salesforce Commerce Cloud Support to activate these APIs. Since the APIs are deprecated, they are no longer supported and can only be used as is.

These APIs are unrelated to Commerce Cloud Order Management.

Note

The following objects and APIs are inactive by default. The APIs are also at End of Adoption, and are not enabled for new instances.

Objects 

  • Appeasement
  • AppeasementItem
  • Invoice
  • InvoiceItem
  • Return
  • ReturnCase
  • ReturnCaseItem
  • ReturnHooks
  • ReturnItem
  • ShippingOrder
  • ShippingOrderHooks
  • ShippingOrderItem
  • dw.order.OrderItem
  • dw.order.TrackingInfo
  • dw.order.TrackingRef

APIs 

  • dw.order.Order.getShippingOrders()
  • dw.order.ProductLineItem.getOrderItem()
  • dw.order.ShippingLineItem.getOrderItem()
  • dw.order.Order.setOrderStatus(int)
  • dw.order.Order.getShippingOrders()
  • dw.order.Order.getShippingOrders()
  • dw.order.Order.getShippingOrder(String)
  • dw.order.Order.getShippingOrderItem(String)
  • dw.order.Order.getShippingOrderItems()
  • dw.order.Order.getReturnCases()
  • dw.order.Order.getReturns()
  • dw.order.Order.getReturn(String)
  • dw.order.Order.getReturnItems()
  • dw.order.Order.getReturnItem(String)
  • dw.order.Order.getReturnCase(String)
  • dw.order.Order.getReturnCaseItems()
  • dw.order.Order.getReturnCaseItem(String)
  • dw.order.Order.createReturnCase(String, boolean)
  • dw.order.Order.createReturnCase(boolean)
  • dw.order.Order.createServiceItem(String, String)
  • dw.order.Order.createAppeasement(String)
  • dw.order.Order.createAppeasement()
  • dw.order.Order.createShippingOrder(String)
  • dw.order.Order.createShippingOrder()
  • dw.order.OrderMgr.createShippingOrders(Order)
  • dw.order.Order.getInvoices()
  • dw.order.Order.getInvoice(String)
  • dw.order.Order.getInvoiceItems()
  • dw.order.Order.getInvoiceItem(String)

Create a Shipping Order 

The Shipping Order Creation API has been optimized, making it possible to create ShippingOrders and ShippingOrderItems with the B2C Commerce Script API. The allocation of inventory is now decoupled from the shipping order creation process. It's also possible to trigger the shipping order creation process from the B2C Commerce Script API by calling OrderMgr#createShippingOrders(Order order).

Obsolete Basket Cleanup 

Baskets have a refID that stores customerID, agentID, or NULL. If the refID is NULL, the basket can be removed from B2C Commerce via a basket cleanup job. The basket ID is stored in the session dictionary to help differentiate between baskets restored and baskets restored previously.

Update Orders After Placement Using the APIs 

You might want to let an order management system cancel or open orders using the B2C Commerce APIs. When you cancel an order using the API, an entry is created in the order history, just as it is when you cancel an order through Business Manager. When you replace an order via the API, an entry is created in history that specifies the replacement's document number; while the replacement order contains information about the replaced order. If you cancel or replace an order via the API, the inventory availability for that order is updated.

The Gillian cartridge contains specific support for product bundles. All 'sent' notifications include information for the product bundle only, the bundled products are skipped.

Note

Asynchronous Payment Methods 

Salesforce B2C Commerce uses specific APIs and order status to support order checkout processes that integrate with asynchronous payment method such as PayPal, iDeal, GlobalCollect, and many others.

Using an asynchronous method means that during order submission, the customer leaves the storefront and is redirected to the payment site. After successful payment completion, the customer is redirected to B2C Commerce where the order is created.

Order creation is separate from order placement using two pipelets: CreateOrder and PlaceOrder. The FailOrder pipelet is used to set the order status to FAILED.

Typical order processing is as follows:

  1. Order creation: CreateOrder
  2. Payment authorization
  3. Order placement: PlaceOrder

The basket is removed when the order is placed.

Note

Order Status: CANCELLED 

The order can be canceled via the CancelOrder pipelet and in Business Manager. This is what happens:

  • Order status is set to CANCELLED
  • Coupon redemptions are removed
  • Product list purchases are removed
  • Order history entry is created
  • Inventory is released

Order Status: CREATED 

The order record is saved in B2C Commerce with the status CREATED before the payment is authorized. If the shopper doesn't return to the online store to complete order processing, a customer service representative (CSR), at the shopper's request, can use Business Manager to update the status of the order to NEW, which causes the order to move on to the fulfillment process.

The GMV for an order is calculated when the order is processed.

Note

If a shopper continually navigates, invoking this part of the checkout process, B2C Commerce will not fill up with CREATED orders. Instead, an order is associated with a basket when it is created and is used if the customer returns to the beginning of the checkout process.

Order Status: FAILED 

When an order fails, the following occurs:

  1. Order status is set to FAILED.
  2. Coupon redemptions that were created are removed.
  3. Inventory reservations are canceled.

The FAILED status means that an order did not successfully complete payment authorization and could not be placed. Although the order exists, it's marked as FAILED because a problem occurred that could not be recovered.

Orders with the FAILED status can't be reopened or canceled. The CancelOrder pipelet will abort on the error exit when it is executed on an order with the FAILED status. The pipelet returns the error status code: OrderProcessStatusCode.ORDER_ALREADY_FAILED.

However, a new order to replace the failed one can be placed. Using the FAILED status value, a customer service representative (CSR) can search in the Business Manager Ordering module to identify and manage failed orders.

Order Journal 

For asynchronous payment methods, the following pipelets create the corresponding action in B2C Commerce's order journal.

PipeletAction
CreateOrderCREATE_FOR_AUTHORIZATIONCREATE
CreateOrder2CREATE_FOR_AUTHORIZATION
FailOrderFAILED

APIs for Payment Processors/Methods 

You can access payment processor or method information using Salesforce B2C Commerce APIs and import/export this information using schemas. See the B2C Commerce API documentation for more information.

Pipelets 

Use these pipelets for payment-related transactions.

  • AddPaymentInstrumentTobasket
  • CreateBasketPaymentInstrument
  • CreateCustomerPaymentInstrument
  • CreatePaymentTransaction
  • GetCustomerPaymentInstruments
  • GetPaymentProcessor
  • RemoveBasketPaymentInstrument
  • RemoveCustomerPaymentInstrument
  • VerifyCreditCard
  • VerifyCreditCardExpirationDate
  • VerifyCreditCardNumber
  • VerifyPaymentCard
  • VSAuthorizeCreditCard

Scripting 

Use these APIs from the dw.order package to process payment-related transactions.

  • PaymentCard
  • PaymentInstrument
  • PaymentMethod
  • PaymentMgr
  • PaymentProcessor
  • PaymentStatusCodes
  • PaymentTransaction

Basic Order Management Integration Framework 

Certain system pipelines and API objects, along with the Gillian cartridge, available in the Salesforce Commerce Cloud community on GitHub, enable you to integrate automated order routing and payment processing capabilities into Salesforce B2C Commerce. You create the business logic that uses the objects.

Most of the functionality described in this topic is not available in most implementations.

Note

You can use this functionality to:

  • Create and export ShippingOrders

  • Use an import to update the status of ShippingOrders

    When an error exists in an import file, the shipping order or the return imports fail. A file is created, using the original file name with a .BAD extension. You can fix the error in the order import, rename the file with the original .xml extension, and then rerun the import. Properties unknown to the import specification (XSD) are not included in the .BAD files; however, custom properties are included.

  • Capture or refund payments

  • Provide a self-service return merchandise authorization (RMA) and refund items once received

  • Support partial delivery and capture based on either B2C Commerce inventory tables or an external inventory

Select site > Merchant Tools > Ordering > Orders > order. Track changes made by custom jobs or imports on shipping orders, invoices, or returns by clicking the Shipping Orders, Invoices, or Returns tabs, respectively. The information on these tabs is read-only. The tabs only appear when an order contains a shipping order, invoice, or return.

Pipelines 

The GillianJobs pipeline contains CreateShippingOrders, ImportReturn, and UpdateShippingOrders. You set up system job schedules to call the GillianJobs pipeline by selecting Administration > Operations > Schedules. Configure the schedules with an Execution Scope of Sites (click Sites), with scheduled execution from between once every 30 minutes to once every 2 hours.

API Objects 

Use the following API objects to customize your order management processes:

API objectDescription
ShippingOrderGroup of items that are shipped together. The content of a ShippingOrder is a subset of items of one dw.order.Shipment, and depends on inventory and custom code extensions such as warehouse optimization and dropship settings. Due to ShippingOrder update feeds, certain items of a ShippingOrder can be marked as shipped, canceled, or warehouse.
TrackingInfoTrackingInfo: contains a tracking#, shipping date, and carrier name, by default. You can also add custom attributes, for example, a tracking link. You can now link all shipped items of a ShippingOrder to one or more tracking details by calling the addTrackingRef method in ShippingOrderItem. This associates a shipped item with one or more TrackingInfos.
InvoiceMonetary representation of either a ShippingOrder, Return, or Appeasement. It's the base of any payment transaction (capture / refund).
ReturnCaseAbstraction of an RMA. Every return without a ReturnCase reference is assigned to a new ReturnCase.
ReturnContainer of items that were returned to the merchant. Depending on custom code implementations, certain actions such as a refund or an even exchange can be done.

Import 

The file naming pattern for the import feeds for shipping order updates is:

{Impex}/src/feeds/shippingorder/shipping_order_update_feed_SiteGenesis_20131101141905769_23.xml

For the return import, the file naming pattern is:

{Impex}/src/feeds/return/return_import_feed_SiteGenesis_20131101141905768_11.xml

Appended to the file name are:

  • The timestamp, precise to milliseconds
  • An underscore
  • An arbitrary number that represents a feed ID

Export 

When running a ShippingOrder export, you can define an XML structure of your own. Exports are handled in the sample code of createShippingOrder.ds.

In the Gillian sample script that creates shipping orders, a new shipping order is exported to a file. The export includes shipping order items, such as option and bundle items, in a hierarchical structure, with reference between the parent and child items. A new item type attribute enables you to specify the child or parent type, as follows:

  • PRODUCT
  • OPTION
  • BUNDLED_PRODUCT