curl --request POST \
--url https://{instance}.my.salesforce.com/services/apexrest/v1/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"businessUnitId": "a0X5g000000abcDEAA",
"customerType": "ORGANIZATION",
"accountId": "0015g00000XyZabAAB",
"billToContactId": "0035g00000PqRstAAA",
"currencyIsoCode": "USD"
}
'import requests
url = "https://{instance}.my.salesforce.com/services/apexrest/v1/order"
payload = {
"businessUnitId": "a0X5g000000abcDEAA",
"customerType": "ORGANIZATION",
"accountId": "0015g00000XyZabAAB",
"billToContactId": "0035g00000PqRstAAA",
"currencyIsoCode": "USD"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
businessUnitId: 'a0X5g000000abcDEAA',
customerType: 'ORGANIZATION',
accountId: '0015g00000XyZabAAB',
billToContactId: '0035g00000PqRstAAA',
currencyIsoCode: 'USD'
})
};
fetch('https://{instance}.my.salesforce.com/services/apexrest/v1/order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.my.salesforce.com/services/apexrest/v1/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'businessUnitId' => 'a0X5g000000abcDEAA',
'customerType' => 'ORGANIZATION',
'accountId' => '0015g00000XyZabAAB',
'billToContactId' => '0035g00000PqRstAAA',
'currencyIsoCode' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.my.salesforce.com/services/apexrest/v1/order"
payload := strings.NewReader("{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.my.salesforce.com/services/apexrest/v1/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.my.salesforce.com/services/apexrest/v1/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"id": "8015g00000AbCdEAAQ",
"uuid": "f6c1c6a9-1b3e-4a2f-9a55-2c1d0e8f3a11",
"success": true
}{
"success": false,
"errors": [
"businessUnitId is required"
]
}Create an order
Creates a new Salesforce Order via the fusionCore Commerce service layer. Returns the created Order’s Salesforce Id and the fusionCore Order UUID.
curl --request POST \
--url https://{instance}.my.salesforce.com/services/apexrest/v1/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"businessUnitId": "a0X5g000000abcDEAA",
"customerType": "ORGANIZATION",
"accountId": "0015g00000XyZabAAB",
"billToContactId": "0035g00000PqRstAAA",
"currencyIsoCode": "USD"
}
'import requests
url = "https://{instance}.my.salesforce.com/services/apexrest/v1/order"
payload = {
"businessUnitId": "a0X5g000000abcDEAA",
"customerType": "ORGANIZATION",
"accountId": "0015g00000XyZabAAB",
"billToContactId": "0035g00000PqRstAAA",
"currencyIsoCode": "USD"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
businessUnitId: 'a0X5g000000abcDEAA',
customerType: 'ORGANIZATION',
accountId: '0015g00000XyZabAAB',
billToContactId: '0035g00000PqRstAAA',
currencyIsoCode: 'USD'
})
};
fetch('https://{instance}.my.salesforce.com/services/apexrest/v1/order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.my.salesforce.com/services/apexrest/v1/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'businessUnitId' => 'a0X5g000000abcDEAA',
'customerType' => 'ORGANIZATION',
'accountId' => '0015g00000XyZabAAB',
'billToContactId' => '0035g00000PqRstAAA',
'currencyIsoCode' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.my.salesforce.com/services/apexrest/v1/order"
payload := strings.NewReader("{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.my.salesforce.com/services/apexrest/v1/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.my.salesforce.com/services/apexrest/v1/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"businessUnitId\": \"a0X5g000000abcDEAA\",\n \"customerType\": \"ORGANIZATION\",\n \"accountId\": \"0015g00000XyZabAAB\",\n \"billToContactId\": \"0035g00000PqRstAAA\",\n \"currencyIsoCode\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"id": "8015g00000AbCdEAAQ",
"uuid": "f6c1c6a9-1b3e-4a2f-9a55-2c1d0e8f3a11",
"success": true
}{
"success": false,
"errors": [
"businessUnitId is required"
]
}Authorizations
Salesforce session ID (or OAuth 2.0 access token issued by the Salesforce org) supplied as Authorization: Bearer <token>. Obtain via the Salesforce OAuth 2.0 flows or the SOAP login API.
Body
Salesforce Id of the Business Unit (FCORE_PAY__Business_Unit__c) the order is being placed under.
Customer type for the order. Typical values include ORGANIZATION and INDIVIDUAL; consult your fusionCore Commerce configuration for the full list.
Salesforce Id of the Account that owns the order.
Salesforce Id of the bill-to Contact (optional).
ISO 4217 currency code (for example USD). Required when the org is multi-currency.
Response
Order created.
Common envelope returned by every endpoint. Concrete responses extend this shape with operation-specific fields.

