Order Management Developer Guide HTML
Order Management Developer Guide HTML
Developer Guide
Version 61.0, Summer ’24
names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
1
Salesforce Order Management Developer Guide Order Management Developer Resources
FulfillmentOrder Class
OmnichannelInventoryService Class
OrderPaymentSummary Class
OrderSummary Class
OrderSummaryCreation Class
Repricing Class
ReturnOrder Class
Routing Class
Salesforce Flow
Flow Builder
2
Salesforce Order Management Developer Guide Order Management Developer Resources
Platform Events
FOStatusChangedEvent
FulfillOrdItemQtyChgEvent
OrderStatusChangedEvent
OrderSummaryCreatedEvent
OrderSumStatusChangedEvent
PendingOrdSumProcEvent
ProcessExceptionEvent
Implementation
Salesforce Order Management Implementation Guide for B2B and B2B2C Commerce (PDF)
Commerce Payments
Data Models for CCS Order and Invoice Objects
CreditMemo
CreditMemoLine
Invoice
InvoiceLine
Payment
PaymentAuthorization
3
Salesforce Order Management Developer Guide Order Summary Entity Relationships
PaymentGateway
PaymentGatewayLog
PaymentGatewayProvider
PaymentGroup
PaymentLineInvoice
PaymentMethod
CommercePayments Namespace
4
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
To view a diagram of all object relationships in your organization, from Setup, in the Quick Find box, enter Schema Builder, and
then select Schema Builder. For information on using Schema Builder, see Design Your Own Data Model in Extend Salesforce with Clicks,
not Code.
Integration Notes
General:
• B2C Commerce sends orders in New or Open status to Salesforce Order Management. To delay sending an order, for example, to
perform a fraud check, keep it in Created status.
• B2C Commerce sends order data to Salesforce Order Management according to a set frequency and when the packet of pending
orders reaches a certain size. The process is similar to the one used for Commerce Cloud Order Management. In addition, the
integration contacts B2C Commerce every 5 minutes to request any pending order data.
5
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
• The B2C Integration can’t create an order with a combined total of more than 200 OrderItems and OrderItemAdjustmentLineItems.
For example, it can create an order with 150 OrderItems and 45 OrderItemAdjustmentLineItems, but can’t create an order with 110
OrderItems and 100 OrderItemAdjustmentLineItems. To import an order that exceeds this limit, use Bulk API 2.0. For information
about manually importing orders into Order Management, see Importing Order Data.
• The integration associates sites in B2C Commerce with SalesChannels in Order Management. It identifies the SalesChannel for an
order by searching for a SalesChannelName value that matches the site/site-id value in the order data.
• For details of the B2C Commerce order data format, see the Order XSD Schema in the B2C Commerce Infocenter.
• The B2C Integration service user is an internal Salesforce user. If you set internal organization-wide sharing defaults for any objects
accessed by the integration, set them to Public Read/Write access.
Note: For information about organization-wide sharing defaults, see Organization-Wide Sharing Defaults in Salesforce Help.
• If the Salesforce org ID or login URL changes, or if you run DBInit on your B2C Commerce storefront, the integration requires updating.
To reprovision the integration, open a case with Salesforce Customer Support as described in the Order Management Implementation
Guide.
• If you refresh a sandbox org, or change the Tenant ID of a B2C Commerce instance, repeat the implementation process as described
in the Order Management Implementation Guide. For information on sandbox orgs, see the sandbox topics in Salesforce Help.
• To deactivate the integration, open a case with Salesforce Support.
• To stop sending orders from a site, log in to Business Manager, navigate to Merchant Tools > Site Preferences > Order, and turn
off the Include in Order Management setting.
Shopper Accounts:
• When the order/billing-address/company-name value in the order data is not null, Order Management always uses
a standard account and contact to represent the shopper.
• If you enable Person Accounts, don’t change the names or API names of the two default Account record types. The B2C Integration
uses those types to represent shopper accounts.
• You can configure the integration to identify existing shoppers by applying your org’s duplicate and matching rules for Accounts,
Contacts, and Person Accounts. To enable this feature, in Setup, in Order Management Settings, turn on B2C Integration Data
Matching Rules. For more information on configuring duplicate management, see Manage Duplicate Records in Salesforce Help.
Note: If your org’s matching rules identify multiple potential duplicate records, the integration selects the one with the highest
match score. If multiple records tie for the highest match score, you can’t guarantee which is selected.
Note: Applying complex custom matching rules can affect the integration’s performance.
• The integration can’t look up any encrypted fields on Salesforce objects. Encrypting any of the fields it uses to look up records causes
order ingestion to fail. If you want to encrypt the Account.Name, Account.PersonEmail, or Contact.Email field, then you must
implement custom duplicate and matching rules that don’t use any encrypted fields. For more information on encryption restrictions,
see General Shield Platform Encryption Considerations in Salesforce Help.
• For detailed information on the storage and identification of shopper accounts, see Order Management Shopper Records in Salesforce
Order Management in Salesforce Help.
International Considerations
• If the order/taxation value for an order is net, then the integration creates an OrderItemTaxLineItem record for each
OrderItem and OrderItemAdjustmentLineItem record.
• If Salesforce state and country/territory picklists aren’t enabled:
– The state-code values in order data must match a standard 2-character ISO state or province code. The integration copies
them to State fields on Salesforce records.
6
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
– The country-code values in order data must match a standard 2-character ISO country/territory code. The integration
copies them to Country fields on Salesforce records.
Payments
• Order data includes a paired payment instrument and payment transaction for each payment associated with the order.
• If an order/payments/payment/transaction-type value in the order data starts with auth, then the integration
creates a PaymentAuthorization record for that transaction. If the value is sale or capture, then it creates a Payment record.
These checks aren’t case-sensitive.
• For a credit or debit card payment type, the payments/payment/credit-card/card-type value in the order data
must match a value in the CardType picklist on the CardPaymentMethod object.
• To handle a payment method that doesn’t match a CardPaymentMethod CardType or DigitalWallet Type, create a custom payment
method as described later in this section.
• If you use Salesforce Payments, the integration sets different values for some of the fields on AlternativePaymentMethod,
CardPaymentMethod, and DigitalWallet. The details are described in the map tables.
• The integration recognizes certain custom attributes on order/payments/payment and copies them to standard fields on
the PaymentGatewayLog record in Salesforce. To take advantage of this feature, create and populate custom attributes with the
following exact names on the Order Payment Transaction object in B2C Commerce:
– authCode (value copied to PaymentGatewayLog.GatewayAuthCode)
– avsResultCode (value copied to PaymentGatewayLog.GatewayAvsCode)
– approvalStatus (value copied to PaymentGatewayLog.GatewayResultCode)
• The integration can copy other custom attributes on order/payments/payment to standard fields on
AlternativePaymentMethod, CardPaymentMethod, DigitalWallet, Payment, and PaymentAuthorization records in Salesforce.
• An OrderPaymentSummary for a B2C Commerce order only has a FullName value if the payment method is a credit card. Other
payment methods don’t include the data value that the integration uses to set the FullName.
Promotions
• The integration creates an OrderAdjustmentGroup record for each order-level
price-adjustments/price-adjustment/promotion-id and for each item-level
price-adjustments/price-adjustment/promotion-id that applies to more than one item in the order. For each
OrderAdjustmentGroup, it creates an OrderItemAdjustmentLineItem record for each OrderItem in the order that the associated
promotion applies to. If an OrderItem is affected by multiple promotions, then it can have an OrderItemAdjustmentLineItem for
each one.
• If the order/taxation value for an order is net, then the integration creates an OrderItemTaxLineItem record for each
OrderItemAdjustmentLineItem record.
For information on the Salesforce state and country/territory picklists, see Let Users Select State and Country from Picklists in Salesforce
Help.
7
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
2. Does the payment method ID in the order data match the Gateway Provider Payment Method Type of a GtwyProvPaymentMethodType
record in Salesforce? If so, then create a record in Salesforce according to the GtwyProvPaymentMethodType’s Payment Method
Type.
3. Does the card type in the order data match an entry in the Card Type picklist on the CardPaymentMethod object in Salesforce? If so,
then create a CardPaymentMethod record in Salesforce.
Note: You can’t create or access a GtwyProvPaymentMethodType record in the Salesforce UI. To create one, insert a record
using a tool like Postman or Apex code. The API name of the object is GtwyProvPaymentMethodType, at the URL
/services/data/vversion/sobjects/GtwyProvPaymentMethodType.
Set the GtwyProvPaymentMethodType fields as described here.
Comments
Optional description.
8
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
Developer Name
The unique API name of the record.
Master Label
A human-readable name for the record.
Gateway Provider Payment Method Type
The name of the payment method in the storefront. This value must exactly match the payment method ID used in B2C Commerce.
Payment Gateway Provider Id
Reference to the Payment Gateway Provider record associated with the payment processor for the payment method.
Payment Method Type
AlternativePaymentMethod CardPaymentMethod, or DigitalWallet. To use AlternativePaymentMethod, first
create a corresponding RecordType record.
Record Type Id
If using an AlternativePaymentMethod, this value is a reference to the RecordType record.
Here’s an example of a gateway provider payment method definition:
{
"DeveloperName" : "BankTransfer"
"MasterLabel" : "Bank Transfer",
"GtwyProviderPaymentMethodType" : "directBanking",
"PaymentGatewayProviderId" : "0cJaa0000000001E67",
"PaymentMethodType" : "AlternativePaymentMethod",
“RecordTypeId” : "012aa000000008A34F"
}
Important: A change order is an Order record. If you add a required custom field to the Order object, update the service flows
to set that field when they create a change order. Otherwise, the flow fails.
If order data includes a custom attribute value, but the corresponding Salesforce object has no matching custom field, the integration
ignores that attribute. If a custom field exists in Salesforce, and order data doesn’t include a matching custom attribute value, the
integration ignores it.
Important: If a custom field in Salesforce is required, and it corresponds to a custom storefront attribute, then order data must
include a value for that attribute. Without that value, the integration can’t create the corresponding Salesforce record. In that case,
the integration fails with an error.
Note: At the API level, custom field names in Salesforce always end in __c. Don’t include it in the names of the matching attributes
on your storefront objects. However, if you include a custom namespace in a custom field name, also include it in the name of the
9
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
matching storefront object attribute. For example, if the API name of your custom field in Salesforce is
mynamespace_FieldName__c, name your matching storefront object attribute mynamespace_FieldName. Limit
your custom field names to 40 characters (37 plus __c).
You can support product bundles by passing that information as custom data. To set up product bundle associations, define a custom
guid attribute for the line item object in your storefront. In Salesforce, define a matching field on OrderItem and OrderItemSummary.
When creating an order, assign the same value to the custom attribute on line items that belong together. You can define another
custom attribute to identify a line item as part of a bundle. Then build logic into your fulfillment process to handle them accordingly.
Note: When using custom attributes to support bundles, customize your return and cancel flows to handle them according to
your business rules. For example, design your cancel process so that when you cancel a bundle product, any associated bundle
products are also canceled. Likewise, you can design your return process to disallow the return of only some of the products in a
bundle.
You can use matching custom attributes and fields on these sets of objects:
Order payment instrument and order payment transaction AlternativePaymentMethod, CardPaymentMethod, DigitalWallet,
Payment, PaymentAuthorization, and PaymentGatewayLog (see
note)
Note: You can’t add custom fields to the PaymentGatewayLog object. However, the integration recognizes certain custom
attributes on order/payments/payment and copies them to standard fields on the PaymentGatewayLog record in
Salesforce. To take advantage of this feature, create and populate custom attributes with the following exact names on the Order
Payment Transaction object in B2C Commerce:
• authCode (value copied to PaymentGatewayLog.GatewayAuthCode)
• avsResultCode (value copied to PaymentGatewayLog.GatewayAvsCode)
• approvalStatus (value copied to PaymentGatewayLog.GatewayResultCode)
The integration supports the following data types for matching custom attributes and fields:
• Boolean
• Currency
• Datetime (Date isn’t supported)
• Double
• Email
• Multipicklist
• Phone
• Picklist
• Reference
• String
10
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
• TextArea
• URL
The Order Management B2C Service permission set provides the integration with access to Salesforce records. When you add a custom
field to a Salesforce object, update that permission set by adding read and edit access to the new field. You also must add edit access
to the permission set that provides access for your Order Management users.
1. From Setup, in the Quick Find box, enter Permission Sets, and then select Permission Sets.
2. Select Order Management B2C Service.
3. In the Apps section, click Object Settings.
4. Select the object that has the custom field.
5. Click Edit.
6. In the Field Permissions section, select the Edit Access checkbox for the custom field.
7. Click Save.
8. Return to the list of permission sets by selecting Permission Sets in the Setup navigation menu.
9. Select the permission set that controls access for your Order Management users. Normally, it’s called OM Console.
10. In the Apps section, click Object Settings.
11. Select the object that has the custom field.
12. Click Edit.
13. In the Field Permissions section, select the Edit Access checkbox for the custom field.
14. Click Save.
Note: If the B2C Integration Data Matching Rules setting is on, this behavior can vary depending on your org’s matching rules.
• While Order Management is configured to use standard accounts: the integration recognizes existing shoppers that are stored as
person accounts. It associates their new orders with their existing person accounts. If an existing shopper has records of both types,
it associates new orders with their standard account and contact.
• While Order Management is configured to use person accounts: the integration doesn’t recognize existing shoppers that are stored
as standard accounts and contacts. If one of those shoppers places an order, the integration creates a person account record for
them and associates the new order with it. Order Management treats the accounts as separate shoppers. If an existing shopper has
records of both types, the integration associates new orders with their person account.
11
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/billing-address/first-name and FirstName This value is only set for person accounts.
order/billing-address/second-name It’s set to
order/billing-address/first-name
+" "+
order/billing-address/second-name.
12
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
AlternativePaymentMethod Object
The integration checks the payment_method value of each payment instrument in an order. If it matches the Gateway Provider
Payment Method Type of a GtwyProvPaymentMethodType record, then the integration creates a record according to the
GtwyProvPaymentMethodType’s Payment Method Type value. If the Payment Method Type is AlternativePaymentMethod, then the
integration creates an AlternativePaymentMethod record using the associated RecordType.
Note: To use AlternativePaymentMethod, first create a RecordType and GtwyProvPaymentMethodType for your custom payment
type as described in the Create Custom Payment Methods section.
13
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/payments/payment/credit-card/card-token GatewayToken
order/customer/customer-email Email
order/billing-address/company-name CompanyName
payment instrument payment_type or Type The value depends on whether you’re using
payment_method Salesforce Payments.
• Salesforce Payments—This value is set
to the payment instrument
payment_type.
• Other Payment Processor—This value
is set to the payment instrument
payment_method.
payment instrument payment_type or PaymentMethodType The value depends on whether you’re using
payment_method Salesforce Payments. If the payment
instrument value isn’t present, a
PaymentMethodType isn’t set.
payment instrument payment_bank PaymentMethodSubType The value depends on whether you’re using
Salesforce Payments. If the payment
instrument value isn’t present, a
PaymentMethodSubType isn’t set.
order/billing-address/city PaymentMethodCity
14
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/billing-address/postal-code PaymentMethodPostalCode
order/billing-address/phone Phone
orderremoteHost IpAddress
15
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
CardPaymentMethod Object
The integration checks the payment_method value of each payment instrument in an order against the following regex. If it matches,
then the integration creates a DigitalWallet record for the instrument. If it doesn’t match, then the integration checks the
payment/credit-card/card-type value against the CardType picklist on the CardPaymentMethod object. If the picklist
contains a match, then the integration creates a CardPaymentMethod record for the instrument. Otherwise, to support the payment
method, you must set up a custom payment method for it.
paypal|visa_checkout|pay_by_check|.*(apple|google|android|amazon|ali).*(pay)*
16
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/payments/payment/credit-card/card-holder CardHolderName
order/payments/payment/credit-card/expiration-year ExpiryYear
order/payments/payment/credit-card/expiration-month ExpiryMonth
order/payments/payment/credit-card/card-token GatewayToken
payment instrument payment_brand or PaymentMethodType The value depends on whether you’re using
credit_card_type Salesforce Payments. If the payment
instrument value isn’t present, the value is
set to Other.
• Salesforce Payments—This value is set
to the payment instrument
payment_brand.
• Other Payment Processor—This value
is set to the payment instrument
credit_card_type.
payment instrument payment_wallet_type PaymentMethodSubType The value depends on whether you’re using
or payment_method Salesforce Payments.
• Salesforce Payments—This value is set
to the payment instrument
payment_wallet_type.
• Other Payment Processor—This value
is set to the payment instrument
payment_method.
17
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/billing-address/city PaymentMethodCity
order/billing-address/postal-code PaymentMethodPostalCode
18
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
Contact Object
When using person accounts, access shopper contact data using person account records, not contact records. When using standard
accounts and contacts, the BillToContactId field on these objects points to the associated contact record:
• Credit Memo
• Fulfillment Order
• Invoice
• Order
• Order Summary
order/customer/customer-email Email
order/billing-address/first-name FirstName
order/billing-address/last-name LastName
order/billing-address/phone Phone
19
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
DigitalWallet Object
The integration checks the payment_method value of each payment instrument in an order. If it matches the following regex, then
the integration creates a DigitalWallet record for the instrument. If it doesn’t match, then the integration tries to create an
AlternativePaymentMethod or a CardPaymentMethod record for the instrument.
paypal|visa_checkout|pay_by_check|.(apple|google|android|amazon|ali).(pay)*
payment instrument payment_type or Type The value depends on whether you’re using
payment_method Salesforce Payments.
• Salesforce Payments—This value is set
to the payment instrument
payment_type.
• Other Payment Processor—This value
is set to the payment instrument
payment_method.
order/payments/payment/credit-card/card-token GatewayToken
payment instrument payment_type or PaymentMethodType The value depends on whether you’re using
payment_method Salesforce Payments.
• Salesforce Payments—This value is set
to the payment instrument
payment_type.
• Other Payment Processor—This value
is set to the payment instrument
payment_method.
payment instrument payment_type or PaymentMethodSubType The value depends on whether you’re using
payment_method Salesforce Payments.
• Salesforce Payments—This value is set
to the payment instrument
payment_type.
• Other Payment Processor—This value
is set to the payment instrument
payment_method.
20
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/billing-address/city PaymentMethodCity
order/billing-address/postal-code PaymentMethodPostalCode
21
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
Order Object
The integration uses both the order/order-no and catalog/catalog-id values to check for duplicate orders. It looks for
an existing order record with an OrderReferenceNumber matching the order-no and a SalesChannelId pointing to a SalesChannel
that matches the catalog-id. If it finds one, it doesn’t create a duplicate order.
Note: If the catalog ID for a sales channel changes and an existing order is received with a different catalog ID, the integration
considers it a new order and creates a duplicate record.
order/customer/customer-name Name
22
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
catalog/catalog-id and order/order-no OrderManagementReferenceIdentifier This value is set to B2C realm ID + “_”
+ B2C instance ID + "@" +
catalog/catalog-id + "@" +
order/order-no.
order/order-no OrderReferenceNumber
order/billing-address/city BillingCity
order/billing-address/postal-code BillingPostalCode
23
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/billing-address/phone BillingPhoneNumber
order/order-date OrderedDate
order/customer/customer-email BillingEmailAddress
24
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
OrderAdjustmentGroup Object
The integration creates one OrderAdjustmentGroup record for each promotion that applies to an entire order or to multiple items in an
order. For an order-level promotion, it assigns the OrderAdjustmentGroup to one OrderItemAdjustmentLineItem record for each OrderItem
record in the order. It creates the OrderAdjustmentGroup even if the order only contains one OrderItem. For an item-level promotion
that applies to multiple OrderItems, it assigns the OrderAdjustmentGroup to one OrderItemAdjustmentLineItem record for each OrderItem
record in the Order that the promotion applies to. If an item-level promotion only applies to one OrderItem, the integration doesn’t
create an OrderAdjustmentGroup for it.
Note: Shipping adjustments that aren’t part of an order-level promotion are treated as item-level promotions. An example of an
order-level promotion is “20% off and free shipping.”
order/price-adjustments/price-adjustment/promotion-id Description
25
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
OrderDeliveryGroup Object
The integration creates an OrderDeliveryGroup record for each shipment (also called a LineItemGroup in B2C Commerce) in the order
data.
For order changes such as returns and cancellations that include prorated delivery amounts, the proration considers the
OrderDeliveryGroups containing OrderItems that are part of the change. For example, consider an order that has three OrderDeliveryGroups,
each with multiple OrderItems. A return of two OrderItems, each from a different OrderDeliveryGroup, uses the total delivery charges
associated with those two OrderDeliveryGroups. It prorates that amount across the OrderItems in those OrderDeliveryGroups by OrderItem
price. The shipping refund equals the prorated delivery amounts for the two returned OrderItems. The return doesn’t consider any
delivery charges associated with the third OrderDeliveryGroup.
order/shipments/shipment/shipping-address/city DeliverToCity
order/shipments/shipment/shipping-address/postal-code DeliverToPostalCode
26
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/shipments/shipment/shipping-address/phone PhoneNumber
27
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
OrderItem Object
If an order has a TaxLocaleType of Net, then the integration also creates an OrderItemTaxLineItem record for each OrderItem record.
order/product-lineitems/product-lineitem/quantity Quantity
order/product-lineitems/product-lineitem/net-price TotalLineAmount
28
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
• Net Taxation—base-price
• Gross Taxation—net-price /
quantity
29
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
OrderItemAdjustmentLineItem Object
An OrderItemAdjustmentLineItem record represents the application of a promotion to an OrderItem record. Thus, an OrderItem record
has one associated OrderItemAdjustmentLineItem record for each promotion that applies to it.
If an order has a TaxLocaleType of Net, then the integration also creates an OrderItemTaxLineItem record for each
OrderItemAdjustmentLineItem record.
price-adjustments/price-adjustment/net-price Amount
price-adjustments/price-adjustment/tax TotalTaxAmount
order/price-adjustments/price-adjustment/lineitem-text PromotionText
OrderItemTaxLineItem Object
If an order has a TaxLocaleType of Net, then the integration creates an OrderItemTaxLineItem record for each OrderItem and
OrderItemAdjustmentLineItem record in the order. If an order has a TaxLocaleType of Gross, then the integration doesn’t create any
OrderItemTaxLineItem records for it.
30
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
– Delivery Charge—"Delivery
Charge - Tax"
• OrderItemAdjustmentLineItem:
– Product—StockKeepingUnit
+ " - Adjustment Tax"
– Shipping—"Delivery Charge
- Adjustment Tax"
order/product-lineitems/product-lineitem/tax Amount
order/product-lineitems/product-lineitem/tax-rate Rate
order/order-date TaxEffectiveDate
N/A OrderItemAdjustmentLineItemId This value is only set for tax that applies to
an OrderItemAdjustmentLineItem record.
Payment Object
If an order/payments/payment/transaction-type value in the order data is sale or capture, then the integration
creates a Payment record for that transaction. If the value starts with auth, then it creates a PaymentAuthorization record. These checks
aren’t case-sensitive.
order/payments/payment/amount Amount
31
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/customer/customer-email Email
order/order-date Date
order/payments/payment/transaction-type Type
order/billing-address/phone Phone
PaymentAuthorization Object
If an order/payments/payment/transaction-type value in the order data starts with auth, then the integration creates
a PaymentAuthorization record for that transaction. If the value is sale or capture, then it creates a Payment record. These checks
aren’t case-sensitive.
32
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/payments/payment/amount Amount
33
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
PaymentGatewayLog Object
B2C Commerce XSD Value Salesforce Object Field Notes
N/A PaymentGatewayId This value is set to the ID of the
PaymentGateway record whose
ExternalReference value matches the
processor ID value of the order payment
instrument associated with the order
payment transaction.
34
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
PaymentGroup Object
B2C Commerce XSD Value Salesforce Object Field Notes
N/A SourceObjectId This value is set to the ID of the original
Order record that the payments in the group
apply to.
PendingOrderSummary Object
PendingOrderSummary is only used by High Scale Orders. It holds order data that’s been ingested into ZOS and is waiting for its Salesforce
records to be created. You can trigger creation of the records, including the Summary records, by importing a PendingOrderSummary
from the Pending Order Summaries page in the Salesforce UI.
order/customer/customer-email BillingEmailAddress
order/billing-address/phone BillingPhoneNumber
all price, adjustment, and tax values GrandTotalAmount Total amount, including adjustments and
tax, of the order.
order/order-no OrderNumber
order/order-date OrderedDate
all data Payload This field contains the entire order data
payload.
35
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
PricebookEntry Object
Salesforce Order Management doesn’t use the PricebookEntry object. It creates a PriceBookEntry record for each Product2 because the
OrderItem object requires a PricebookEntryId value.
Note: If you turn on the Optional Price Books feature, then Order Management doesn’t create price book entries for product
records that it creates from order data. If you turn off the feature, then you must add price book entries manually.
Product2 Object
The integration identifies products by first searching for a Product2 with a ProductCode value that matches the product-id value
in the order data. If it doesn’t find one, it looks for a Product2 with a StockKeepingUnit value that matches the product-id value. If
it still doesn’t find one, then it creates a Product2 record.
36
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
order/product-lineitem/product-name Name
Promotion Object
For information on the Promotion object, see the Loyalty Management Developer Guide.
order/price-adjustments/price-adjustment/lineitem-text DisplayName
order/price-adjustments/price-adjustment/lineitem-text Description
SalesChannel Object
The integration associates B2C Commerce site IDs with Salesforce SalesChannels.
site/site-id SalesChannelName
N/A Type
WebStore Object
The integration looks for a WebStore matching the currency and locale of the order, and creates one if needed. It associates one WebStore
with each combination of currency and locale that appears in order data. For example, let’s say that you have one site that supports US
orders in US dollars. A second site supports UK orders in pounds or Euros, and also supports French orders in Euros. Create four Web
Stores to represent them:
• USD - en_US
37
Salesforce Order Management Developer Guide Salesforce B2C Commerce Storefront Order Data Map
• GBP - en_GB
• EUR - en_GB
• EUR - fr_FR
order/order-no and catalog/catalog-id ExternalReference This value is set to B2C realm ID + “_”
+ B2C instance ID + "@" +
catalog/catalog-id.
38
Salesforce Order Management Developer Guide Importing Order Data
Note: Don’t directly create OrderSummary records. Always run the flow core action or call the API.
To import large amounts of order data, use Bulk API 2.0. See the Bulk API 2.0 Developer Guide.
If you’re importing small amounts of order data, you can make composite REST API requests. A composite API call can include up to 200
records. That limit applies to all objects, not only the orders. For example, an order with 5 items and an order-level adjustment that
applies to each of them includes at least 11 records: 1 order, 5 order items, and 5 order item adjustments. For more information, see
Composite Resources in the REST API Developer Guide.
When making API calls to import data, keep in mind that they count toward your API limits. You can request a temporary increase for
importing historical orders by opening a case with Salesforce Customer Support. Allow at least 2 weeks for Support to arrange the
increase.
39
Salesforce Order Management Developer Guide Importing Data into Order Management
2. SalesChannel
3. Product2
4. PriceBookEntry (unless using Optional Price Books)
5. Payment data (depending on the type of payment)
• AlternativePaymentMethod
• CardPaymentMethod
• DigitalWallet
• GtwyProvPaymentMethodType
• PaymentGatewayProvider
• PaymentGateway
6. OrderDeliveryMethod (optional)
7. Order
The records created before the Order record aren’t specific to one order. When creating them, check for duplicates. For information
on configuring automatic identification and handling duplicate records, see Manage Duplicate Records.
40
Salesforce Order Management Developer Guide Importing Data into Order Management
SalesChannel • SalesChannelName
Product2 • Description
• IsActive
• Name
• ProductCode
• StockKeepingUnit
CardPaymentMethod • AccountId
• CardCategory
• CardHolderName
• CardType
• ExpiryMonth
• ExpiryYear
• InputCardNumber
• ProcessingMode
• Status
Order • AccountId
• BillingCity
• BillingCountry
• BillingCountryCode
• BillingEmailAddress
• BillingState
• BillingStreet
• EffectiveDate
• Name
• OrderedDate
41
Salesforce Order Management Developer Guide Importing Data into Order Management
• OrderReferenceNumber
• SalesChannelId
• Status (Set this field to Draft for a new record, and change it
to Active before creating the OrderSummary.)
OrderItem • Description
• GrossUnitPrice
• OrderDeliveryGroupId
• OrderId
• PricebookEntryId
• Product2id
• Quantity
• TotalLineAmount
• Type
• UnitPrice
OrderItemAdjustmentLineItem • Amount
• Description
• Name
• OrderItemId
OrderItemTaxLineItem • Amount
• Description
• Name
• OrderItemAdjustmentLineItemId (if applicable)
• OrderItemId
• Rate
• TaxEffectiveDate
• Type
OrderDeliveryGroup • DeliverToCity
• DeliverToCountry
• DeliverToName
• DeliverToPostalCode
• DeliverToState
• DeliverToStreet
• EmailAddress
• OrderDeliveryMethodId
• OrderId
42
Salesforce Order Management Developer Guide Creating Order Summaries for Imported Orders
PaymentAuthorization • AccountId
• Amount
• PaymentGatewayId
• PaymentGroupId
• PaymentMethodId
• ProcessingMode
• Status
Payment • AccountId
• Amount
• Date
• Email
• PaymentGatewayId
• PaymentGroupId
• PaymentMethodId
• Phone
• ProcessingMode
• Status
• Type
Flow triggered by a record change (Order • Simple to implement • When the order and order summary are
Status: Draft Activated) created in the same transaction, and the
• Allows a multithreaded approach for
creating order summaries in parallel order summary fails, the order also fails
with orders • Large transactions
43
Salesforce Order Management Developer Guide Importing Custom Order Data
Apex triggered by a platform event • Asynchronous transaction separate from • No control of timing
order creation improves performance • Asynchronous execution requires
• Allows a multithreaded approach for complex error handling
creating order summaries in parallel
with orders
• Best performance method
Scheduled Apex job • Allows controlled batch execution • Subject to Apex limits on the number
of records processed
• Requires programmatic identification
of the orders to process
• Runs even when no orders need
processing
Direct calls to API resources • Allows external control • Subject to API call limits
• Some clients allow parallel processing • Requires external app design,
authentication, and so on
44
Salesforce Order Management Developer Guide Importing Data When Using Salesforce B2C Commerce
on the Order record. When you run the Create Order Summary action or call the API for that order, it copies that value to the
ShopperCategory__c field on the OrderSummary record.
Order summary creation supports custom fields for these data types:
• Boolean
• Currency
• Datetime (Date isn’t supported)
• Double
• Email
• Multipicklist
• Phone
• Picklist
• Reference
• String
• TextArea
• URL
45
Salesforce Order Management Developer Guide Deduplication for High Scale Orders
Note: If you use High Scale Orders, the PendingOrderSummary.ExternalReferenceIdentifier field is also set.
Note: In API version 55.0, the standard B2C Commerce integration set this value to "SFDC" + "@" + nanotime + "@" + UUID
and High Scale Orders set it to the value used in later versions.
Pricebook2 Only Standard Price Book lookup is supported. If a Pricebook2 node is included
in the request, the Standard Price Book ID is queried and used.
SEE ALSO:
Pending Order Summaries
High-Scale Orders
46
Salesforce Order Management Developer Guide Fulfillment Orders
Fulfillment Orders
A FulfillmentOrder record has a set of supporting records, including FulfillmentOrderLineItems, FulfillmentOrderItemAdjustments, and
FulfillmentOrderItemTaxes. When you call an Order Management API or the flow core action to create a fulfillment order, it also creates
the supporting records.
For managed OrderSummaries, you create a fulfillment order via Apex, Connect API, or flow core action. This method also creates the
supporting records, such as fulfillment order line items, and then sets the new fulfillment order’s Status to Allocated.
You can also create a fulfillment order externally using a platform API, such as sObject, Composite, or Bulk API 2.0. When you create a
fulfillment order for an unmanaged OrderSummary, you can only use a platform API.
When you create a fulfillment order via a platform API, you also create the supporting records. In that case, when you create the fulfillment
order, set its Status to Draft. After creating all the supporting records, change its Status to Allocated (or a custom status associated with
the Activated Status Category).
In addition to the normally required fields, Order Management requires values for certain fields for each FulfillmentOrder record and
supporting record. When creating a record of an object in this table, define values for all the listed fields.
FulfillmentOrderLineItem • Description
• FulfillmentOrderId
• GrossUnitPrice
• OrderItemId
• OrderItemSummaryId
• OriginalQuantity
• Product2Id
47
Salesforce Order Management Developer Guide Fulfillment Orders
• Quantity
• TotalLineAmount
• Type
• TypeCode
• UnitPrice
FulfillmentOrderItemAdjustment • Amount
• Description
• FulfillmentOrderId
• FulfillmentOrderLineItemId
• OrderItemAdjustLineSummaryId
FulfillmentOrderItemTax • Amount
• Description
• FulfillmentOrderId
• FulfillmentOrderItemAdjustId (if applicable)
• FulfillmentOrderLineItemId
• OrderItemTaxLineItemSummaryId
• Rate
• TaxEffectiveDate
• Type
Location Capacity
You can limit the number of fulfillment orders assigned to a location by defining its fulfillment order capacity. The Location object has
three fields for fulfillment order capacity.
Track Fulfillment Order Capacity
Indicates whether the location’s capacity is tracked. The default is false.
Fulfillment Order Capacity
The maximum number of fulfillment orders that can be assigned to the location per a user-defined time period. If the value is null,
the location’s capacity is unlimited.
Assigned Fulfillment Order Count
The number of fulfillment orders currently assigned to the location. To define the time period associated with the maximum capacity,
reset this value at a specified interval. For example, to track capacity per day, run an automated job that sets this value to 0 for each
location at midnight of the location’s time zone.
You can manage location capacity using these Connect API resources and flow core actions.
Hold Fulfillment Order Capacity
When you want to assign a fulfillment order to a location, hold capacity for it at that location. If the location has no capacity, it returns
an error. Free capacity is defined as the location’s fulfillment order capacity minus the sum of its held capacity and assigned fulfillment
orders.
48
Salesforce Order Management Developer Guide Taxation in Order Management
SEE ALSO:
Location Object Reference Topic
Tax Types
Orders can include two types of taxes: sales tax and value-added tax (VAT).
Price Adjustments and Taxes
The OrderItemTaxLineItem object represents a tax applied to an order item or the change in tax associated with an order item
adjustment.
SEE ALSO:
Salesforce Standard Objects Reference
Salesforce Order Management Implementation Guide
Tax Types
Orders can include two types of taxes: sales tax and value-added tax (VAT).
Sales tax is paid directly on the sale price of goods and services in countries such as the United States. The tax amount is displayed
separately from the product prices. This display type is also referred to as “net.”
VAT is an indirect tax on goods and services. The displayed product price includes the tax. If tax fields appear, they usually display
“included” instead of the amount. This display type is also referred to as “gross.”
To support both types, Order Management objects include fields for price amounts, tax amounts, combined amounts, and whether an
order uses net or gross taxation. You configure page layouts and Salesforce Flow screens to show the appropriate fields for your business
needs.
49
Salesforce Order Management Developer Guide Price Adjustments and Taxes
For example, to display net taxation in an order summary page layout, include the TotalAmount and TotalTaxAmount fields.
To display gross taxation, include the GrandTotalAmount field. An order summary record always includes all three values, and the
GrandTotalAmount always equals the sum of the TotalAmount and the TotalTaxAmount.
Default page layouts display net tax amounts. If your org supports only locales that use sales tax, you can use the default layouts. If your
org supports a locale that uses VAT, configure your page layouts to display fields with gross tax amounts.
An org that supports multiple currencies can show net tax amounts for some orders and gross tax amounts for others. In that case, create
a user profile for service agents in gross tax locales by cloning the standard user profile. Create page layouts that display gross tax amounts
instead of net tax amounts, and assign them to the new profile.
For details about price and tax fields, see the Object Reference for Salesforce and Lightning Platform.
For information about how the B2C Commerce integration handles taxes, see the Salesforce B2C Commerce Storefront Order Data Map.
SEE ALSO:
Manage Multiple Currencies Help Topic
Taxation in Order Management
• OrderItemTaxLineItem
– Amount 10
– OrderItemId pointing to the OrderItem
• OrderItemSummary
– TotalPrice 100
– TotalTaxAmount 10
– TotalAmtWithTax 110
– OriginalOrderItemId pointing to the OrderItem
• OrderItemTaxLineItemSummary
– Amount 10
50
Salesforce Order Management Developer Guide Price Adjustments and Taxes
Then apply a 10% discount to the OrderItem by calling the Adjust Order Item Summaries Submit action and passing these values.
• orderItemSummaryId—The ID of the OrderItemSummary
• adjustmentType—Percentage
• discountValue—-10
These are the new records.
• OrderItemAdjustmentLineItem
– Amount -10
– TotalTaxAmount -1
– TotalAmtWithTax -11
– OrderItemId pointing to the OrderItem
• OrderItemAdjustmentLineSummary
– Amount -10
– TotalTaxAmount -1
– TotalAmtWithTax -11
– OrderItemSummaryId pointing to the OrderItemSummary
– OriginalOrderItemAdjustmentLineItemId pointing to the OrderItemAdjustmentLineItem
• OrderItemTaxLineItem (unchanged)
– Amount 10
– OrderItemId pointing to the OrderItem
• OrderItemSummary
– TotalPrice 90
– TotalTaxAmount 9
– TotalAmtWithTax 99
51
Salesforce Order Management Developer Guide API Framework for Exchanges with RMA Returns
• OrderItemTaxLineItemSummary
– Amount 9 (sum of both OrderItemTaxLineItems)
– OrderItemSummaryId pointing to the OrderItem
– OriginalOrderItemTaxLineItemId pointing to the original OrderItemTaxLineItem
SEE ALSO:
Taxation in Order Management
Exchanges supports both EnsureFunds and EnsureRefunds. After implementing exchanges, set
isReservedBalanceAmountConsidered to true for any existing flow that uses EnsureFunds or EnsureRefunds.
EnsureFunds can be called for any OrderSummary regardless of the SourceProcess (Standard, OrderOnBehalfOf, Exchange). The EnsureFunds
and ApplyFunds logic now consider shared OrderPaymentSummaries. Both the EnsureFunds and ApplyFunds contracts now contain
an optional boolean field, isReservedBalanceAmountConsidered. This field indicates whether the EnsureFunds logic considers the
ReservedBalanceAmount for the shared OrderPaymentSummary.
The EnsureRefunds contracts now contain an optional boolean field isReservedBalanceAmountConsidered. This field indicates whether
the EnsureRefunds logic considers the ReservedBalanceAmount for the OrderPaymentSummary. EnsureRefunds considers any reserved
52
Salesforce Order Management Developer Guide Preview Cart for an Exchange Order
balance amount that a child exchange order has in reserve to fully fund the exchange Order Summary. The reserved balance amount is
available in the payment record and only the extra balance is refunded as part of the EnsureRefunds command.
If you’re using the EnsureFunds or EnsureRefunds flows, update the flows to contain the isReservedBalanceAmountConsidered flag.
For additional or excess funds, the formulas that calculate the funds remain the same. All the captures, refunds, pending refunds, and
returns are related to the OrderPaymentSummaries in the OrderSummary Relationship tree.
The new algorithm is executed in this order.
1. Get all of the Order Summary IDs that are related to the Order Summary.
Note: Get the root OrderSummary from the OrderSummaryRelationship and then find all the AssociatedOrderSummaries
with that root.
SEE ALSO:
Salesforce Help: Exchanges with RMA Returns Overview
Ensure Funds
Ensure Refunds
53
Salesforce Order Management Developer Guide Submit Cart for an Exchange Order
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.
{
"changeBalances": {
"grandTotalAmount": -47.49,
"totalAdjDeliveryAmtWithTax": 12.94
"totalAdjDistAmountWithTax": 0,
"totalAdjProductAmtWithTax": -60.44,
"totalAdjustedDeliveryAmount": 11.99,
"totalAdjustedDeliveryTaxAmount": 0.95,
"totalAdjustedProductAmount": -55.96,
"totalAdjustedProductTaxAmount": -4.48,
"totalAdjustmentDistributedAmount": 0,
"totalAdjustmentDistributedTaxAmount": 0,
"totalAmount": -43.97,
"totalExcessFundsAmount": 47.49,
"totalFeeAmount": 0,
"totalFeeTaxAmount": 0,
"totalRefundableAmount": 47.49,
"totalRequiredFundsAmount": 0,
"totalTaxAmount": -3.52
},
"errors": [],
"orderSummaryId": "1OsSB000000UdWz0AK",
"success": true
}
SEE ALSO:
API Framework for Exchanges with RMA Returns
Salesforce Help: Exchanges with RMA Returns Overview
54
Salesforce Order Management Developer Guide Submit Cart for an Exchange Order
Input Fields for the Submit Cart to Exchange Order API Representation
55
Salesforce Order Management Developer Guide Payment Sequencing
Example
The submit response might look like this example.
{
"changeBalances": {
"grandTotalAmount": -47.49,
"totalAdjDeliveryAmtWithTax": 12.94
"totalAdjDistAmountWithTax": 0,
"totalAdjProductAmtWithTax": -60.44,
"totalAdjustedDeliveryAmount": 11.99,
"totalAdjustedDeliveryTaxAmount": 0.95,
"totalAdjustedProductAmount": -55.96,
"totalAdjustedProductTaxAmount": -4.48,
"totalAdjustmentDistributedAmount": 0,
"totalAdjustmentDistributedTaxAmount": 0,
"totalAmount": -43.97,
"totalExcessFundsAmount": 47.49,
"totalFeeAmount": 0,
"totalFeeTaxAmount": 0,
"totalRefundableAmount": 47.49,
"totalRequiredFundsAmount": 0,
"totalTaxAmount": -3.52
},
"errors": [],
"exchangeOrderSummaryId": "1OsSB000000UdYb",
"orderSummaryId": "1OsSB000000UdWz0AK",
"success": true
}
SEE ALSO:
API Framework for Exchanges with RMA Returns
Salesforce Help: Exchanges with RMA Returns Overview
Payment Sequencing
When ensuring refunds for orders that include multiple payment methods, you can control the sequence in which to apply refund
amounts to payment methods. For example, if an order was partially paid with a gift card, you could refund to the gift card first, regardless
of how the payment amounts were originally distributed. The default logic is based on matching refund amounts to OrderPaymentSummary
amounts.
56
Salesforce Order Management Developer Guide Payment Sequencing
2. If an excess funds amount is specified, identify OrderPaymentSummaries with captured amounts that weren’t applied to any invoice.
a. Examine those OrderPaymentSummaries. If one has a captured amount matching the excess funds amount, apply the refund
to that payment.
b. If no exact match is found, look for OrderPaymentSummaries with captured amounts greater than the excess funds amount. If
any exist, apply the refund to the smallest.
c. If no greater amounts are found, traverse the OrderPaymentSummaries in order of captured amount, from largest to smallest.
Apply the refund to them until it’s fully applied.
57
Salesforce Order Management Developer Guide Payment Sequencing
You can customize which payment type to refund first by changing the amount associated with each type’s key prefix. Because the list
is ordered, you could, for example, refund $10 to each DigitalWallet, then $10 to each CardPaymentMethod, and then apply the default
logic to any remaining amount.
public class CreateSequenceOPSRefundsInvocable {
// Always disallow partial refunds -- if the sequence doesn't cover the full refund,
then apply the default logic to the remaining amount
Boolean isAllowPartial = false;
58
Salesforce Order Management Developer Guide Salesforce Order Management Lightning Components
ConnectApi.EnsureRefundsAsyncOutputRepresentation result =
ConnectApi.OrderSummary.ensureRefundsAsync(orderSummaryId, ensureRefundsInput);
59
Salesforce Order Management Developer Guide Expand Data Sources for Return Insights
After you've added this screen to your flow, call the PaymentAuthorize invocable from the outputs of that screen. Construct the input
for the PaymentAuthorize in the flow.
Finally, update the billing details in the webcart using the flow Update Records action. Input BillingDetails from the new payment screen
and input the PaymentMethod and PaymentGroup from the PaymentAuthorize Invocable.
//Set the reason in the response. You can also fetch the reasons from external
systems and set it.
reason1.setReason('Size is big');
reason2.setReason('Too big');
returnReasons.add(reason1);
returnReasons.add(reason2);
for(commerce_ordermanagement.ProductData productData :
productExpandRequest.getProducts()) {
// Set the return reasons for the products in the request
productData.setReturnReasons(returnReasons);
productList.add(productData);
60
Salesforce Order Management Developer Guide Expand Data Sources for Return Insights
response.setProductList(productList);
response.setSucceed(true);
Instead of replacing the entire method with custom logic, you can call the base method with the super() method. You can still insert
custom logic before and after the super() call.
public override commerce_ordermanagement.ProductExpandResponse
returnReasons(commerce_ordermanagement.ProductExpandRequest productExpandRequest) {
// Get the product expand response using the default implementation of the
returnReasons method. Although returnReasons is called unmodified, we can supply it with
a modified version of the request.
commerce_ordermanagement.ProductExpandResponse productExpandResponse =
super.returnReasons(productExpandRequest);
To get the return reasons from an external service, define a custom private method.
61
Salesforce Order Management Developer Guide API End-of-Life Policy
);
insert store;
Click Execute.
To fetch the web store ID, execute this SOQL query
SELECT Id FROM WebStore LIMIT 1
and pick the web store ID from the returned values. Map your web store’s ID to the EPN.
To register and map extension classes, we recommend using Salesforce CLI and the Salesforce Commerce plug-in for sfdx. To manage
extensions, use the latest version of Salesforce CLI. For detailed instructions, install Salesforce CLI and update Salesforce CLI.
To install the plug-in, run sfdx plugins:install @salesforce-commerce.
Example commands. The store-ID is the web store ID.
Example:
# Register an extension class
sfdx commerce:extension:register --targetusername [email protected] --apex-class-name
ProductExpandServiceSample --extension-point-name
Commerce_Domain_OrderManagement_Product --registered-extension-name
ProductExpandServiceSample
SEE ALSO:
Salesforce Help: Return Insights
62