<aside> 🤘

Here you’ll learn how easy it is to handle orders

</aside>

This page contains:

  1. Create and track
  2. Send to installers
  3. Handle tags
  4. Use triggers

1. Create and Get Orders

You can create new orders and retrieve existing orders via the API.

<aside> 💡

Keep in mind that orders can currently NOT be deleted - so be cautious on the number of orders you generate. Consider asking for a separate testing environment.

</aside>

Create orders

To create an order, send a POST request with the order details:

fetch("<http://api.installer.com/api/v1/order>", {
	method: "POST",
	headers: {
		"Authorization": Bearer ${apiKey},
		"Content-Type": "application/json"
	},
	body: JSON.stringify(orderData)
})

Example body:

{
  "name": "string", // Order name
  "description": "This is a plain text example.", // Can use [rich text](<https://www.contentful.com/developers/docs/concepts/rich-text/>)
  "workplace": "string",
  "address": "string",
  "city": "Oslo",
  "postalCode": "0365",
  "countryCode": "NO", // ISO 3166-1, A2, uppercase
  "latitude": 59.0,
  "longitude": 59.0,
  "email": "[email protected]", // Client email
  "phoneNumber": "+4799900111", // Using [libphonenumberjs](<https://www.npmjs.com/package/libphonenumber-js>)
  "contactPersonName": "string", // Client full name
  "fileIds": [
    "uuid"
  ],
  "orderTagIds": [
    "uuid"
  ],
  "metadata": { // Any additional fields you want to add
	  "key": "value"
	 },
  "workflowId": "uuid", // Workflow ID can be found here: <https://routing.installer.com/workflow-templates/{workflowId}>
  "workflowCustomId": "your-custom-id", // Workflow custom id is configured in workflow settings 
  "customFields": [ // Any custom fields defined for the workflow
    {
      "customId": "my-custom-field", // Either use custom Id - API reference
      "id": "example-uuid", // ... or use full id (UUID)
      "value": "Value", // Boolean can be without "", e.g. true/false
    }
  ],
  "idempotencyKey": "your-id" // Can be used to avoid creating duplicate orders
	"actorAssignments": [
      {
        "actorSlug": "example-actor-id", // Can be found in the workflow template editor /actors tab
        "organizationId": "example-uuid", // Can be found in "my installers" and clicking at an individual installer
      }
    ],
  "offer": {
	  "name": "offer-name",
	  "payer": "client" // "client" | "operator"
	  "lines": [ // Any lines you want to present to the payer
		  {
			  "productId": "uuid" // Optionally refer to catalog offering (if referring to the catalog productId, then only quantity is needed)
			  "externalId": "string" // Optionally set new / refer to catalog offering externalId
			  "imageUrl": "string"
			  "name": "EV Charger X",
			  "description": "",
			  "quantity": 2 // integer
			  "currencyCode": "NOK",
			  "isTaxInclusive": boolean
			  "isPaid": boolean,
			  "vatRate": "2500" // Integer 2500 => 25%
			  "payerUnitAmount": "100000" // Integer 100000 => 1000,00
			  "discountUnitAmount": "20000" // Integer 20000 => 200,00
			  "discountSourceType": "string" // E.g. campaign key
			  "installerPayoutUnitAmount": "50000" // Integer 50000 => 500,00
		  }
	  ]
  }
}

Returning 201 upon success and return the id of the order.

Returning 400 if idempotencyKey finds a duplicate order.

Get Orders

To fetch all orders, use the following request: