curl --request POST \
--url https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isMainContact": true,
"lineItems": [
{
"name": {
"def": "<string>"
},
"customPrice": 123,
"quantity": 123,
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"stockItems": [
{
"inventoryArticleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"note": "<string>"
}
],
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"note": "<string>",
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": true
}
],
"addonData": {
"type": "cart",
"cartAddonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"addons": [
{
"catalogItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 4503599627370496,
"customPrice": 4503599627370495,
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"selectedVariants": {},
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"checkoutFields": [
{
"fieldId": "<string>",
"value": "<string>"
}
],
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": true
}
],
"orderCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"subscription": {
"label": "<string>",
"price": 123,
"renewalPrice": 123,
"commitmentCycles": 123,
"paymentCycleAmount": 123,
"cancellationLeadTimeAmount": 123
},
"subscriptionDiscounts": [
{
"code": "<string>",
"value": 123,
"subscriptionDurationCycles": 123,
"discountPeriodTo": "<string>"
}
]
}
]
}
'import requests
url = "https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers"
payload = {
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isMainContact": True,
"lineItems": [
{
"name": { "def": "<string>" },
"customPrice": 123,
"quantity": 123,
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"stockItems": [
{
"inventoryArticleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"note": "<string>"
}
],
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"note": "<string>",
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": True
}
],
"addonData": {
"type": "cart",
"cartAddonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"addons": [
{
"catalogItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 4503599627370496,
"customPrice": 4503599627370495,
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"selectedVariants": {},
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"checkoutFields": [
{
"fieldId": "<string>",
"value": "<string>"
}
],
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": True
}
],
"orderCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"subscription": {
"label": "<string>",
"price": 123,
"renewalPrice": 123,
"commitmentCycles": 123,
"paymentCycleAmount": 123,
"cancellationLeadTimeAmount": 123
},
"subscriptionDiscounts": [
{
"code": "<string>",
"value": 123,
"subscriptionDurationCycles": 123,
"discountPeriodTo": "<string>"
}
]
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
isMainContact: true,
lineItems: [
{
name: {def: '<string>'},
customPrice: 123,
quantity: 123,
manualDiscount: 4503599627370495,
discountCodes: {},
customDeposit: 4503599627370495,
stockItems: [{inventoryArticleId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', note: '<string>'}],
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
note: '<string>',
customCheckoutFields: [{name: '<string>', value: '<string>', internal: true}],
addonData: {type: 'cart', cartAddonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
addons: [
{
catalogItemId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 4503599627370496,
customPrice: 4503599627370495,
addonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
selectedVariants: {},
manualDiscount: 4503599627370495,
discountCodes: {},
customDeposit: 4503599627370495,
checkoutFields: [{fieldId: '<string>', value: '<string>'}],
customCheckoutFields: [{name: '<string>', value: '<string>', internal: true}],
orderCustomerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
subscription: {
label: '<string>',
price: 123,
renewalPrice: 123,
commitmentCycles: 123,
paymentCycleAmount: 123,
cancellationLeadTimeAmount: 123
},
subscriptionDiscounts: [
{
code: '<string>',
value: 123,
subscriptionDurationCycles: 123,
discountPeriodTo: '<string>'
}
]
}
]
})
};
fetch('https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers', 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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers",
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([
'customerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'isMainContact' => true,
'lineItems' => [
[
'name' => [
'def' => '<string>'
],
'customPrice' => 123,
'quantity' => 123,
'manualDiscount' => 4503599627370495,
'discountCodes' => [
],
'customDeposit' => 4503599627370495,
'stockItems' => [
[
'inventoryArticleId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'note' => '<string>'
]
],
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'note' => '<string>',
'customCheckoutFields' => [
[
'name' => '<string>',
'value' => '<string>',
'internal' => true
]
],
'addonData' => [
'type' => 'cart',
'cartAddonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'addons' => [
[
'catalogItemId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 4503599627370496,
'customPrice' => 4503599627370495,
'addonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'selectedVariants' => [
],
'manualDiscount' => 4503599627370495,
'discountCodes' => [
],
'customDeposit' => 4503599627370495,
'checkoutFields' => [
[
'fieldId' => '<string>',
'value' => '<string>'
]
],
'customCheckoutFields' => [
[
'name' => '<string>',
'value' => '<string>',
'internal' => true
]
],
'orderCustomerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'subscription' => [
'label' => '<string>',
'price' => 123,
'renewalPrice' => 123,
'commitmentCycles' => 123,
'paymentCycleAmount' => 123,
'cancellationLeadTimeAmount' => 123
],
'subscriptionDiscounts' => [
[
'code' => '<string>',
'value' => 123,
'subscriptionDurationCycles' => 123,
'discountPeriodTo' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers"
payload := strings.NewReader("{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "<string>",
"updatedAt": "<string>",
"firstName": "<string>",
"fullName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"marketingConsent": true,
"checkoutFields": {
"name": "<string>",
"type": "text",
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"placeholder": "<string>",
"required": true,
"internal": true,
"attributeId": "<string>",
"attributeFormat": "text",
"options": {
"name": "<string>"
},
"value": "<string>",
"checkoutFieldId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"crmCustomerId": "<string>",
"dateOfBirth": "2023-12-25",
"billingAddress": {
"address": "<string>",
"zipCode": "<string>",
"city": "<string>",
"country": "<string>",
"state": "<string>",
"details": "<string>",
"deliveryNotes": "<string>"
},
"shippingAddress": {
"address": "<string>",
"zipCode": "<string>",
"city": "<string>",
"country": "<string>",
"state": "<string>",
"details": "<string>",
"deliveryNotes": "<string>"
},
"customerType": "individual",
"companyName": "<string>",
"taxId": "<string>",
"language": "<string>"
}Attaches a customer entry to the order. Order customers are order-scoped snapshots, distinct from the CRM customer record — see the customers endpoints for the CRM side.
curl --request POST \
--url https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isMainContact": true,
"lineItems": [
{
"name": {
"def": "<string>"
},
"customPrice": 123,
"quantity": 123,
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"stockItems": [
{
"inventoryArticleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"note": "<string>"
}
],
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"note": "<string>",
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": true
}
],
"addonData": {
"type": "cart",
"cartAddonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"addons": [
{
"catalogItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 4503599627370496,
"customPrice": 4503599627370495,
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"selectedVariants": {},
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"checkoutFields": [
{
"fieldId": "<string>",
"value": "<string>"
}
],
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": true
}
],
"orderCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"subscription": {
"label": "<string>",
"price": 123,
"renewalPrice": 123,
"commitmentCycles": 123,
"paymentCycleAmount": 123,
"cancellationLeadTimeAmount": 123
},
"subscriptionDiscounts": [
{
"code": "<string>",
"value": 123,
"subscriptionDurationCycles": 123,
"discountPeriodTo": "<string>"
}
]
}
]
}
'import requests
url = "https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers"
payload = {
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isMainContact": True,
"lineItems": [
{
"name": { "def": "<string>" },
"customPrice": 123,
"quantity": 123,
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"stockItems": [
{
"inventoryArticleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"note": "<string>"
}
],
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"note": "<string>",
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": True
}
],
"addonData": {
"type": "cart",
"cartAddonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"addons": [
{
"catalogItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 4503599627370496,
"customPrice": 4503599627370495,
"addonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"selectedVariants": {},
"manualDiscount": 4503599627370495,
"discountCodes": {},
"customDeposit": 4503599627370495,
"checkoutFields": [
{
"fieldId": "<string>",
"value": "<string>"
}
],
"customCheckoutFields": [
{
"name": "<string>",
"value": "<string>",
"internal": True
}
],
"orderCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"subscription": {
"label": "<string>",
"price": 123,
"renewalPrice": 123,
"commitmentCycles": 123,
"paymentCycleAmount": 123,
"cancellationLeadTimeAmount": 123
},
"subscriptionDiscounts": [
{
"code": "<string>",
"value": 123,
"subscriptionDurationCycles": 123,
"discountPeriodTo": "<string>"
}
]
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
isMainContact: true,
lineItems: [
{
name: {def: '<string>'},
customPrice: 123,
quantity: 123,
manualDiscount: 4503599627370495,
discountCodes: {},
customDeposit: 4503599627370495,
stockItems: [{inventoryArticleId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', note: '<string>'}],
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
note: '<string>',
customCheckoutFields: [{name: '<string>', value: '<string>', internal: true}],
addonData: {type: 'cart', cartAddonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
addons: [
{
catalogItemId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 4503599627370496,
customPrice: 4503599627370495,
addonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
selectedVariants: {},
manualDiscount: 4503599627370495,
discountCodes: {},
customDeposit: 4503599627370495,
checkoutFields: [{fieldId: '<string>', value: '<string>'}],
customCheckoutFields: [{name: '<string>', value: '<string>', internal: true}],
orderCustomerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
subscription: {
label: '<string>',
price: 123,
renewalPrice: 123,
commitmentCycles: 123,
paymentCycleAmount: 123,
cancellationLeadTimeAmount: 123
},
subscriptionDiscounts: [
{
code: '<string>',
value: 123,
subscriptionDurationCycles: 123,
discountPeriodTo: '<string>'
}
]
}
]
})
};
fetch('https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers', 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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers",
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([
'customerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'isMainContact' => true,
'lineItems' => [
[
'name' => [
'def' => '<string>'
],
'customPrice' => 123,
'quantity' => 123,
'manualDiscount' => 4503599627370495,
'discountCodes' => [
],
'customDeposit' => 4503599627370495,
'stockItems' => [
[
'inventoryArticleId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'note' => '<string>'
]
],
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'note' => '<string>',
'customCheckoutFields' => [
[
'name' => '<string>',
'value' => '<string>',
'internal' => true
]
],
'addonData' => [
'type' => 'cart',
'cartAddonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'addons' => [
[
'catalogItemId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 4503599627370496,
'customPrice' => 4503599627370495,
'addonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'selectedVariants' => [
],
'manualDiscount' => 4503599627370495,
'discountCodes' => [
],
'customDeposit' => 4503599627370495,
'checkoutFields' => [
[
'fieldId' => '<string>',
'value' => '<string>'
]
],
'customCheckoutFields' => [
[
'name' => '<string>',
'value' => '<string>',
'internal' => true
]
],
'orderCustomerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'subscription' => [
'label' => '<string>',
'price' => 123,
'renewalPrice' => 123,
'commitmentCycles' => 123,
'paymentCycleAmount' => 123,
'cancellationLeadTimeAmount' => 123
],
'subscriptionDiscounts' => [
[
'code' => '<string>',
'value' => 123,
'subscriptionDurationCycles' => 123,
'discountPeriodTo' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers"
payload := strings.NewReader("{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://server.twicecommerce.com/v1/admin/orders/{orderId}/customers")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.twicecommerce.com/v1/admin/orders/{orderId}/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isMainContact\": true,\n \"lineItems\": [\n {\n \"name\": {\n \"def\": \"<string>\"\n },\n \"customPrice\": 123,\n \"quantity\": 123,\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"stockItems\": [\n {\n \"inventoryArticleId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"note\": \"<string>\"\n }\n ],\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"addonData\": {\n \"type\": \"cart\",\n \"cartAddonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"addons\": [\n {\n \"catalogItemId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 4503599627370496,\n \"customPrice\": 4503599627370495,\n \"addonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"selectedVariants\": {},\n \"manualDiscount\": 4503599627370495,\n \"discountCodes\": {},\n \"customDeposit\": 4503599627370495,\n \"checkoutFields\": [\n {\n \"fieldId\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customCheckoutFields\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"internal\": true\n }\n ],\n \"orderCustomerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"subscription\": {\n \"label\": \"<string>\",\n \"price\": 123,\n \"renewalPrice\": 123,\n \"commitmentCycles\": 123,\n \"paymentCycleAmount\": 123,\n \"cancellationLeadTimeAmount\": 123\n },\n \"subscriptionDiscounts\": [\n {\n \"code\": \"<string>\",\n \"value\": 123,\n \"subscriptionDurationCycles\": 123,\n \"discountPeriodTo\": \"<string>\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "<string>",
"updatedAt": "<string>",
"firstName": "<string>",
"fullName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"email": "jsmith@example.com",
"marketingConsent": true,
"checkoutFields": {
"name": "<string>",
"type": "text",
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"placeholder": "<string>",
"required": true,
"internal": true,
"attributeId": "<string>",
"attributeFormat": "text",
"options": {
"name": "<string>"
},
"value": "<string>",
"checkoutFieldId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"crmCustomerId": "<string>",
"dateOfBirth": "2023-12-25",
"billingAddress": {
"address": "<string>",
"zipCode": "<string>",
"city": "<string>",
"country": "<string>",
"state": "<string>",
"details": "<string>",
"deliveryNotes": "<string>"
},
"shippingAddress": {
"address": "<string>",
"zipCode": "<string>",
"city": "<string>",
"country": "<string>",
"state": "<string>",
"details": "<string>",
"deliveryNotes": "<string>"
},
"customerType": "individual",
"companyName": "<string>",
"taxId": "<string>",
"language": "<string>"
}Authorizations
API key for the Twice API
Path Parameters
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Body
Body
- Option 1
- Option 2
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$- Option 1
- Option 2
Hide child attributes
Hide child attributes
booking, sale, subscription, buyback 0 <= x <= 9007199254740991Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Security deposit for this custom line. Custom items have no catalog deposit.
0 <= x <= 9007199254740991- Option 1
- Option 2
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$Hide child attributes
Hide child attributes
- Option 1
- Option 2
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$1 <= x <= 90071992547409910 <= x <= 9007199254740991^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$booking, sale ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$0 <= x <= 9007199254740991Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Overrides the catalog-derived security deposit for this line. Omit to use the catalog item deposit.
0 <= x <= 9007199254740991Hide child attributes
Hide child attributes
text, select, number, checkbox, customer_attribute ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Hide child attributes
Hide child attributes
1x <= 9007199254740991x <= 9007199254740991x <= 9007199254740991seconds, minutes, hours, days, weeks, months, years x <= 9007199254740991order_creation, subscription_start none, auto_renew charge_automatically, send_invoice seconds, minutes, hours, days, weeks, months, years x <= 9007199254740991Hide child attributes
Hide child attributes
percentage, fixed_per_order, fixed_per_item once, repeating, forever Hide child attributes
Hide child attributes
percentage, fixed_per_order, fixed_per_item once, repeating, forever Hide child attributes
Hide child attributes
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Hide child attributes
Hide child attributes
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991Response
200
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$Hide child attributes
Hide child attributes
text, select, number, checkbox, customer_attribute ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$text, number, boolean, date, datetime, formula, select, multiselect ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$individual, business Was this page helpful?