Fluent Commerce Logo
Docs
Sign In

createOrderAndCustomer sample

Essential knowledge

Author:

Fluent Commerce

Changed on:

1 Feb 2024

Overview

GQL createOrderAndCustomer example

Key points

  • Example GQL of createOrderAndCustomer


Click & Collect sample:

POST {{fluentApiHost}}/graphql

Mutation:

1mutation createOrderAndCustomer ($input: CreateOrderAndCustomerInput) {
2    createOrderAndCustomer (input: $input) {
3        id
4        ref
5        type
6        status
7        workflowRef
8        workflowVersion
9        createdOn
10        updatedOn
11        totalPrice
12        totalTaxPrice
13    }
14}

Language: graphqlschema

Name: Click & Collect createOrderAndCustomer mutation

Description:

[Warning: empty required content area]

Input Variables:

1{
2  "input": {
3    "ref": "CC_{{$randomInt}}{{$randomInt}}{{$randomInt}}",
4    "type": "CC",
5    "attributes": {
6      "name": "fulfilmentPrice",
7      "type": "String",
8      "value": "100"
9    },
10    "retailer": {
11      "id": {{retailer_id}}
12    },
13    "totalPrice": "60.00",
14    "totalTaxPrice": "6.00",
15    "fulfilmentChoice": {
16      "currency": "AUD",
17      "deliveryInstruction": "LEAVE AT FRONT DOOR",
18      "deliveryType": "STANDARD",
19      "fulfilmentPrice": "5.00",
20      "fulfilmentTaxPrice": "0.50",
21      "fulfilmentType": "CC_PFS",
22      "pickupLocationRef": "LOC_MELB"
23    },
24    "customer": {
25      "username": "{{$timestamp}}",
26      "attributes": {
27        "name": "VIP_NUMBER",
28        "type": "String",
29        "value": "VIP123"
30      },
31      "country": "Australia",
32      "firstName": "{{$randomFirstName}}",
33      "lastName": "{{$randomLastName}}",
34      "primaryEmail": "{{$randomEmail}}",
35      "primaryPhone": "+1234567890",
36      "timezone": "GMT+10",
37      "promotionOptIn": true,
38      "retailer": {
39        "id": {{retailer_id}}
40      }
41    },
42    "items": [
43    {
44      "ref": "HEADPHONE001",
45      "productRef": "HEADPHONE001",
46      "productCatalogueRef": "PC:MASTER:1",
47      "quantity": 5,
48      "paidPrice": "2.20",
49      "currency": "AUD",
50      "price": "2.00",
51      "taxPrice": "0.20",
52      "taxType": "GST",
53      "totalPrice": "12.00",
54      "totalTaxPrice": "2.00",
55      "attributes": {
56        "name": "COLOR",
57        "type": "String",
58        "value": "WHITE"
59      }
60    },
61    {
62      "ref": "HEADPHONE004",
63      "productRef": "HEADPHONE004",
64      "productCatalogueRef": "PC:MASTER:1",
65      "quantity": 3,
66      "paidPrice": "2.20",
67      "currency": "AUD",
68      "price": "2.00",
69      "taxPrice": "0.20",
70      "taxType": "GST",
71      "totalPrice": "12.00",
72      "totalTaxPrice": "2.00",
73      "attributes": {
74        "name": "COLOR",
75        "type": "String",
76        "value": "BLUE"
77      }
78    }
79    ]
80  }
81}

Language: json

Name: Input Variable - Click & Collect

Description:

[Warning: empty required content area]


Home Delivery sample:

POST {{fluentApiHost}}/graphql

Mutation: 

1mutation createOrderAndCustomer ($input: CreateOrderAndCustomerInput) {
2    createOrderAndCustomer (input: $input) {
3        id
4        ref
5        type
6        status
7        workflowRef
8        workflowVersion
9        createdOn
10        updatedOn
11        totalPrice
12        totalTaxPrice
13    }
14}

Language: graphqlschema

Name: Home Delivery createOrderAndCustomer mutation

Description:

[Warning: empty required content area]

Input Variables:

1{
2  "input": {
3    "ref": "HD_{{$randomInt}}{{$randomInt}}{{$randomInt}}",
4    "type": "HD",
5    "attributes": {
6      "name": "fulfilmentPrice",
7      "type": "String",
8      "value": "100"
9    },
10    "retailer": {
11      "id": {{retailer_id}}
12    },
13    "totalPrice": "60.00",
14    "totalTaxPrice": "6.00",
15    "fulfilmentChoice": {
16      "currency": "AUD",
17      "deliveryInstruction": "LEAVE AT FRONT DOOR",
18      "deliveryType": "STANDARD",
19      "fulfilmentPrice": "5.00",
20      "fulfilmentTaxPrice": "0.50",
21      "fulfilmentType": "CC_PFS",
22       "deliveryAddress": {
23        "ref": "Joe_Bob",
24        "companyName": "",
25        "name": "Joe Bob",
26        "street": "48 George St",
27        "city": "SYDNEY",
28        "state": "NSW",
29        "postcode": "2170",
30        "region": "",
31        "country": "Australia",
32        "latitude": -33.9195927,
33        "longitude":  150.9251352,
34        "timeZone": "GMT+10"
35      }
36    },
37    "customer": {
38      "username": "{{$timestamp}}",
39      "attributes": {
40        "name": "VIP_NUMBER",
41        "type": "String",
42        "value": "VIP123"
43      },
44      "country": "Australia",
45      "firstName": "{{$randomFirstName}}",
46      "lastName": "{{$randomLastName}}",
47      "primaryEmail": "{{$randomEmail}}",
48      "primaryPhone": "+1234567890",
49      "timezone": "GMT+10",
50      "promotionOptIn": true,
51      "retailer": {
52        "id": {{retailer_id}}
53      }
54    },
55    "items": [
56    {
57      "ref": "HEADPHONE001",
58      "productRef": "HEADPHONE001",
59      "productCatalogueRef": "PC:MASTER:1",
60      "quantity": 5,
61      "paidPrice": "2.20",
62      "currency": "AUD",
63      "price": "2.00",
64      "taxPrice": "0.20",
65      "taxType": "GST",
66      "totalPrice": "12.00",
67      "totalTaxPrice": "2.00",
68      "attributes": {
69        "name": "COLOR",
70        "type": "String",
71        "value": "WHITE"
72      }
73    },
74    {
75      "ref": "HEADPHONE004",
76      "productRef": "HEADPHONE004",
77      "productCatalogueRef": "PC:MASTER:1",
78      "quantity": 3,
79      "paidPrice": "2.20",
80      "currency": "AUD",
81      "price": "2.00",
82      "taxPrice": "0.20",
83      "taxType": "GST",
84      "totalPrice": "12.00",
85      "totalTaxPrice": "2.00",
86      "attributes": {
87        "name": "COLOR",
88        "type": "String",
89        "value": "BLUE"
90      }
91    }
92    ]
93  }
94}

Language: json

Name: Input Variables - Home Delivery createOrderAndCustomer

Description:

[Warning: empty required content area]

 


Fluent Commerce

Fluent Commerce