Newer Version Available

This content describes an older version of this product. View Latest

Create Sales Transaction (POST)

Use the Place Sales Transaction API to create a sales transaction with integrated pricing and configuration, and manage the transaction throughout its lifecycle. This API enables users to create, configure, price, and tax a cart or an order efficiently. It offers significant performance and scalability by managing the state of the shopping session.

You can also group order or quote line items based on location, work types, or departments, if groups are enabled for your org. Groups provide a visualization of the products to view large quotes.

Keep these considerations in mind when you use this API.

  • You can add up to 1000 quote line items for a quote, and 1000 order products for an order. For complex flows that involve a large volume of records, ensure that the number of line items that are sent to this API are within this limit.
  • A quote can have up to 3000 quote line item attributes, and an order can have up to 3000 order line item attributes.
  • This API doesn't support creation of amendment, renewal, or cancellation quote or order. Use the amendment, renewal, or cancellation APIs or invocable actions.
Resource
1/connect/consumer/place
Resource example
1https://yourInstance.salesforce.com/services/data/v66.0/connect/consumer/place
Available version
66.0
HTTP methods
POST
Request body for POST
JSON example
This is a sample request to create a sales transaction for a quote. This example also skips tax calculation by specifying a value for the optional taxPref property.
1"placeSalesTransactionRequest": {
2  "pricingPref": "System",
3  "catalogRatesPref": "Skip",
4  "configurationPref": {
5    "configurationMethod": "Skip",
6    "configurationOptions": {
7      "validateProductCatalog": true,
8      "validateAmendRenewCancel": true,
9      "executeConfigurationRules": true,
10      "addDefaultConfiguration": true
11    }
12  },
13  "taxPref": "Skip",
14  "contextDetails": {
15    "contextId": "e055bb18-d4e8-41c3-881e-0132b9561708"
16  },
17  "graph": {
18    "graphId": "createQuote",
19    "records": [
20      {
21        "referenceId": "refQuote",
22        "record": {
23          "attributes": {
24            "method": "POST",
25            "type": "Quote"
26          },
27          "Name": "Quote_Acme",
28          "Pricebook2Id": "01sDU000000JvhbYAC"
29        }
30      },
31      {
32        "referenceId": "refQuoteLine0",
33        "record": {
34          "attributes": {
35            "type": "QuoteLineItem",
36            "method": "POST"
37          },
38          "QuoteId": "@{refQuote.id}",
39          "Product2Id": "01tDU000000F7b8YAC",
40          "PricebookEntryId": "01uDU000000fxt2YAA",
41          "UnitPrice": 100,
42          "Quantity": "1",
43          "StartDate": "2024-10-29",
44          "EndDate": "2025-03-01",
45          "PeriodBoundary": "Anniversary"
46        }
47      }
48    ]
49  }
50}
This sample request assigns a TransactionProcessingType record to a quote without any additional preferences. In this example, the TransactionType value for a record is set to a TransactionProcessingType record.
1{
2  "pricingPref": "Force",
3  "contextDetails": {
4    "contextId": "f1c9e3e1c335f7959a88de09d3a867cc2b95e08709b99de8e2edeb8f5039e8ed",
5    "scope": "Session"
6  },
7  "graph": {
8    "graphId": "updateQuote",
9    "records": [
10      {
11        "referenceId": "refQuote",
12        "record": {
13          "attributes": {
14            "type": "Quote",
15            "method": "POST"
16          },
17          "OpportunityId": "006xx000001a2oWAAQ",
18          "PriceBook2Id": "01sxx0000005ptpAAA",
19          "TransactionType": "SkipPricingAndRunTax",
20          "Name": "Quote_No_Tax_System"
21        }
22      },
23      {
24        "referenceId": "refQLI1",
25        "record": {
26          "attributes": {
27            "type": "QuoteLineItem",
28            "method": "POST"
29          },
30          "QuoteId": "@{refQuote.id}",
31          "UnitPrice": 49.99,
32          "Product2Id": "01txx0000006i2aAAA",
33          "PricebookEntryId": "01uxx0000008yX0AAI",
34          "Quantity": 10
35        }
36      }
37    ]
38  }
39}
This is a sample request to insert, update, or delete a quote line item.
1{
2  {
3  "pricingPref": "System",
4  "catalogRatesPref": "Skip",
5  "configurationPref": {
6    "configurationMethod": "Skip",
7    "configurationOptions": {
8      "validateProductCatalog": true,
9      "validateAmendRenewCancel": true,
10      "executeConfigurationRules": true,
11      "addDefaultConfiguration": true
12    }
13  },
14  "contextDetails": {
15    "contextId": "e055bb18-d4e8-41c3-881e-0132b9561708"
16  },
17  "graph": {
18    "graphId": "updateQuote",
19    "records": [
20      {
21        "referenceId": "refQuote",
22        "record": {
23          "attributes": {
24            "method": "PATCH",
25            "type": "Quote",
26            "id": "801xx000003GZ9bAAG"
27          }
28        }
29      },
30      {
31        "referenceId": "refQuoteLine0",
32        "record": {
33          "attributes": {
34            "type": "QuoteLineItem",
35            "method": "PATCH",
36            "id": "402xx000003KY5vJGH"
37          },
38          "Quantity": "5"
39        }
40      }
41    ]
42  }
43}
This is a sample request to define grouping of quote line items.
1{
2  "pricingPref": "Force",
3  "catalogRatesPref": "Skip",
4  "configurationPref": {
5    "configurationMethod": "Skip",
6    "configurationOptions": {
7      "validateProductCatalog": true,
8      "validateAmendRenewCancel": true,
9      "executeConfigurationRules": true,
10      "addDefaultConfiguration": true
11    }
12  },
13  "contextDetails": {
14    "contextId": "e055bb18-d4e8-41c3-881e-0132b9561708"
15  },
16  "graph": {
17    "graphId": "groupQuoteLines",
18    "records": [
19      {
20        "referenceId": "refQuote",
21        "record": {
22          "attributes": {
23            "method": "PATCH",
24            "type": "Quote",
25            "id": "801xx000003GZ9bAAG"
26          }
27        }
28      },
29      {
30        "referenceId": "refQuoteLine0",
31        "record": {
32          "attributes": {
33            "type": "QuoteLineItem",
34            "method": "PATCH",
35            "id": "402xx000003KY5vJGH"
36          },
37          "QuoteLineGroupId": "@{refQuote.id}"
38        }
39      }
40    ]
41  }
42}
This is s a sample request for the initial grouping of the quote with all the quote lines assigned to the first group.
1{
2  "pricingPref": "Force",
3  "catalogRatesPref": "Skip",
4  "graph": {
5    "graphId": "groupQuote",
6    "records": [
7      {
8        "referenceId": "refQuote",
9        "record": {
10          "attributes": {
11            "type": "Quote",
12            "method": "PATCH",
13            "id": "0Q0xx0000004CAmCAM"
14          }
15        }
16      },
17      {
18        "referenceId": "refQlg1",
19        "record": {
20          "attributes": {
21            "type": "QuoteLineGroup",
22            "method": "POST",
23            "action": "GroupAll"
24          },
25          "Name": "From PST API Group",
26          "QuoteId": "@{refQuote.id}"
27        }
28      }
29    ]
30  }
31}
This is a sample request to ungroup a quote but retain the quote lines.
1{
2   "catalogRatesPref": "Skip",
3   "pricingPref": "Force",
4   "graph": {
5      "graphId": "ungroupQuote",
6      "records": [
7         {
8            "referenceId": "refQuote", 
9            "record": {
10               "attributes": {
11                  "type": "Quote",
12                  "method": "PATCH",
13                  "id":"0Q0xx0000004C99CAE"
14               },
15               "Name": "Grouped Quote with PST API"
16            }
17         },
18         {
19            "referenceId": "refQlg1",
20            "record": {
21               "attributes": {
22                  "type": "QuoteLineGroup",
23                  "method": "DELETE",
24                  "id": "402xx000003KY5vJGH",
25                  "action": "Ungroup"
26               }
27            }
28         }
29      ]
30   }
31}
This is a sample request to create a new group.
1{
2   "catalogRatesPref": "Skip",
3   "pricingPref": "Force",
4   "graph": {
5      "graphId": "createGroup",
6      "records": [
7         {
8            "referenceId": "refQuote",
9            "record": {
10               "attributes": {
11                  "type": "Quote",
12                  "method": "PATCH",
13                  "id":"0Q0xx0000004C99CAE"
14               },
15               "Name": "Grouped Quote with PST API"
16            }
17         },
18         {
19            "referenceId": "refQlg1",
20            "record": {
21               "attributes": {
22                  "type": "QuoteLineGroup",
23                  "method": "POST"
24               },
25               "Name": "From PQ API Group",
26               "QuoteId": "@{refQuote.id}"
27            }
28         }
29      ]
30   }
31}
This example shows a sample request to delete a group.
1{
2   "catalogRatesPref": "Skip",
3   "pricingPref": "Force",
4   "graph": {
5      "graphId": "deleteGroup",
6      "records": [
7         {
8            "referenceId": "refQuote",
9            "record": {
10               "attributes": {
11                  "type": "Quote",
12                  "method": "PATCH",
13                  "id":"0Q0xx0000004C99CAE"
14               },
15               "Name": "Grouped Quote with PST API"
16            }
17         },
18         {
19            "referenceId": "refQlg1",
20            "record": {
21               "attributes": {
22                  "type": "QuoteLineGroup",
23                  "method": "DELETE",
24                  "id": "402xx000003KY5vJGH",
25                  "action": "DeleteGroup"
26               }
27            }
28         }
29      ]
30   }
31}
This is a sample request to group order items based on criteria.
1{
2    "catalogRatesPref": "Skip",
3    "pricingPref": "Force",
4    "graph": {
5        "graphId": "groupOrderItems",
6        "records": [
7            {
8                "referenceId": "refOrder",
9                "record": {
10                    "attributes": {
11                        "type": "Order",
12                        "method": "PATCH",
13                        "id": "0Q0xx0000004C99CAE"
14                    }
15                }
16            },
17            {
18                "referenceId": "refOlg1",
19                "record": {
20                    "attributes": {
21                        "type": "OrderItemGroup",
22                        "method": "POST",
23                        "action": "GroupBy",
24                        "criteria": {
25                            "BillingFrequency2": null
26                        }
27                    },
28                    "Name": "Billing Frequency: ",
29                    "OrderId": "@{refOrder.id}"
30                }
31            },
32            {
33                "referenceId": "g1",
34                "record": {
35                    "attributes": {
36                        "type": "OrderItemGroup",
37                        "method": "POST",
38                        "action": "GroupBy",
39                        "criteria": {
40                            "BillingFrequency2": "Monthly"
41                        }
42                    },
43                    "Name": "Billing Frequency: Monthly",
44                    "OrderId": "@{refOrder.id}"
45                }
46            }
47        ]
48    }
49}
This is a sample request to save changes to a ramp deal by using context ID. The context ID is returned by the Ramp Deal APIs. See Create Ramp Deal (POST).
1{
2  "pricingPref": "Force",
3  "contextDetails": {
4    "contextId": "f1c9e3e1c335f7959a88de09d3a867cc2b95e08709b99de8e2edeb8f5039e8ed",
5    "scope": "Session"
6  },
7  "graph": {
8    "graphId": "updateQuote",
9    "records": [
10      {
11        "referenceId": "refQuote",
12        "record": {
13          "attributes": {
14            "type": "Quote",
15            "method": "PATCH",
16            "id": "0Q0xx0000004DQ4CAM"
17          }
18        }
19      }
20    ]
21  }
22}
Properties
Name Type Description Required or Optional Available Version
catalogRates​Pref String Rate card entries defined in the catalog that must be fetched for sales items with usage-based pricing during the creation of the sales transaction. Valid values are:
  • Fetch—Retrieves the rate card entries defined in the catalog for sales items during the creation of the sales transaction.
  • Skip—Skips the retrieval of rate card entries for sales items during the creation of the sales transaction.

    The default value is Skip.

This property is available when the Usage-Based Selling feature is enabled.
Optional 63.0
configuration​Pref Configurator Preference Input Configuration preference during the quote process. These preferences ensure that quotes are defined as per the requirement. Optional 63.0
contextDetails Context Input Context details that are created for a sales transaction. Required if the graph property isn’t specified. 63.0
graph Object Graph Input

The sObject graph of the sales transaction to be ingested. You can perform create, update, or delete operations on objects from the Sales Transaction context definition by using this property. Additionally, perform create, update, or delete operations on custom objects and fields in your extended context definition.

To create custom objects that are at the grandchildren level from a line item, you must create the hierarchy of objects until the grandchild object in the same request.

Required if the contextDetails property isn’t specified. 63.0
groupRampAction String

Specifies the action ‌that you want to perform on group ramp segments. You can also convert a non-ramped group into a ramped group. Valid values are:

  • AddProducts—Adds rampable products to group ramp segments.
  • DeleteProducts—Deletes ramped products.
  • EditGroup—Converts a non-ramped group into a group ramp segment, or edit group ramp segment attributes such as name and description, except the start and end dates.
  • EditRampSchedule—Edits details of the group ramp segments, including start and end dates.
  • DeleteSegment—Deletes the first or last segment in a group ramp schedule.
  • ConvertToNonRampedGroup—Converts the first or last group ramp segment into a non-ramped group.
To add or delete ramped line items from multiple group ramp segments, specify the applicable values in the graph property. See Group Ramp Action Input to refer to examples.
Optional 65.0
pricingPref String Pricing preference during the creation of a sales transaction. Valid values are:
  • Force—Enforces pricing during the creation of sales transactions.
  • Skip—Skips pricing during the creation of sales transactions.
  • System—Determines whether a pricing calculation is required.

The default value is System.

Optional 63.0
taxPref String Specifies whether to execute or skip the tax calculation step for each sales transaction record. Valid value is Skip. If you don't specify this value, then tax calculation request is performed by default. Optional 65.0
Response body for POST
Place Sales Transaction